Skip to content

[TEST] Fix disabled tests - Result<T> API migration (ARC-001 Phase 1) #320

Description

@kcenon

Summary

Fix 4 disabled test files that require Result API updates to restore test coverage. This is Phase 1 of ARC-001 (Low Test Coverage) resolution.

Related Architecture Issue

  • ARC-001: Low Test Coverage (65% → 80% target)
  • Phase 1 focuses on Result API migration tests

Current State

Location: tests/CMakeLists.txt:105-117

The following tests are disabled due to Result API changes:

Test File Issue
test_health_monitoring.cpp Result API updates needed
test_fault_tolerance.cpp Result API updates needed
test_metric_exporters.cpp monitoring_data type missing + Result API
test_opentelemetry_adapter.cpp monitoring_data type missing + Result API

Problem Analysis

API Migration Required

The codebase migrated from:

// Old pattern
result<T> res = some_function();
if (res) { auto val = res.value(); }

To:

// New pattern (common::Result<T>)
common::Result<T> res = some_function();
if (res.is_ok()) { auto val = res.value(); }

Missing Type: monitoring_data

Some tests reference monitoring_data type which was removed or renamed during API evolution.

Tasks

  • Update test_health_monitoring.cpp to use is_ok() / is_err() pattern
  • Update test_fault_tolerance.cpp to use new Result API
  • Identify replacement for monitoring_data type in test_metric_exporters.cpp
  • Update test_opentelemetry_adapter.cpp for new API
  • Enable all 4 tests in tests/CMakeLists.txt
  • Verify all tests pass

Acceptance Criteria

  • All 4 test files compile successfully
  • All tests in these files pass
  • Tests added back to tests/CMakeLists.txt
  • CI passes on all platforms

Priority

P0 (High) - Critical for test coverage improvement (ARC-001)

Migration Pattern Reference

// Before (deprecated)
auto result = health_monitor.check();
EXPECT_TRUE(result);
auto value = result.value();

// After (current API)
auto result = health_monitor.check();
EXPECT_TRUE(result.is_ok());
auto value = result.value();

// Error handling
if (result.is_err()) {
    auto& error = result.error();
    // handle error
}

References

  • include/kcenon/monitoring/core/result_types.h - Migration guide in comments
  • docs/advanced/MIGRATION_GUIDE_V2.md - Detailed migration instructions
  • ARC-001 in docs/advanced/ARCHITECTURE_ISSUES.md

Metadata

Metadata

Assignees

Labels

area/coreCore architecture and infrastructurepriority/highHigh priority - Critical for productiontype/testTest additions or improvements

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions