MCPcopy
hub / github.com/caddyserver/certmagic / TestFileStorageStoreLoad

Function TestFileStorageStoreLoad

filestorage_test.go:13–26  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestFileStorageStoreLoad(t *testing.T) {
14 ctx := context.Background()
15 tmpDir, err := os.MkdirTemp(os.TempDir(), "certmagic*")
16 testutil.RequireNoError(t, err, "allocating tmp dir")
17 defer os.RemoveAll(tmpDir)
18 s := &certmagic.FileStorage{
19 Path: tmpDir,
20 }
21 err = s.Store(ctx, "foo", []byte("bar"))
22 testutil.RequireNoError(t, err)
23 dat, err := s.Load(ctx, "foo")
24 testutil.RequireNoError(t, err)
25 testutil.RequireEqualValues(t, dat, []byte("bar"))
26}
27
28func TestFileStorageStoreLoadRace(t *testing.T) {
29 ctx := context.Background()

Callers

nothing calls this directly

Calls 4

StoreMethod · 0.95
LoadMethod · 0.95
RequireNoErrorFunction · 0.92
RequireEqualValuesFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…