Jamison929611 commented on code in PR #3875:
URL: https://github.com/apache/iggy/pull/3875#discussion_r3780445436


##########
bdd/rust/tests/steps/streams.rs:
##########
@@ -63,3 +63,91 @@ pub async fn then_stream_has_name(world: &mut GlobalContext, 
expected_name: Stri
         "Stream should have expected name"
     );
 }
+
+#[given(regex = r#"^a stream with name "(.+)" exists$"#)]
+pub async fn given_stream_exists(world: &mut GlobalContext, stream_name: 
String) {
+    when_create_stream(world, stream_name).await;
+}
+
+#[when("I get the stream by its numeric ID")]
+pub async fn when_get_stream_by_numeric_id(world: &mut GlobalContext) {
+    let client = world.client.as_ref().expect("Client should be available");
+    let stream_id = world
+        .last_stream_id
+        .expect("Stream should have been created");
+    let stream = client
+        .get_stream(&Identifier::numeric(stream_id).expect("Stream ID should 
be valid"))
+        .await
+        .expect("Should be able to get stream");
+
+    world.last_stream_name = stream.map(|stream| stream.name);
+}
+
+#[then(regex = r#"^the returned stream should have name "(.+)"$"#)]
+pub async fn then_returned_stream_has_name(world: &mut GlobalContext, 
expected_name: String) {
+    then_stream_has_name(world, expected_name).await;
+}
+
+#[when("I list all streams")]
+pub async fn when_list_all_streams(world: &mut GlobalContext) {
+    let client = world.client.as_ref().expect("Client should be available");
+    let stream_id = world
+        .last_stream_id
+        .expect("Stream should have been created");
+    let streams = client
+        .get_streams()
+        .await
+        .expect("Should be able to get streams");
+
+    world.last_stream_was_found = streams.iter().any(|stream| stream.id == 
stream_id);
+}
+
+#[then("the stream list should contain the created stream")]
+pub async fn then_stream_list_contains_created_stream(world: &mut 
GlobalContext) {
+    assert!(
+        world.last_stream_was_found,
+        "Stream list should contain the created stream"
+    );
+}
+
+#[when(regex = r#"^I update the stream name to "(.+)"$"#)]
+pub async fn when_update_stream_name(world: &mut GlobalContext, stream_name: 
String) {
+    let client = world.client.as_ref().expect("Client should be available");
+    let stream_id = world
+        .last_stream_id
+        .expect("Stream should have been created");
+    client
+        .update_stream(
+            &Identifier::numeric(stream_id).expect("Stream ID should be 
valid"),
+            &stream_name,
+        )
+        .await
+        .expect("Should be able to update stream");
+}
+
+#[then(regex = r#"^getting the stream by its numeric ID should return name 
"(.+)"$"#)]
+pub async fn then_get_stream_returns_name(world: &mut GlobalContext, 
expected_name: String) {
+    when_get_stream_by_numeric_id(world).await;

Review Comment:
   Refactored the step definitions to call shared private helpers instead of 
other step definitions.



##########
scripts/run-bdd-tests.sh:
##########
@@ -111,6 +111,21 @@ run_suite(){
     esac
   fi
 
+  if [ "$FEATURE" = "stream_crud" ]; then
+    case "$svc" in
+      rust-bdd|java-bdd) ;;
+      *)
+        if [ "$SDK" = "all" ]; then
+          log "⚠️ skipping ${svc%-bdd} (does not support ${FEATURE})"
+          return 0
+        else
+          log "❌ ${SDK} does not support feature '${FEATURE}'"
+          return 1
+        fi
+        ;;

Review Comment:
   Extracted the unsupported-SDK handling into a shared function while 
preserving the existing support lists and skip/error behavior.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to