Skip to content

fix(eventhub,s3): stabilize publish test and optimize S3 ReadDir one-level listing#3492

Merged
Umang01-hash merged 4 commits into
gofr-dev:developmentfrom
Manidwiptam:feature/swag-contribution
Jul 23, 2026
Merged

fix(eventhub,s3): stabilize publish test and optimize S3 ReadDir one-level listing#3492
Umang01-hash merged 4 commits into
gofr-dev:developmentfrom
Manidwiptam:feature/swag-contribution

Conversation

@Manidwiptam

@Manidwiptam Manidwiptam commented May 28, 2026

Copy link
Copy Markdown
Contributor

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

@Umang01-hash Umang01-hash left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread pkg/gofr/datasource/file/s3/fs_dir.go
Comment thread pkg/gofr/datasource/file/s3/fs_dir.go
@Umang01-hash
Umang01-hash merged commit 3493b22 into gofr-dev:development Jul 23, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Fix flaky EventHub publish test, prevent nil-client crash, and optimize S3 ReadDir memory overhead

3 participants