numinnex commented on code in PR #1842:
URL: https://github.com/apache/iggy/pull/1842#discussion_r2133787786


##########
core/bdd/tests/steps/streams.rs:
##########
@@ -0,0 +1,72 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use crate::common::world::IggyWorld;
+use cucumber::{given, then, when};
+use iggy::prelude::StreamClient;
+
+#[given("I have no streams in the system")]
+pub async fn given_no_streams(world: &mut IggyWorld) {
+    let client = world.client.as_ref().expect("Client should be available");
+    let streams = client
+        .get_streams()
+        .await
+        .expect("Should be able to get streams");
+    assert!(
+        streams.is_empty(),
+        "System should have no streams initially"
+    );
+}
+
+#[when(regex = r"^I create a stream with ID (\d+) and name (.+)$")]
+pub async fn when_create_stream(world: &mut IggyWorld, stream_id: u32, 
stream_name: String) {
+    let client = world.client.as_ref().expect("Client should be available");
+    let stream = client
+        .create_stream(&stream_name, Some(stream_id))
+        .await
+        .expect("Should be able to create stream");
+
+    world.last_stream_id = Some(stream.id);
+    world.last_stream_name = Some(stream.name.clone());
+}
+
+#[then("the stream should be created successfully")]
+pub async fn then_stream_created_successfully(world: &mut IggyWorld) {

Review Comment:
   maybe we can use the client, to get that stream and compare it to the 
created stream ? and merge with the step from below



##########
core/bdd/tests/common/world.rs:
##########
@@ -0,0 +1,41 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use cucumber::World;
+use iggy::clients::client::IggyClient;
+use iggy::prelude::PolledMessages;
+use integration::test_server::TestServer;
+
+#[derive(Debug, World, Default)]
+pub struct IggyWorld {
+    pub server: Option<TestServer>,
+    pub client: Option<IggyClient>,
+    pub server_addr: Option<String>,
+    pub last_stream_id: Option<u32>,

Review Comment:
   Add last_send_message and assert in the `poll` step whether 
`last_polled_message` == `last_send_message`



-- 
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