(t *testing.T)
| 94 | } |
| 95 | |
| 96 | func TestRenewLockLeaseDuration(t *testing.T) { |
| 97 | ctx := context.Background() |
| 98 | tmpDir, err := os.MkdirTemp(os.TempDir(), "certmagic-test*") |
| 99 | testutil.RequireNoError(t, err, "allocating tmp dir") |
| 100 | defer os.RemoveAll(tmpDir) |
| 101 | |
| 102 | mockStorage := &mockStorageWithLease{ |
| 103 | FileStorage: &FileStorage{Path: tmpDir}, |
| 104 | } |
| 105 | |
| 106 | // Test attempt 0 |
| 107 | cfg := &Config{Logger: defaultTestLogger} |
| 108 | cfg.renewLockLease(ctx, mockStorage, "test-lock", 0) |
| 109 | expected := retryIntervals[0] + DefaultACME.CertObtainTimeout |
| 110 | testutil.RequireEqual(t, expected, mockStorage.lastDuration) |
| 111 | |
| 112 | // Test attempt beyond array bounds |
| 113 | cfg.renewLockLease(ctx, mockStorage, "test-lock", 999) |
| 114 | expected = maxRetryDuration + DefaultACME.CertObtainTimeout |
| 115 | testutil.RequireEqual(t, expected, mockStorage.lastDuration) |
| 116 | } |
| 117 | |
| 118 | // Test that lease renewal works when storage supports it |
| 119 | func TestRenewLockLeaseWithInterface(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…