fix: Fix test fixtures JsonDataNode constructor calls
- Add 'servers' key to mock_mcp.json (MCPClient expects this structure)
- Add 'servers' wrapper to MCPClientTests.cpp test configs
- Fix JsonDataNode constructor calls in test fixtures:
- JsonDataNode(json) -> JsonDataNode("name", json)
- Affected: AIModuleTests, MonitoringModuleTests, StorageModuleTests,
VoiceModuleTests, TimeSimulator
Test results:
- Module tests: 52/60 passing (87%)
- MCP Types tests: 15/15 passing (100%)
- MCP Transport/Client: Require Python server integration fixes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
83d901aaab
commit
64d485729b
30
tests/fixtures/mock_mcp.json
vendored
30
tests/fixtures/mock_mcp.json
vendored
@ -1,17 +1,19 @@
|
||||
{
|
||||
"mock_server": {
|
||||
"command": "python",
|
||||
"args": ["tests/fixtures/mock_mcp_server.py"],
|
||||
"enabled": true
|
||||
},
|
||||
"disabled_server": {
|
||||
"command": "nonexistent_command",
|
||||
"args": [],
|
||||
"enabled": false
|
||||
},
|
||||
"echo_server": {
|
||||
"command": "python",
|
||||
"args": ["tests/fixtures/echo_server.py"],
|
||||
"enabled": true
|
||||
"servers": {
|
||||
"mock_server": {
|
||||
"command": "python",
|
||||
"args": ["tests/fixtures/mock_mcp_server.py"],
|
||||
"enabled": true
|
||||
},
|
||||
"disabled_server": {
|
||||
"command": "nonexistent_command",
|
||||
"args": [],
|
||||
"enabled": false
|
||||
},
|
||||
"echo_server": {
|
||||
"command": "python",
|
||||
"args": ["tests/fixtures/echo_server.py"],
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,10 +36,12 @@ void cleanupTestConfigFile(const std::string& path) {
|
||||
|
||||
TEST_CASE("TI_CLIENT_001_LoadConfigValid", "[mcp][client]") {
|
||||
json config = {
|
||||
{"test_server", {
|
||||
{"command", "python"},
|
||||
{"args", json::array({"server.py"})},
|
||||
{"enabled", true}
|
||||
{"servers", {
|
||||
{"test_server", {
|
||||
{"command", "python"},
|
||||
{"args", json::array({"server.py"})},
|
||||
{"enabled", true}
|
||||
}}
|
||||
}}
|
||||
};
|
||||
auto path = createTestConfigFile(config);
|
||||
@ -108,14 +110,16 @@ TEST_CASE("TI_CLIENT_004_ConnectAllStartsServers", "[mcp][client]") {
|
||||
|
||||
TEST_CASE("TI_CLIENT_005_ConnectAllSkipsDisabled", "[mcp][client]") {
|
||||
json config = {
|
||||
{"enabled_server", {
|
||||
{"command", "python"},
|
||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||
{"enabled", true}
|
||||
}},
|
||||
{"disabled_server", {
|
||||
{"command", "nonexistent"},
|
||||
{"enabled", false}
|
||||
{"servers", {
|
||||
{"enabled_server", {
|
||||
{"command", "python"},
|
||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||
{"enabled", true}
|
||||
}},
|
||||
{"disabled_server", {
|
||||
{"command", "nonexistent"},
|
||||
{"enabled", false}
|
||||
}}
|
||||
}}
|
||||
};
|
||||
auto path = createTestConfigFile(config);
|
||||
@ -137,15 +141,17 @@ TEST_CASE("TI_CLIENT_005_ConnectAllSkipsDisabled", "[mcp][client]") {
|
||||
|
||||
TEST_CASE("TI_CLIENT_006_ConnectSingleServer", "[mcp][client]") {
|
||||
json config = {
|
||||
{"server1", {
|
||||
{"command", "python"},
|
||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||
{"enabled", true}
|
||||
}},
|
||||
{"server2", {
|
||||
{"command", "python"},
|
||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||
{"enabled", true}
|
||||
{"servers", {
|
||||
{"server1", {
|
||||
{"command", "python"},
|
||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||
{"enabled", true}
|
||||
}},
|
||||
{"server2", {
|
||||
{"command", "python"},
|
||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||
{"enabled", true}
|
||||
}}
|
||||
}}
|
||||
};
|
||||
auto path = createTestConfigFile(config);
|
||||
@ -170,10 +176,12 @@ TEST_CASE("TI_CLIENT_006_ConnectSingleServer", "[mcp][client]") {
|
||||
|
||||
TEST_CASE("TI_CLIENT_007_DisconnectSingleServer", "[mcp][client]") {
|
||||
json config = {
|
||||
{"server1", {
|
||||
{"command", "python"},
|
||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||
{"enabled", true}
|
||||
{"servers", {
|
||||
{"server1", {
|
||||
{"command", "python"},
|
||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||
{"enabled", true}
|
||||
}}
|
||||
}}
|
||||
};
|
||||
auto path = createTestConfigFile(config);
|
||||
@ -195,15 +203,17 @@ TEST_CASE("TI_CLIENT_007_DisconnectSingleServer", "[mcp][client]") {
|
||||
|
||||
TEST_CASE("TI_CLIENT_008_DisconnectAllCleansUp", "[mcp][client]") {
|
||||
json config = {
|
||||
{"server1", {
|
||||
{"command", "python"},
|
||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||
{"enabled", true}
|
||||
}},
|
||||
{"server2", {
|
||||
{"command", "python"},
|
||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||
{"enabled", true}
|
||||
{"servers", {
|
||||
{"server1", {
|
||||
{"command", "python"},
|
||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||
{"enabled", true}
|
||||
}},
|
||||
{"server2", {
|
||||
{"command", "python"},
|
||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||
{"enabled", true}
|
||||
}}
|
||||
}}
|
||||
};
|
||||
auto path = createTestConfigFile(config);
|
||||
@ -354,10 +364,12 @@ TEST_CASE("TI_CLIENT_014_ToolCountAccurate", "[mcp][client]") {
|
||||
|
||||
TEST_CASE("TI_CLIENT_015_IsConnectedAccurate", "[mcp][client]") {
|
||||
json config = {
|
||||
{"test_server", {
|
||||
{"command", "python"},
|
||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||
{"enabled", true}
|
||||
{"servers", {
|
||||
{"test_server", {
|
||||
{"command", "python"},
|
||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||
{"enabled", true}
|
||||
}}
|
||||
}}
|
||||
};
|
||||
auto path = createTestConfigFile(config);
|
||||
|
||||
@ -31,12 +31,12 @@ public:
|
||||
};
|
||||
fullConfig.merge_patch(config);
|
||||
|
||||
grove::JsonDataNode configNode(fullConfig);
|
||||
grove::JsonDataNode configNode("config", fullConfig);
|
||||
module.setConfiguration(configNode, &io, nullptr);
|
||||
}
|
||||
|
||||
void process() {
|
||||
grove::JsonDataNode input(time.createInput());
|
||||
grove::JsonDataNode input("input", time.createInput());
|
||||
module.process(input);
|
||||
}
|
||||
};
|
||||
@ -259,8 +259,8 @@ TEST_CASE("TI_AI_010_StateSerialization", "[ai][integration]") {
|
||||
|
||||
// Restore
|
||||
AIModule module2;
|
||||
grove::JsonDataNode configNode(json::object());
|
||||
module2.setConfiguration(configNode, &f.io, nullptr);
|
||||
grove::JsonDataNode configNode2("config", json::object());
|
||||
module2.setConfiguration(configNode2, &f.io, nullptr);
|
||||
module2.setState(*state);
|
||||
|
||||
auto state2 = module2.getState();
|
||||
|
||||
@ -32,12 +32,12 @@ public:
|
||||
};
|
||||
fullConfig.merge_patch(config);
|
||||
|
||||
grove::JsonDataNode configNode(fullConfig);
|
||||
grove::JsonDataNode configNode("config", fullConfig);
|
||||
module.setConfiguration(configNode, &io, nullptr);
|
||||
}
|
||||
|
||||
void process() {
|
||||
grove::JsonDataNode input(time.createInput());
|
||||
grove::JsonDataNode input("input", time.createInput());
|
||||
module.process(input);
|
||||
}
|
||||
};
|
||||
@ -275,8 +275,8 @@ TEST_CASE("TI_MONITOR_010_StateSerialization", "[monitoring][integration]") {
|
||||
|
||||
// Restore to new module
|
||||
MonitoringModule module2;
|
||||
grove::JsonDataNode configNode(json::object());
|
||||
module2.setConfiguration(configNode, &f.io, nullptr);
|
||||
grove::JsonDataNode configNode2("config", json::object());
|
||||
module2.setConfiguration(configNode2, &f.io, nullptr);
|
||||
module2.setState(*state);
|
||||
|
||||
auto state2 = module2.getState();
|
||||
|
||||
@ -28,12 +28,12 @@ public:
|
||||
json fullConfig = json::object();
|
||||
fullConfig.merge_patch(config);
|
||||
|
||||
grove::JsonDataNode configNode(fullConfig);
|
||||
grove::JsonDataNode configNode("config", fullConfig);
|
||||
module.setConfiguration(configNode, &io, nullptr);
|
||||
}
|
||||
|
||||
void process() {
|
||||
grove::JsonDataNode input(time.createInput());
|
||||
grove::JsonDataNode input("input", time.createInput());
|
||||
module.process(input);
|
||||
}
|
||||
};
|
||||
@ -283,8 +283,8 @@ TEST_CASE("TI_STORAGE_010_StateSerialization", "[storage][integration]") {
|
||||
|
||||
// Restore
|
||||
StorageModule module2;
|
||||
grove::JsonDataNode configNode(json::object());
|
||||
module2.setConfiguration(configNode, &f.io, nullptr);
|
||||
grove::JsonDataNode configNode2("config", json::object());
|
||||
module2.setConfiguration(configNode2, &f.io, nullptr);
|
||||
module2.setState(*state);
|
||||
|
||||
auto state2 = module2.getState();
|
||||
|
||||
@ -32,12 +32,12 @@ public:
|
||||
};
|
||||
fullConfig.merge_patch(config);
|
||||
|
||||
grove::JsonDataNode configNode(fullConfig);
|
||||
grove::JsonDataNode configNode("config", fullConfig);
|
||||
module.setConfiguration(configNode, &io, nullptr);
|
||||
}
|
||||
|
||||
void process() {
|
||||
grove::JsonDataNode input(time.createInput());
|
||||
grove::JsonDataNode input("input", time.createInput());
|
||||
module.process(input);
|
||||
}
|
||||
};
|
||||
@ -248,8 +248,8 @@ TEST_CASE("TI_VOICE_010_StateSerialization", "[voice][integration]") {
|
||||
|
||||
// Restore
|
||||
VoiceModule module2;
|
||||
grove::JsonDataNode configNode(json::object());
|
||||
module2.setConfiguration(configNode, &f.io, nullptr);
|
||||
grove::JsonDataNode configNode2("config", json::object());
|
||||
module2.setConfiguration(configNode2, &f.io, nullptr);
|
||||
module2.setState(*state);
|
||||
|
||||
auto state2 = module2.getState();
|
||||
|
||||
@ -38,7 +38,7 @@ public:
|
||||
* @brief Create input as IDataNode
|
||||
*/
|
||||
std::unique_ptr<grove::JsonDataNode> createInputNode(float deltaTime = 0.1f) {
|
||||
return std::make_unique<grove::JsonDataNode>(createInput(deltaTime));
|
||||
return std::make_unique<grove::JsonDataNode>("input", createInput(deltaTime));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user