| 1 | package metricsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/metrics`/ |
| 2 | |
| 3 | import ( |
| 4 | "path/filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/" |
| 5 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 6 | "timescip-go gomod github.com/golang/go/src go1.25.0 time/" |
| 7 | ) |
| 8 | |
| 9 | func TestLoadCTIndex_DoesNotDeadlockWhenFileMissingscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/metrics`/TestLoadCTIndex_DoesNotDeadlockWhenFileMissing().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 10 | metrics := LogMetricsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/metrics`/LogMetrics#{metricsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/metrics`/LogMetrics#metrics.: make(CTMetricsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/metrics`/CTMetrics#), indexscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/metrics`/LogMetrics#index.: make(CTCertIndexscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/metrics`/CTCertIndex#)} |
| 11 | ctIndexPath := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(t.TempDirscip-go gomod github.com/golang/go/src go1.25.0 testing/common#TempDir().(), "ct_index.json") |
| 12 | |
| 13 | done := make(chan struct{}) |
| 14 | go func() { |
| 15 | metrics.LoadCTIndexscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/metrics`/LogMetrics#LoadCTIndex().(ctIndexPath) |
| 16 | close(done) |
| 17 | }() |
| 18 | |
| 19 | select { |
| 20 | case <-done: |
| 21 | // ok |
| 22 | case <-timescip-go gomod github.com/golang/go/src go1.25.0 time/.Afterscip-go gomod github.com/golang/go/src go1.25.0 time/After().(200 * timescip-go gomod github.com/golang/go/src go1.25.0 time/.Millisecondscip-go gomod github.com/golang/go/src go1.25.0 time/Millisecond.): |
| 23 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("LoadCTIndex appears to deadlock when index file is missing") |
| 24 | } |
| 25 | } |