(t *testing.T)
| 343 | } |
| 344 | |
| 345 | func TestGetCachedMasterKey_UsesCache(t *testing.T) { |
| 346 | ClearMasterKey() |
| 347 | t.Setenv(keyEnvVar, "cacheTestPassword") |
| 348 | |
| 349 | // First call caches via env var |
| 350 | key1, err := GetCachedMasterKey() |
| 351 | require.NoError(t, err) |
| 352 | |
| 353 | // Remove env var — cached key should still be returned |
| 354 | os.Unsetenv(keyEnvVar) |
| 355 | |
| 356 | key2, err := GetCachedMasterKey() |
| 357 | require.NoError(t, err) |
| 358 | assert.Equal(t, key1, key2) |
| 359 | |
| 360 | ClearMasterKey() |
| 361 | } |
| 362 | |
| 363 | func TestClearMasterKey_WhenNil(t *testing.T) { |
| 364 | // ClearMasterKey should be safe to call when masterKey is already nil. |
nothing calls this directly
no test coverage detected