(t *testing.T)
| 26 | } |
| 27 | |
| 28 | func TestFileStorageStoreLoadRace(t *testing.T) { |
| 29 | ctx := context.Background() |
| 30 | tmpDir, err := os.MkdirTemp(os.TempDir(), "certmagic*") |
| 31 | testutil.RequireNoError(t, err, "allocating tmp dir") |
| 32 | defer os.RemoveAll(tmpDir) |
| 33 | s := &certmagic.FileStorage{ |
| 34 | Path: tmpDir, |
| 35 | } |
| 36 | a := bytes.Repeat([]byte("a"), 4096*1024) |
| 37 | b := bytes.Repeat([]byte("b"), 4096*1024) |
| 38 | err = s.Store(ctx, "foo", a) |
| 39 | testutil.RequireNoError(t, err) |
| 40 | done := make(chan struct{}) |
| 41 | go func() { |
| 42 | err := s.Store(ctx, "foo", b) |
| 43 | testutil.RequireNoError(t, err) |
| 44 | close(done) |
| 45 | }() |
| 46 | dat, err := s.Load(ctx, "foo") |
| 47 | <-done |
| 48 | testutil.RequireNoError(t, err) |
| 49 | testutil.RequireEqualValues(t, 4096*1024, len(dat)) |
| 50 | } |
| 51 | |
| 52 | func TestFileStorageWriteLock(t *testing.T) { |
| 53 | ctx := context.Background() |
nothing calls this directly
no test coverage detected
searching dependent graphs…