test(block/gs): run pre-signed URL test with fake-gcs-server#9988
Merged
test(block/gs): run pre-signed URL test with fake-gcs-server#9988
Conversation
Add `nowFactory` injection and explicit signing credentials to enable proper testing of GetPreSignedURL with `fake-gcs-server`. This follows the same pattern used in the Azure adapter. - Add WithNowFactory option to mock time.Now() for deterministic tests - Add WithPresignedCredentials option for fake-gcs-server signing - Remove "no credentials found" test skip workaround - Include test RSA private key for URL signing
itaigilo
approved these changes
Feb 5, 2026
| nowFactory func() time.Time | ||
| // presignedGoogleAccessID and presignedPrivateKey are used for testing with fake-gcs-server | ||
| // which requires explicit signing credentials since the test client has no credentials | ||
| presignedGoogleAccessID string |
Contributor
There was a problem hiding this comment.
Nit: I don't think you should name vars with Google in a gs package,
I think that presignedAccessID should be enough.
Contributor
Author
There was a problem hiding this comment.
The SignedURLOptions in google sdk has Google in the name, so here we are only adding a prefix presigned to those options.
lakeFS/pkg/block/gs/adapter.go
Lines 267 to 271 in f6f33ed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6347
Change Description
Background
This PR enables pre-signed URL tests to run with
fake-gcs-server. Previously, these tests were skipped when no credentials were set.To make this work, explicit signing credentials (
GoogleAccessIDandPrivateKey) are passed to the adapter. This workaround is necessary because:fake-gcs-serverdoesn't validate signatures (fsouza/fake-gcs-server#381)PrivateKeyandGoogleAccessIDto sign URLs.storage: signed url with STORAGE_EMULATOR_HOST get no credentials error googleapis/google-cloud-go#8634
Also adds
nowFactoryinjection for deterministic tests, following the same pattern used in the Azure adapter.Alternatives considered
I'm happy to close this if the workaround feels too complicated.
Testing Details
Pre-signed URL tests now run with
fake-gcs-serverinstead of being skipped.Breaking Change?
No. The changes only affect test configurations.
Additional info
Related: