ryerraguntla commented on code in PR #3498:
URL: https://github.com/apache/iggy/pull/3498#discussion_r3440195240


##########
core/integration/tests/connectors/meilisearch/meilisearch_source.rs:
##########
@@ -0,0 +1,211 @@
+// 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::connectors::fixtures::{MeilisearchOps, MeilisearchSourceFixture};
+use iggy_common::MessageClient;
+use iggy_common::{Consumer, Identifier, PollingStrategy};
+use integration::harness::seeds;
+use integration::iggy_harness;
+use std::time::Duration;
+use tokio::time::sleep;
+
+const TEST_MESSAGE_COUNT: usize = 2;
+const POLL_ATTEMPTS: usize = 100;
+const POLL_INTERVAL_MS: u64 = 50;
+const SOURCE_INDEX: &str = "iggy_messages";
+
+#[iggy_harness(
+    server(connectors_runtime(config_path = 
"tests/connectors/meilisearch/source.toml")),
+    seed = seeds::connector_stream
+)]
+async fn meilisearch_source_produces_index_documents(
+    harness: &TestHarness,
+    fixture: MeilisearchSourceFixture,
+) {
+    let client = harness.root_client().await.unwrap();
+    let stream_id: Identifier = seeds::names::STREAM.try_into().unwrap();
+    let topic_id: Identifier = seeds::names::TOPIC.try_into().unwrap();
+    let consumer_id: Identifier = "test_consumer".try_into().unwrap();
+
+    let documents = vec![
+        serde_json::json!({"id": 1, "name": "first", "category": "alpha"}),
+        serde_json::json!({"id": 2, "name": "second", "category": "beta"}),
+    ];
+
+    fixture
+        .index_documents(SOURCE_INDEX, documents)
+        .await
+        .expect("index Meilisearch documents");
+    fixture
+        .wait_for_documents(TEST_MESSAGE_COUNT)
+        .await
+        .expect("wait for Meilisearch documents");
+
+    let received = poll_documents(
+        &client,
+        &stream_id,
+        &topic_id,
+        &consumer_id,
+        TEST_MESSAGE_COUNT,
+    )
+    .await;
+
+    assert_eq!(received.len(), TEST_MESSAGE_COUNT);
+    assert!(received.iter().any(|document| document["name"] == "first"));
+    assert!(received.iter().any(|document| document["name"] == "second"));
+
+    sleep(Duration::from_millis(POLL_INTERVAL_MS * 4)).await;
+    let duplicate_poll = client
+        .poll_messages(
+            &stream_id,
+            &topic_id,
+            None,
+            &Consumer::new(consumer_id),
+            &PollingStrategy::next(),
+            10,
+            true,
+        )
+        .await
+        .expect("poll Meilisearch source messages after cursor advance");
+    assert!(
+        duplicate_poll.messages.is_empty(),
+        "second poll should not receive duplicate Meilisearch documents"
+    );
+}
+
+#[iggy_harness(
+    server(connectors_runtime(config_path = 
"tests/connectors/meilisearch/source.toml")),
+    seed = seeds::connector_stream
+)]
+async fn meilisearch_source_state_persists_across_connector_restart(

Review Comment:
   integration test names violate given_X_when_Y_should_Z convention mandated 
by CLAUDE.md. meilisearch_source_produces_index_documents and 
     meilisearch_source_state_persists_across_connector_restart have no given_ 
prefix or should_ assertion clause.
     Fix: rename per convention.



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