Skip to content

Commit c888b84

Browse files
khanayan123claude
andcommitted
test(telemetry): add code override and validation tests for extended heartbeat interval
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c2c27a4 commit c888b84

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

test/telemetry/test_configuration.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ TELEMETRY_CONFIGURATION_TEST("code override") {
3434
cfg.report_metrics = false;
3535
cfg.metrics_interval_seconds = 1;
3636
cfg.heartbeat_interval_seconds = 2;
37+
cfg.extended_heartbeat_interval_seconds = 3600;
3738
cfg.integration_name = "test";
3839
cfg.integration_version = "2024.10.28";
3940

@@ -45,6 +46,7 @@ TELEMETRY_CONFIGURATION_TEST("code override") {
4546
CHECK(final_cfg->report_metrics == false);
4647
CHECK(final_cfg->metrics_interval == 1s);
4748
CHECK(final_cfg->heartbeat_interval == 2s);
49+
CHECK(final_cfg->extended_heartbeat_interval == 3600s);
4850
CHECK(final_cfg->integration_name == "test");
4951
CHECK(final_cfg->integration_version == "2024.10.28");
5052
}
@@ -156,6 +158,22 @@ TELEMETRY_CONFIGURATION_TEST("validation") {
156158
REQUIRE(!final_cfg);
157159
}
158160
}
161+
162+
SECTION("extended heartbeat interval validation") {
163+
SECTION("code override") {
164+
telemetry::Configuration cfg;
165+
cfg.extended_heartbeat_interval_seconds = -100;
166+
167+
auto final_cfg = telemetry::finalize_config(cfg);
168+
REQUIRE(!final_cfg);
169+
}
170+
171+
SECTION("environment variable override") {
172+
ddtest::EnvGuard env("DD_TELEMETRY_EXTENDED_HEARTBEAT_INTERVAL", "-1");
173+
auto final_cfg = telemetry::finalize_config();
174+
REQUIRE(!final_cfg);
175+
}
176+
}
159177
}
160178

161179
TELEMETRY_CONFIGURATION_TEST("installation infos are used when available") {

0 commit comments

Comments
 (0)