Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/e2e/async_delegation_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ TEST(E2E_PhaseA, AsyncDelegationWithWorkStealing) {
std::cout << "✓ All agents registered and configured" << std::endl;

// ACT: Send commands to different task agents
std::map<std::string, std::pair<TaskAgent*, int>> commands; // msg_id -> (agent, expected)
std::map<std::string, std::pair<TaskAgent*, int32_t>> commands; // msg_id -> (agent, expected)
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> dis(1, 50);
Expand Down Expand Up @@ -228,7 +228,7 @@ TEST(E2E_PhaseA, WorkStealingLoadBalancing) {
std::this_thread::sleep_for(std::chrono::milliseconds(300));

// Count how many agents received messages
int agents_with_messages = 0;
int32_t agents_with_messages = 0;
for (auto& agent : task_agents) {
int32_t count = 0;
while (agent->getMessage().has_value()) {
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/basic_delegation_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ TEST(E2E_Phase1, ChiefArchitectDelegatesToTaskAgent) {

int32_t num1 = dis(gen);
int32_t num2 = dis(gen);
int expected_result = num1 + num2;
int32_t expected_result = num1 + num2;

std::cout << "\nTest: Adding " << num1 << " + " << num2 << " = " << expected_result << std::endl;

Expand Down Expand Up @@ -112,7 +112,9 @@ TEST(E2E_Phase1, ChiefArchitectSendsMultipleCommands) {
task_agent->setMessageBus(bus.get());

// Test cases: (num1, num2, expected_result)
std::vector<std::tuple<int, int, int>> test_cases = {{5, 3, 8}, {15, 27, 42}, {100, 200, 300}};
std::vector<std::tuple<int32_t, int32_t, int32_t>> test_cases = {{5, 3, 8},
{15, 27, 42},
{100, 200, 300}};

// ACT & ASSERT: Send each command
for (const auto& [num1, num2, expected] : test_cases) {
Expand Down
20 changes: 10 additions & 10 deletions tests/e2e/chaos_engineering_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ TEST_F(Phase5ProbabilisticFailureTest, AgentsFailBasedOnInjectorRate) {
}

// Count failed agents
int failed_agents = 0;
int32_t failed_agents = 0;
for (auto& agent : agents) {
if (agent->isFailed()) {
failed_agents++;
Expand Down Expand Up @@ -471,7 +471,7 @@ TEST_F(Phase5NetworkPartitionTest, MessagesDroppedAcrossPartition) {
EXPECT_EQ(network.getPartitionDroppedMessages(), 0);

// Send message across partition (should be dropped)
int executed = 0;
int32_t executed = 0;
network.send(0, 2, [&executed]() { executed++; });

EXPECT_EQ(network.getPartitionDroppedMessages(), 1);
Expand Down Expand Up @@ -565,10 +565,10 @@ TEST_F(Phase5NetworkPartitionTest, SplitBrainWorkDistribution) {
SimulatedNetwork network(config);

// Simulate 4 nodes with work
std::atomic<int> node0_work{0};
std::atomic<int> node1_work{0};
std::atomic<int> node2_work{0};
std::atomic<int> node3_work{0};
std::atomic<int32_t> node0_work{0};
std::atomic<int32_t> node1_work{0};
std::atomic<int32_t> node2_work{0};
std::atomic<int32_t> node3_work{0};

// Create partition: [0, 1] vs [2, 3]
network.createPartition({0, 1}, {2, 3});
Expand Down Expand Up @@ -715,7 +715,7 @@ TEST_F(Phase5MessageLossTest, MessageLossWithSimulatedNetwork) {
SimulatedNetwork network(config);

// Send 100 messages
std::atomic<int> delivered{0};
std::atomic<int32_t> delivered{0};
for (int32_t i = 0; i < 100; ++i) {
network.send(0, 1, [&delivered]() { delivered++; });
}
Expand Down Expand Up @@ -821,8 +821,8 @@ TEST_F(Phase5MessageLossTest, MessageLossWithManualRetries) {
RetryPolicy policy(retry_config);

// Try sending 10 messages with retry logic
std::atomic<int> delivered{0};
std::atomic<int> total_attempts{0};
std::atomic<int32_t> delivered{0};
std::atomic<int32_t> total_attempts{0};

for (int32_t i = 0; i < 10; ++i) {
std::string msg_id = "msg" + std::to_string(i);
Expand Down Expand Up @@ -884,7 +884,7 @@ TEST_F(Phase5MessageLossTest, CombinedPartitionAndLoss) {
network.createPartition({0, 1}, {2, 3});

// Send messages in various scenarios
std::atomic<int> delivered{0};
std::atomic<int32_t> delivered{0};

// Within partition: should work (with some loss)
// Increased to 50 messages for statistical reliability
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/component_coordination_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ TEST(E2E_Phase3, ComponentLeadCoordinatesMultipleModules) {

// Create 6 TaskAgents (3 per module)
std::vector<std::shared_ptr<TaskAgent>> task_agents;
for (int i = 1; i <= 6; ++i) {
for (int32_t i = 1; i <= 6; ++i) {
auto agent = std::make_shared<TaskAgent>("task_" + std::to_string(i));
task_agents.push_back(agent);
}
Expand Down Expand Up @@ -130,7 +130,7 @@ TEST(E2E_Phase3, ComponentLeadCoordinatesMultipleModules) {
std::cout << "4. ModuleLeads → TaskAgents (6 total)..." << std::endl;

// All 6 TaskAgents process their tasks
int tasks_processed = 0;
int32_t tasks_processed = 0;
for (auto& agent : task_agents) {
auto task_msg = agent->getMessage();
if (task_msg.has_value()) {
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/distributed_grpc_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class YamlSpecBuilder {
return *this;
}

YamlSpecBuilder& setTargetLevel(int level) {
YamlSpecBuilder& setTargetLevel(int32_t level) {
spec_.routing.target_level = level;
return *this;
}
Expand Down Expand Up @@ -377,7 +377,7 @@ TEST_F(DistributedGrpcTest, HeartbeatMonitoring) {
EXPECT_EQ(alive_agents[0].agent_id, "agent-alive");

// Cleanup dead agents
int removed = registry_->cleanupDeadAgents();
int32_t removed = registry_->cleanupDeadAgents();
EXPECT_EQ(removed, 1);
EXPECT_EQ(registry_->getAgentCount(), 1);
}
Expand Down Expand Up @@ -922,7 +922,7 @@ TEST_F(DistributedGrpcTest, TaskCleanupOldTasks) {
std::this_thread::sleep_for(100ms);

// Cleanup tasks older than 50ms (should remove old tasks)
int cleaned = coordinator_->cleanupOldTasks(50);
int32_t cleaned = coordinator_->cleanupOldTasks(50);

// Note: This test depends on coordinator implementation
// If cleanup only removes completed/failed tasks, it should work
Expand Down
22 changes: 11 additions & 11 deletions tests/e2e/distributed_hierarchy_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ TEST_F(DistributedHierarchyTest, FourLayerHierarchyAcrossNodes) {
cluster.registerAgent("task_agent_3", 3);

// Counters for each layer
std::atomic<int> chief_executions{0};
std::atomic<int> component_executions{0};
std::atomic<int> module_executions{0};
std::atomic<int> task_executions{0};
std::atomic<int32_t> chief_executions{0};
std::atomic<int32_t> component_executions{0};
std::atomic<int32_t> module_executions{0};
std::atomic<int32_t> task_executions{0};

// Simulate hierarchical delegation using network send
// Chief sends to ComponentLead via network
Expand Down Expand Up @@ -120,7 +120,7 @@ TEST_F(DistributedHierarchyTest, MultipleCommandsDistributed) {
cluster.registerAgent("module_lead_2", 2);
cluster.registerAgent("task_agent", 3);

std::atomic<int> total_task_executions{0};
std::atomic<int32_t> total_task_executions{0};

// Send 10 commands through the hierarchy using network
for (int32_t cmd = 0; cmd < 10; ++cmd) {
Expand Down Expand Up @@ -167,7 +167,7 @@ TEST_F(DistributedHierarchyTest, LoadBalancingAcrossNodes) {
cluster.registerAgent("task_" + std::to_string(i), 3);
}

std::atomic<int> completed_tasks{0};
std::atomic<int32_t> completed_tasks{0};

// Submit concentrated workload to node 3
for (int32_t i = 0; i < 100; ++i) {
Expand Down Expand Up @@ -219,7 +219,7 @@ TEST_F(DistributedHierarchyTest, NetworkLatencyImpact) {
low_latency_cluster.registerAgent("sender", 0);
low_latency_cluster.registerAgent("receiver", 1);

std::atomic<int> low_latency_count{0};
std::atomic<int32_t> low_latency_count{0};

auto start_low = std::chrono::steady_clock::now();

Expand Down Expand Up @@ -252,7 +252,7 @@ TEST_F(DistributedHierarchyTest, NetworkLatencyImpact) {
high_latency_cluster.registerAgent("sender", 0);
high_latency_cluster.registerAgent("receiver", 1);

std::atomic<int> high_latency_count{0};
std::atomic<int32_t> high_latency_count{0};

auto start_high = std::chrono::steady_clock::now();

Expand Down Expand Up @@ -297,9 +297,9 @@ TEST_F(DistributedHierarchyTest, AgentMigrationBetweenNodes) {
// Initially on node 0
cluster.registerAgent("mobile_agent", 0);

std::atomic<int> executions_node0{0};
std::atomic<int> executions_node1{0};
std::atomic<int> executions_node2{0};
std::atomic<int32_t> executions_node0{0};
std::atomic<int32_t> executions_node1{0};
std::atomic<int32_t> executions_node2{0};

// Execute on node 0
for (int32_t i = 0; i < 10; ++i) {
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/full_async_hierarchy_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ TEST(E2E_PhaseB, FullAsync4LayerHierarchy) {

// Level 3: Task Agents (6 total: 3 per module)
std::vector<std::shared_ptr<TaskAgent>> task_agents;
for (int i = 1; i <= 6; ++i) {
for (int32_t i = 1; i <= 6; ++i) {
auto task = std::make_shared<TaskAgent>("task" + std::to_string(i));
task->setMessageBus(&bus);
task->setScheduler(&scheduler);
Expand Down Expand Up @@ -103,7 +103,7 @@ TEST(E2E_PhaseB, FullAsync4LayerHierarchy) {
EXPECT_GE(mod2_trace.size(), 4);

// Verify all task agents executed their commands
int total_commands = 0;
int32_t total_commands = 0;
for (const auto& task : task_agents) {
total_commands += task->getCommandHistory().size();
}
Expand Down Expand Up @@ -158,7 +158,7 @@ TEST(E2E_PhaseB, Async4LayerConcurrentExecution) {

// Create slow task agents (sleep 0.05s per task)
std::vector<std::shared_ptr<TaskAgent>> task_agents;
for (int i = 1; i <= 6; ++i) {
for (int32_t i = 1; i <= 6; ++i) {
auto task = std::make_shared<TaskAgent>("task" + std::to_string(i));
task->setMessageBus(&bus);
task->setScheduler(&scheduler);
Expand Down Expand Up @@ -189,7 +189,7 @@ TEST(E2E_PhaseB, Async4LayerConcurrentExecution) {
EXPECT_LT(elapsed, 600); // Should complete well under sequential time

// Verify all tasks completed
int total_commands = 0;
int32_t total_commands = 0;
for (const auto& task : task_agents) {
total_commands += task->getCommandHistory().size();
}
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/module_coordination_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ TEST(E2E_Phase2, ModuleLeadSynthesizesTaskResults) {

// Create 3 TaskAgents for parallel execution
std::vector<std::shared_ptr<TaskAgent>> task_agents;
for (int i = 1; i <= 3; ++i) {
for (int32_t i = 1; i <= 3; ++i) {
auto agent = std::make_shared<TaskAgent>("task_" + std::to_string(i));
task_agents.push_back(agent);
}
Expand Down Expand Up @@ -102,7 +102,7 @@ TEST(E2E_Phase2, ModuleLeadSynthesizesTaskResults) {
std::cout << "3. ModuleLead delegates to 3 TaskAgents..." << std::endl;

// Each TaskAgent processes their assigned task
int tasks_processed = 0;
int32_t tasks_processed = 0;
for (auto& agent : task_agents) {
auto task_msg = agent->getMessage();
if (task_msg.has_value()) {
Expand All @@ -118,7 +118,7 @@ TEST(E2E_Phase2, ModuleLeadSynthesizesTaskResults) {
// ModuleLead receives results from all TaskAgents
std::cout << "4. ModuleLead receives results from TaskAgents..." << std::endl;

int results_received = 0;
int32_t results_received = 0;
for (int32_t i = 0; i < 3; ++i) {
auto result_msg = module_lead->getMessage();
if (result_msg.has_value()) {
Expand Down Expand Up @@ -189,7 +189,7 @@ TEST(E2E_Phase2, ModuleLeadHandlesVariableTaskCount) {
auto module_lead = std::make_shared<ModuleLeadAgent>("module_math");

std::vector<std::shared_ptr<TaskAgent>> task_agents;
for (int i = 1; i <= 3; ++i) {
for (int32_t i = 1; i <= 3; ++i) {
auto agent = std::make_shared<TaskAgent>("task_" + std::to_string(i));
task_agents.push_back(agent);
}
Expand Down Expand Up @@ -224,7 +224,7 @@ TEST(E2E_Phase2, ModuleLeadHandlesVariableTaskCount) {
module_lead->processMessage(*module_msg).get();

// Process tasks (should be 2)
int tasks_processed = 0;
int32_t tasks_processed = 0;
for (auto& agent : task_agents) {
auto task_msg = agent->getMessage();
if (task_msg.has_value()) {
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/grpc_test_fixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ class GrpcTestFixture : public ::testing::Test {
std::unique_ptr<keystone::network::GrpcServer> registry_server_;

// Server ports (ephemeral, assigned by OS)
int coordinator_port_ = 0;
int registry_port_ = 0;
int32_t coordinator_port_ = 0;
int32_t registry_port_ = 0;
};

} // namespace test
Expand Down
16 changes: 8 additions & 8 deletions tests/integration/test_nats_integration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ TEST_F(NatsIntegrationTest, PipelineShutdownDrainsCleanly) {
bus_->registerAgent(agent->getAgentId(), agent);

// Queue several work messages before the shutdown signal.
constexpr int kWorkMessages = 5;
for (int i = 0; i < kWorkMessages; ++i) {
constexpr int32_t kWorkMessages = 5;
for (int32_t i = 0; i < kWorkMessages; ++i) {
auto work = KeystoneMessage::create("bridge",
"drain_agent",
ActionType::EXECUTE,
Expand All @@ -207,7 +207,7 @@ TEST_F(NatsIntegrationTest, PipelineShutdownDrainsCleanly) {
EXPECT_TRUE(bus_->routeMessage(shutdown_msg));

// Drain: consume all kWorkMessages + 1 shutdown.
int drained = 0;
int32_t drained = 0;
bool saw_shutdown = false;
bool drained_all = waitFor(
[&]() {
Expand Down Expand Up @@ -254,7 +254,7 @@ TEST_F(NatsIntegrationTest, PipelinePriorityMessagesDeliveredInOrder) {
bool got_first = waitFor([&]() { return agent->getMessage().has_value(); });
ASSERT_TRUE(got_first) << "No messages delivered to priority_agent";

int delivered = 1;
int32_t delivered = 1;
while (agent->getMessage().has_value()) {
++delivered;
}
Expand Down Expand Up @@ -346,7 +346,7 @@ TEST_F(NatsServerTest, NatsConnectionSucceeds) {

// Use nc (netcat) to test TCP connectivity; fall back to bash /dev/tcp.
std::string check_cmd = "bash -c 'echo > /dev/tcp/" + host + "/" + port + "' 2>/dev/null";
int rc = std::system(check_cmd.c_str()); // NOLINT(cert-env33-c)
int32_t rc = std::system(check_cmd.c_str()); // NOLINT(cert-env33-c)
EXPECT_EQ(rc, 0) << "Could not connect to NATS server at " << url
<< ". Is the server running? (docker-compose -f docker-compose.test.yml up)";
}
Expand Down Expand Up @@ -411,8 +411,8 @@ TEST_F(NatsServerTest, NatsShutdownDrainsSubscription) {
agent->setMessageBus(bus_.get());
bus_->registerAgent(agent->getAgentId(), agent);

constexpr int kPending = 3;
for (int i = 0; i < kPending; ++i) {
constexpr int32_t kPending = 3;
for (int32_t i = 0; i < kPending; ++i) {
auto work = KeystoneMessage::create("nats.bridge:hi.tasks.execute",
"hi.myrmidon.tasks.0",
ActionType::EXECUTE,
Expand All @@ -428,7 +428,7 @@ TEST_F(NatsServerTest, NatsShutdownDrainsSubscription) {
"drain-session");
EXPECT_TRUE(bus_->routeMessage(shutdown));

int count = 0;
int32_t count = 0;
bool saw_shutdown = false;
bool ok = waitFor(
[&]() {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_registry_integration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ TEST_F(RegistryIntegrationTest, ThreadSafeRegistryOperations) {
std::vector<std::thread> threads;

// 5 threads: register 20 agents each (100 total)
std::atomic<int> registered{0};
std::atomic<int32_t> registered{0};
for (int32_t t = 0; t < 5; ++t) {
threads.emplace_back([this, t, &all_agents, &registered]() {
for (int32_t i = 0; i < 20; ++i) {
Expand Down
Loading
Loading