fix(eventhub,s3): stabilize publish test and optimize S3 ReadDir one-level listing#3492
Merged
Umang01-hash merged 4 commits intoJul 23, 2026
Merged
Conversation
…ontribution # Conflicts: # pkg/gofr/datasource/pubsub/eventhub/eventhub_test.go
Umang01-hash
approved these changes
Jul 23, 2026
Umang01-hash
left a comment
Member
There was a problem hiding this comment.
LGTM. Two small, correct fixes.
S3 ReadDir: verified live against MinIO — seeding abc/root.txt + nested abc/efg/* + abc/hij/*, ReadDir("abc") returns exactly efg(dir), hij(dir), root.txt(file) — nested objects correctly collapsed into CommonPrefixes server-side. Good optimization of the old client-side dedup.
Eventhub: the producer == nil guard reuses the existing sentinel and the new deterministic test replaces the flaky skipped one; TestPublish_FailedInvalidTopic still passes since it connects first.
gofmt/vet/build/tests clean on both modules, no breaking API change (getRelativepath was unexported). Only nits below. Minor: two unrelated fixes in one PR — fine, just noting.
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.
This commit improves reliability and performance in two areas:
EventHub:
Replaces a flaky, skipped publish test with a deterministic unit test.
Adds a safety guard in Publish to return errClientNotConnected when the producer is not initialized, preventing nil-client failures.
S3:
Refactors ReadDir to list only one-level directory entries using Delimiter and CommonPrefixes.
Avoids loading nested object metadata unnecessarily, reducing memory overhead.
Adds test coverage to validate one-level listing behavior.
Closes #3493