11import type { HostPowerSnapshot } from "@t3tools/contracts" ;
22import { describe , expect , it } from "@effect/vitest" ;
3- import * as Cause from "effect/Cause" ;
43import * as DateTime from "effect/DateTime" ;
54import * as Deferred from "effect/Deferred" ;
65import * as Effect from "effect/Effect" ;
@@ -9,12 +8,9 @@ import * as Ref from "effect/Ref";
98import * as Semaphore from "effect/Semaphore" ;
109
1110import {
12- NativeTelemetryRequestTimedOut ,
13- NativeTelemetryStreamClosed ,
1411 canCommandNativeTelemetrySidecar ,
1512 canRequestNativeTelemetryRetry ,
1613 commitCollectionControlUpdate ,
17- nativeTelemetrySupervisorFailureMessage ,
1814 retainRecentNativeTelemetryFailures ,
1915 resolveNativeSampleIntervalMs ,
2016 synchronizeCollectionControlOnStart ,
@@ -82,44 +78,6 @@ describe("canCommandNativeTelemetrySidecar", () => {
8278 } ) ;
8379} ) ;
8480
85- describe ( "NativeTelemetryRequestTimedOut" , ( ) => {
86- it ( "models history and sample request deadlines without a fabricated cause" , ( ) => {
87- const historyTimeout = new NativeTelemetryRequestTimedOut ( {
88- operation : "readHistory" ,
89- timeoutMs : 15_000 ,
90- } ) ;
91- const sampleTimeout = new NativeTelemetryRequestTimedOut ( {
92- operation : "sampleNow" ,
93- timeoutMs : 5_000 ,
94- } ) ;
95-
96- expect ( historyTimeout . message ) . toBe (
97- "Resource monitor 'readHistory' request timed out after 15000ms." ,
98- ) ;
99- expect ( sampleTimeout . message ) . toBe (
100- "Resource monitor 'sampleNow' request timed out after 5000ms." ,
101- ) ;
102- expect ( "cause" in historyTimeout ) . toBe ( false ) ;
103- expect ( "cause" in sampleTimeout ) . toBe ( false ) ;
104- } ) ;
105- } ) ;
106-
107- describe ( "native telemetry supervisor failures" , ( ) => {
108- it ( "distinguishes a closed event stream from a process exit" , ( ) => {
109- expect ( new NativeTelemetryStreamClosed ( ) . message ) . toBe (
110- "Resource monitor event stream closed unexpectedly." ,
111- ) ;
112- } ) ;
113-
114- it ( "keeps defect details out of the caller-visible health message" , ( ) => {
115- const secret = "credential=do-not-expose" ;
116- const message = nativeTelemetrySupervisorFailureMessage ( Cause . die ( new Error ( secret ) ) ) ;
117-
118- expect ( message ) . toBe ( "Resource monitor supervisor stopped unexpectedly." ) ;
119- expect ( message ) . not . toContain ( secret ) ;
120- } ) ;
121- } ) ;
122-
12381describe ( "retainRecentNativeTelemetryFailures" , ( ) => {
12482 it ( "expires old failures so an isolated crash restarts from the initial backoff" , ( ) => {
12583 expect ( retainRecentNativeTelemetryFailures ( [ 0 , 30_000 ] , 90_001 ) ) . toEqual ( [ ] ) ;
0 commit comments