You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by pi...@apache.org on 2025/07/21 13:41:45 UTC

(iggy) branch mcp updated (c56e9622 -> 0a65de7a)

This is an automated email from the ASF dual-hosted git repository.

piotr pushed a change to branch mcp
in repository https://gitbox.apache.org/repos/asf/iggy.git


    from c56e9622 add more mcp tests
     add a4e2b5b4 fix(server): improve updating topic for named ID (#2025)
     new 8c3e492c Merge branch 'master' into mcp
     new 0a65de7a add stream and topic mcp tests

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 core/integration/tests/mcp/mod.rs           | 83 +++++++++++++++++++++++++++--
 core/server/src/streaming/streams/topics.rs |  7 ++-
 core/server/src/streaming/systems/topics.rs |  4 +-
 3 files changed, 87 insertions(+), 7 deletions(-)


(iggy) 01/02: Merge branch 'master' into mcp

Posted by pi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

piotr pushed a commit to branch mcp
in repository https://gitbox.apache.org/repos/asf/iggy.git

commit 8c3e492cad7d8939e46b367b9c90c9d597d586ee
Merge: c56e9622 a4e2b5b4
Author: spetz <pi...@gmail.com>
AuthorDate: Mon Jul 21 15:41:03 2025 +0200

    Merge branch 'master' into mcp

 core/server/src/streaming/streams/topics.rs | 7 +++++--
 core/server/src/streaming/systems/topics.rs | 4 +++-
 2 files changed, 8 insertions(+), 3 deletions(-)


(iggy) 02/02: add stream and topic mcp tests

Posted by pi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

piotr pushed a commit to branch mcp
in repository https://gitbox.apache.org/repos/asf/iggy.git

commit 0a65de7a5d0af4b1b0a280e625e92667e20b172f
Author: spetz <pi...@gmail.com>
AuthorDate: Mon Jul 21 15:41:39 2025 +0200

    add stream and topic mcp tests
---
 core/integration/tests/mcp/mod.rs | 83 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 79 insertions(+), 4 deletions(-)

diff --git a/core/integration/tests/mcp/mod.rs b/core/integration/tests/mcp/mod.rs
index a0f4899e..84d395bb 100644
--- a/core/integration/tests/mcp/mod.rs
+++ b/core/integration/tests/mcp/mod.rs
@@ -87,7 +87,38 @@ async fn mcp_server_should_return_stream_details() {
 }
 
 #[tokio::test]
-async fn mcp_server_should_return_list_of_topcics() {
+async fn mcp_server_should_create_stream() {
+    let name = "new_stream";
+    assert_response::<StreamDetails>("create_stream", Some(json!({ "name": name})), |stream| {
+        assert_eq!(stream.name, name);
+        assert_eq!(stream.topics_count, 0);
+        assert_eq!(stream.messages_count, 0);
+    })
+    .await;
+}
+
+#[tokio::test]
+async fn mcp_server_should_update_stream() {
+    let name = "updated_stream";
+    assert_empty_response(
+        "update_stream",
+        Some(json!({"stream_id": STREAM_NAME, "name": name})),
+    )
+    .await;
+}
+
+#[tokio::test]
+async fn mcp_server_should_delete_stream() {
+    assert_empty_response("delete_stream", Some(json!({"stream_id": STREAM_NAME}))).await;
+}
+
+#[tokio::test]
+async fn mcp_server_should_purge_stream() {
+    assert_empty_response("purge_stream", Some(json!({"stream_id": STREAM_NAME}))).await;
+}
+
+#[tokio::test]
+async fn mcp_server_should_return_list_of_topics() {
     assert_response::<Vec<Topic>>(
         "get_topics",
         Some(json!({"stream_id": STREAM_NAME})),
@@ -116,6 +147,50 @@ async fn mcp_server_should_return_topic_details() {
     .await;
 }
 
+#[tokio::test]
+async fn mcp_server_should_create_topic() {
+    let name = "new_topic";
+    assert_response::<TopicDetails>(
+        "create_topic",
+        Some(json!({ "stream_id": STREAM_NAME, "name": name, "partitions_count": 1})),
+        |topic| {
+            assert_eq!(topic.id, 2);
+            assert_eq!(topic.name, name);
+            assert_eq!(topic.partitions_count, 1);
+            assert_eq!(topic.messages_count, 0);
+        },
+    )
+    .await;
+}
+
+#[tokio::test]
+async fn mcp_server_should_update_topic() {
+    let name = "updated_topic";
+    assert_empty_response(
+        "update_topic",
+        Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME, "name": name})),
+    )
+    .await;
+}
+
+#[tokio::test]
+async fn mcp_server_should_delete_topic() {
+    assert_empty_response(
+        "delete_topic",
+        Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME })),
+    )
+    .await;
+}
+
+#[tokio::test]
+async fn mcp_server_should_purge_topic() {
+    assert_empty_response(
+        "purge_topic",
+        Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME })),
+    )
+    .await;
+}
+
 async fn assert_empty_response(method: &str, data: Option<serde_json::Value>) {
     assert_response::<()>(method, data, |()| {}).await
 }
@@ -127,16 +202,16 @@ async fn assert_response<T: DeserializeOwned>(
 ) {
     let infra = setup().await;
     let client = infra.mcp_client;
-    let error_message = format!("Failed to invoke method: {method}",);
+    let error_message = format!("Failed to invoke MCP method: {method}",);
     let mut result = client.invoke(method, data).await.expect(&error_message);
 
     if result.content.is_empty() {
-        panic!("No content returned");
+        panic!("No content returned from MCP for method: {method}");
     }
 
     let result = result.content.remove(0);
     let Some(text) = result.as_text() else {
-        panic!("Expected text response");
+        panic!("Expected text response for MCP method: {method}");
     };
 
     let json = serde_json::from_str::<T>(&text.text).expect("Failed to parse JSON");