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": {
|
"servers": {
|
||||||
"command": "python",
|
"mock_server": {
|
||||||
"args": ["tests/fixtures/mock_mcp_server.py"],
|
"command": "python",
|
||||||
"enabled": true
|
"args": ["tests/fixtures/mock_mcp_server.py"],
|
||||||
},
|
"enabled": true
|
||||||
"disabled_server": {
|
},
|
||||||
"command": "nonexistent_command",
|
"disabled_server": {
|
||||||
"args": [],
|
"command": "nonexistent_command",
|
||||||
"enabled": false
|
"args": [],
|
||||||
},
|
"enabled": false
|
||||||
"echo_server": {
|
},
|
||||||
"command": "python",
|
"echo_server": {
|
||||||
"args": ["tests/fixtures/echo_server.py"],
|
"command": "python",
|
||||||
"enabled": true
|
"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]") {
|
TEST_CASE("TI_CLIENT_001_LoadConfigValid", "[mcp][client]") {
|
||||||
json config = {
|
json config = {
|
||||||
{"test_server", {
|
{"servers", {
|
||||||
{"command", "python"},
|
{"test_server", {
|
||||||
{"args", json::array({"server.py"})},
|
{"command", "python"},
|
||||||
{"enabled", true}
|
{"args", json::array({"server.py"})},
|
||||||
|
{"enabled", true}
|
||||||
|
}}
|
||||||
}}
|
}}
|
||||||
};
|
};
|
||||||
auto path = createTestConfigFile(config);
|
auto path = createTestConfigFile(config);
|
||||||
@ -108,14 +110,16 @@ TEST_CASE("TI_CLIENT_004_ConnectAllStartsServers", "[mcp][client]") {
|
|||||||
|
|
||||||
TEST_CASE("TI_CLIENT_005_ConnectAllSkipsDisabled", "[mcp][client]") {
|
TEST_CASE("TI_CLIENT_005_ConnectAllSkipsDisabled", "[mcp][client]") {
|
||||||
json config = {
|
json config = {
|
||||||
{"enabled_server", {
|
{"servers", {
|
||||||
{"command", "python"},
|
{"enabled_server", {
|
||||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
{"command", "python"},
|
||||||
{"enabled", true}
|
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||||
}},
|
{"enabled", true}
|
||||||
{"disabled_server", {
|
}},
|
||||||
{"command", "nonexistent"},
|
{"disabled_server", {
|
||||||
{"enabled", false}
|
{"command", "nonexistent"},
|
||||||
|
{"enabled", false}
|
||||||
|
}}
|
||||||
}}
|
}}
|
||||||
};
|
};
|
||||||
auto path = createTestConfigFile(config);
|
auto path = createTestConfigFile(config);
|
||||||
@ -137,15 +141,17 @@ TEST_CASE("TI_CLIENT_005_ConnectAllSkipsDisabled", "[mcp][client]") {
|
|||||||
|
|
||||||
TEST_CASE("TI_CLIENT_006_ConnectSingleServer", "[mcp][client]") {
|
TEST_CASE("TI_CLIENT_006_ConnectSingleServer", "[mcp][client]") {
|
||||||
json config = {
|
json config = {
|
||||||
{"server1", {
|
{"servers", {
|
||||||
{"command", "python"},
|
{"server1", {
|
||||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
{"command", "python"},
|
||||||
{"enabled", true}
|
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||||
}},
|
{"enabled", true}
|
||||||
{"server2", {
|
}},
|
||||||
{"command", "python"},
|
{"server2", {
|
||||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
{"command", "python"},
|
||||||
{"enabled", true}
|
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||||
|
{"enabled", true}
|
||||||
|
}}
|
||||||
}}
|
}}
|
||||||
};
|
};
|
||||||
auto path = createTestConfigFile(config);
|
auto path = createTestConfigFile(config);
|
||||||
@ -170,10 +176,12 @@ TEST_CASE("TI_CLIENT_006_ConnectSingleServer", "[mcp][client]") {
|
|||||||
|
|
||||||
TEST_CASE("TI_CLIENT_007_DisconnectSingleServer", "[mcp][client]") {
|
TEST_CASE("TI_CLIENT_007_DisconnectSingleServer", "[mcp][client]") {
|
||||||
json config = {
|
json config = {
|
||||||
{"server1", {
|
{"servers", {
|
||||||
{"command", "python"},
|
{"server1", {
|
||||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
{"command", "python"},
|
||||||
{"enabled", true}
|
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||||
|
{"enabled", true}
|
||||||
|
}}
|
||||||
}}
|
}}
|
||||||
};
|
};
|
||||||
auto path = createTestConfigFile(config);
|
auto path = createTestConfigFile(config);
|
||||||
@ -195,15 +203,17 @@ TEST_CASE("TI_CLIENT_007_DisconnectSingleServer", "[mcp][client]") {
|
|||||||
|
|
||||||
TEST_CASE("TI_CLIENT_008_DisconnectAllCleansUp", "[mcp][client]") {
|
TEST_CASE("TI_CLIENT_008_DisconnectAllCleansUp", "[mcp][client]") {
|
||||||
json config = {
|
json config = {
|
||||||
{"server1", {
|
{"servers", {
|
||||||
{"command", "python"},
|
{"server1", {
|
||||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
{"command", "python"},
|
||||||
{"enabled", true}
|
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||||
}},
|
{"enabled", true}
|
||||||
{"server2", {
|
}},
|
||||||
{"command", "python"},
|
{"server2", {
|
||||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
{"command", "python"},
|
||||||
{"enabled", true}
|
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||||
|
{"enabled", true}
|
||||||
|
}}
|
||||||
}}
|
}}
|
||||||
};
|
};
|
||||||
auto path = createTestConfigFile(config);
|
auto path = createTestConfigFile(config);
|
||||||
@ -354,10 +364,12 @@ TEST_CASE("TI_CLIENT_014_ToolCountAccurate", "[mcp][client]") {
|
|||||||
|
|
||||||
TEST_CASE("TI_CLIENT_015_IsConnectedAccurate", "[mcp][client]") {
|
TEST_CASE("TI_CLIENT_015_IsConnectedAccurate", "[mcp][client]") {
|
||||||
json config = {
|
json config = {
|
||||||
{"test_server", {
|
{"servers", {
|
||||||
{"command", "python"},
|
{"test_server", {
|
||||||
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
{"command", "python"},
|
||||||
{"enabled", true}
|
{"args", json::array({"tests/fixtures/echo_server.py"})},
|
||||||
|
{"enabled", true}
|
||||||
|
}}
|
||||||
}}
|
}}
|
||||||
};
|
};
|
||||||
auto path = createTestConfigFile(config);
|
auto path = createTestConfigFile(config);
|
||||||
|
|||||||
@ -31,12 +31,12 @@ public:
|
|||||||
};
|
};
|
||||||
fullConfig.merge_patch(config);
|
fullConfig.merge_patch(config);
|
||||||
|
|
||||||
grove::JsonDataNode configNode(fullConfig);
|
grove::JsonDataNode configNode("config", fullConfig);
|
||||||
module.setConfiguration(configNode, &io, nullptr);
|
module.setConfiguration(configNode, &io, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void process() {
|
void process() {
|
||||||
grove::JsonDataNode input(time.createInput());
|
grove::JsonDataNode input("input", time.createInput());
|
||||||
module.process(input);
|
module.process(input);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -259,8 +259,8 @@ TEST_CASE("TI_AI_010_StateSerialization", "[ai][integration]") {
|
|||||||
|
|
||||||
// Restore
|
// Restore
|
||||||
AIModule module2;
|
AIModule module2;
|
||||||
grove::JsonDataNode configNode(json::object());
|
grove::JsonDataNode configNode2("config", json::object());
|
||||||
module2.setConfiguration(configNode, &f.io, nullptr);
|
module2.setConfiguration(configNode2, &f.io, nullptr);
|
||||||
module2.setState(*state);
|
module2.setState(*state);
|
||||||
|
|
||||||
auto state2 = module2.getState();
|
auto state2 = module2.getState();
|
||||||
|
|||||||
@ -32,12 +32,12 @@ public:
|
|||||||
};
|
};
|
||||||
fullConfig.merge_patch(config);
|
fullConfig.merge_patch(config);
|
||||||
|
|
||||||
grove::JsonDataNode configNode(fullConfig);
|
grove::JsonDataNode configNode("config", fullConfig);
|
||||||
module.setConfiguration(configNode, &io, nullptr);
|
module.setConfiguration(configNode, &io, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void process() {
|
void process() {
|
||||||
grove::JsonDataNode input(time.createInput());
|
grove::JsonDataNode input("input", time.createInput());
|
||||||
module.process(input);
|
module.process(input);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -275,8 +275,8 @@ TEST_CASE("TI_MONITOR_010_StateSerialization", "[monitoring][integration]") {
|
|||||||
|
|
||||||
// Restore to new module
|
// Restore to new module
|
||||||
MonitoringModule module2;
|
MonitoringModule module2;
|
||||||
grove::JsonDataNode configNode(json::object());
|
grove::JsonDataNode configNode2("config", json::object());
|
||||||
module2.setConfiguration(configNode, &f.io, nullptr);
|
module2.setConfiguration(configNode2, &f.io, nullptr);
|
||||||
module2.setState(*state);
|
module2.setState(*state);
|
||||||
|
|
||||||
auto state2 = module2.getState();
|
auto state2 = module2.getState();
|
||||||
|
|||||||
@ -28,12 +28,12 @@ public:
|
|||||||
json fullConfig = json::object();
|
json fullConfig = json::object();
|
||||||
fullConfig.merge_patch(config);
|
fullConfig.merge_patch(config);
|
||||||
|
|
||||||
grove::JsonDataNode configNode(fullConfig);
|
grove::JsonDataNode configNode("config", fullConfig);
|
||||||
module.setConfiguration(configNode, &io, nullptr);
|
module.setConfiguration(configNode, &io, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void process() {
|
void process() {
|
||||||
grove::JsonDataNode input(time.createInput());
|
grove::JsonDataNode input("input", time.createInput());
|
||||||
module.process(input);
|
module.process(input);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -283,8 +283,8 @@ TEST_CASE("TI_STORAGE_010_StateSerialization", "[storage][integration]") {
|
|||||||
|
|
||||||
// Restore
|
// Restore
|
||||||
StorageModule module2;
|
StorageModule module2;
|
||||||
grove::JsonDataNode configNode(json::object());
|
grove::JsonDataNode configNode2("config", json::object());
|
||||||
module2.setConfiguration(configNode, &f.io, nullptr);
|
module2.setConfiguration(configNode2, &f.io, nullptr);
|
||||||
module2.setState(*state);
|
module2.setState(*state);
|
||||||
|
|
||||||
auto state2 = module2.getState();
|
auto state2 = module2.getState();
|
||||||
|
|||||||
@ -32,12 +32,12 @@ public:
|
|||||||
};
|
};
|
||||||
fullConfig.merge_patch(config);
|
fullConfig.merge_patch(config);
|
||||||
|
|
||||||
grove::JsonDataNode configNode(fullConfig);
|
grove::JsonDataNode configNode("config", fullConfig);
|
||||||
module.setConfiguration(configNode, &io, nullptr);
|
module.setConfiguration(configNode, &io, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void process() {
|
void process() {
|
||||||
grove::JsonDataNode input(time.createInput());
|
grove::JsonDataNode input("input", time.createInput());
|
||||||
module.process(input);
|
module.process(input);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -248,8 +248,8 @@ TEST_CASE("TI_VOICE_010_StateSerialization", "[voice][integration]") {
|
|||||||
|
|
||||||
// Restore
|
// Restore
|
||||||
VoiceModule module2;
|
VoiceModule module2;
|
||||||
grove::JsonDataNode configNode(json::object());
|
grove::JsonDataNode configNode2("config", json::object());
|
||||||
module2.setConfiguration(configNode, &f.io, nullptr);
|
module2.setConfiguration(configNode2, &f.io, nullptr);
|
||||||
module2.setState(*state);
|
module2.setState(*state);
|
||||||
|
|
||||||
auto state2 = module2.getState();
|
auto state2 = module2.getState();
|
||||||
|
|||||||
@ -38,7 +38,7 @@ public:
|
|||||||
* @brief Create input as IDataNode
|
* @brief Create input as IDataNode
|
||||||
*/
|
*/
|
||||||
std::unique_ptr<grove::JsonDataNode> createInputNode(float deltaTime = 0.1f) {
|
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