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

Function TestRenewLockLeaseWithInterface

config_test.go:119–134  ·  view source on GitHub ↗

Test that lease renewal works when storage supports it

(t *testing.T)

Source from the content-addressed store, hash-verified

117
118// Test that lease renewal works when storage supports it
119func TestRenewLockLeaseWithInterface(t *testing.T) {
120 ctx := context.Background()
121 tmpDir, err := os.MkdirTemp(os.TempDir(), "certmagic-test*")
122 testutil.RequireNoError(t, err, "allocating tmp dir")
123 defer os.RemoveAll(tmpDir)
124
125 mockStorage := &mockStorageWithLease{
126 FileStorage: &FileStorage{Path: tmpDir},
127 }
128
129 cfg := &Config{Logger: defaultTestLogger}
130 err = cfg.renewLockLease(ctx, mockStorage, "test-lock", 0)
131 testutil.RequireNoError(t, err)
132
133 testutil.RequireEqual(t, true, mockStorage.renewCalled)
134}
135
136// Test that no error occurs when storage doesn't support lease renewal
137func TestRenewLockLeaseWithoutInterface(t *testing.T) {

Callers

nothing calls this directly

Calls 3

renewLockLeaseMethod · 0.95
RequireNoErrorFunction · 0.92
RequireEqualFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…