diff --git a/internal/ctlog/ctlog_test.go b/internal/ctlog/ctlog_test.go index 89f7f12..a7decb7 100644 --- a/internal/ctlog/ctlog_test.go +++ b/internal/ctlog/ctlog_test.go @@ -125,7 +125,7 @@ func TestSequenceUploadCount(t *testing.T) { var old uint64 uploads := func() uint64 { - new := tl.Config.Backend.(*MemoryBackend).uploads + new := tl.Config.Backend.(*MemoryBackend).uploads.Load() n := new - old old = new return n diff --git a/internal/ctlog/testlog_test.go b/internal/ctlog/testlog_test.go index 416da5d..46cd342 100644 --- a/internal/ctlog/testlog_test.go +++ b/internal/ctlog/testlog_test.go @@ -440,7 +440,7 @@ type MemoryBackend struct { imm map[string]bool del map[string]bool - uploads uint64 + uploads atomic.Uint64 UploadCallback func(key string, data []byte) (apply bool, err error) } @@ -452,7 +452,7 @@ func NewMemoryBackend(t testing.TB) *MemoryBackend { } func (b *MemoryBackend) Upload(ctx context.Context, key string, data []byte, opts *ctlog.UploadOptions) error { - atomic.AddUint64(&b.uploads, 1) + b.uploads.Add(1) // TODO: check key format is expected. if len(data) == 0 && key != "_roots.pem" { b.t.Errorf("uploaded key %q with empty data", key)