From 207359bbe0f10fdb19ba46941449b7d9d2aea665 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 18:24:40 +0000 Subject: [PATCH 1/2] Initial plan From 2e9baeb61889896bf7771ed0c38542ccfdffdb49 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 18:29:04 +0000 Subject: [PATCH 2/2] Use atomic.Uint64 for test upload counter Co-authored-by: FiloSottile <1225294+FiloSottile@users.noreply.github.com> --- internal/ctlog/ctlog_test.go | 2 +- internal/ctlog/testlog_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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)