feat(bdd): add shared stream operations scenario for Go SDK#3245
feat(bdd): add shared stream operations scenario for Go SDK#3245ex172000 wants to merge 7 commits into
Conversation
Move step definitions from stream_operations_test.go to stream_operations.go (non-test file) and register the suite in suite_test.go, matching the pattern used by basic_messaging and leader_redirection. Update imports to use refactored Go SDK paths (client, client/tcp, contracts). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
apache#1986) Extend the shared basic_messaging.feature with stream update and delete steps, covering full CRUD lifecycle. Add matching step definitions in all 6 SDKs (Go, Python, Rust, Java, Node, C#). Add update_stream and delete_stream methods to the Python SDK (PyO3). Remove the separate stream_operations.feature and its Go-only implementation to avoid duplication. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use iggy::prelude::Identifier instead of iggy::identifier::Identifier and unwrap Option<StreamDetails> from get_stream. Add null assertion for stream.get() return value in Node step definition. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Verify stream deletion via GetStream rather than checking the local pointer, which whenDeleteStream sets to nil itself (chengxilo). - Anchor all Go sc.Step regexes with ^...$ for consistency (chengxilo). - Document the per-scenario After cleanup as best-effort and note the longer-term direction of a global cleanup script (chengxilo). - Make the stream-delete step explicit by passing the stream name in the feature file instead of relying on implicit prior-step state (hubcio). Update Go, Rust, Python, Java, C#, and Node step definitions to match the new "I delete the stream with name ..." step.
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #3245 +/- ##
============================================
- Coverage 74.17% 73.77% -0.41%
Complexity 943 943
============================================
Files 1200 1190 -10
Lines 109618 107020 -2598
Branches 86509 84011 -2498
============================================
- Hits 81312 78953 -2359
+ Misses 25561 25330 -231
+ Partials 2745 2737 -8
🚀 New features to boost your workflow:
|
|
/ready |
hubcio
left a comment
There was a problem hiding this comment.
minor extra note that didn't fit a hunk: bdd/python/tests/test_basic_messaging.py:63-68 - no_streams_in_system is pass. other 5 SDKs actually call get_streams() and assert empty. relies on the --fresh server flag instead. asymmetric vs the rest; worth fixing while in the area but not blocking.
also noting a pre-existing gotcha that the new symmetric regex highlights: bdd/rust/tests/steps/streams.rs:36 uses ^I create a stream with name (.+)$ (no quote strip) so it captures the literal gherkin quotes - rust BDD has been creating a stream actually named "test-stream" (with the double quotes) on the server. the new step at line 68 uses "([^"]*)" correctly. follow-up.
| #[then("the stream should be deleted successfully")] | ||
| pub async fn then_stream_deleted_successfully(world: &mut GlobalContext) { | ||
| assert!( | ||
| world.last_stream_id.is_none(), |
There was a problem hiding this comment.
this only checks world.last_stream_id, which the when-step at line 101 just set to None - it can never fail. for real coverage mirror the go pattern at bdd/go/tests/basic_messaging.go:250-261: re-fetch via client.get_stream(&identifier) against the deleted id and expect not-found / None.
| @then("the stream should be deleted successfully") | ||
| def verify_stream_deleted(context): | ||
| """Verify stream was deleted""" | ||
| assert context.last_stream_id is None |
There was a problem hiding this comment.
tautological - the when-step three lines above nulled context.last_stream_id, and this just asserts it's None. add a server roundtrip - await context.client.get_stream(...) against the deleted id and expect missing - to match bdd/go/tests/basic_messaging.go:250-261.
|
|
||
| @Then("the stream should be deleted successfully") | ||
| public void streamDeletedSuccessfully() { | ||
| assertNull(context.lastStreamId, "Stream should have been deleted"); |
There was a problem hiding this comment.
assertNull(context.lastStreamId) re-checks a local field the when-step at line 230 just nulled, so it can't fail. mirror bdd/go/tests/basic_messaging.go:250-261: call getClient().streams().getStream(...) against the deleted id and assert empty Optional.
| [Then(@"the stream should be deleted successfully")] | ||
| public void ThenTheStreamShouldBeDeletedSuccessfully() | ||
| { | ||
| _context.CreatedStream.ShouldBeNull(); |
There was a problem hiding this comment.
the when-step at line 221 already nulled _context.CreatedStream, so this assertion can't fail. mirror bdd/go/tests/basic_messaging.go:250-261: await _context.IggyClient.GetStreamByIdAsync(...) against the deleted id and assert null.
| 'the stream should be deleted successfully', | ||
| async function (this: TestWorld) { | ||
| // If we reached here without error, the stream was deleted successfully | ||
| assert.ok(true); |
There was a problem hiding this comment.
assert.ok(true) is a no-op - it never fails regardless of server state. the when-step at line 71 already wraps the delete call in assert.ok(...), so this then-step adds zero coverage. re-fetch via this.client.stream.get({ streamId: name }) and assert it returns null / throws, matching bdd/go/tests/basic_messaging.go:250-261.
|
|
||
| Returns Option of stream details or a PyRuntimeError on failure. | ||
| """ | ||
| def update_stream( |
There was a problem hiding this comment.
apache_iggy.pyi is auto-generated by pyo3_stub_gen per the header at line 18. can you confirm this diff was produced by re-running the generator rather than hand-edited? hand edits get clobbered on next regen. the stub shape matches the surrounding methods so it's probably regenerated, just want to be sure.
| When I update the stream name to "test-stream-updated" | ||
| Then the stream name should be updated to "test-stream-updated" | ||
|
|
||
| When I delete the stream with name "test-stream-updated" |
There was a problem hiding this comment.
delete-step uses the new name test-stream-updated. nothing in the scenario asserts the old name test-stream no longer resolves after the rename. minor gap - delete-by-new-name succeeding implies the rename happened, but an explicit Then stream "test-stream" should not exist would lock it down.
Continues / supersedes #3063, which was auto-closed due to inactivity. The branch was force-pushed (rebase on current
masterplus a new fixup commit), so GitHub does not allow reopening the original PR.Which issue does this PR close?
Related to #1986
What changed?
The four commits on this branch add a shared Gherkin feature file for stream CRUD operations and corresponding
godogstep definitions, then layer inupdate/deletefor streams across all SDKs. The new commit on top addresses the remaining review feedback from #3063:thenStreamDeletedSuccessfullynow verifies viaGetStreamagainst the server instead of checking a local pointer thatwhenDeleteStreamitself set to nil.sc.Stepregexes inbdd/go/tests/basic_messaging.gowith^...$for consistency.Aftercleanup but documented it as best-effort, with a note that a global cleanup script is the better long-term direction.When I delete the stream with name "...") instead of relying on implicit prior-step state. Updated the Go, Rust, Python, Java, C#, and Node step definitions to match.Local Execution
master.go vet ./tests/...andgo test -count=0 ./tests/...pass forbdd/go.golangci-lintandcsharp-dotnet-formatwere skipped locally due to toolchain gaps —golangci-lintpinned at v1.64.8 (Go 1.23) cannot lint a Go 1.25 project, anddotnetis not on this machine; CI will exercise both properly).AI Usage