Debian Codegraph @

internal/metrics/logmetrics_test.go

raw symbols SCIP
1 package metrics
2
3 import (
4 "path/filepath"
5 "testing"
6 "time"
7 )
8
9 func TestLoadCTIndex_DoesNotDeadlockWhenFileMissing(t *testing.T) {
10 metrics := LogMetrics{metrics: make(CTMetrics), index: make(CTCertIndex)}
11 ctIndexPath := filepath.Join(t.TempDir(), "ct_index.json")
12
13 done := make(chan struct{})
14 go func() {
15 metrics.LoadCTIndex(ctIndexPath)
16 close(done)
17 }()
18
19 select {
20 case <-done:
21 // ok
22 case <-time.After(200 * time.Millisecond):
23 t.Fatalf("LoadCTIndex appears to deadlock when index file is missing")
24 }
25 }