MCPcopy Create free account
hub / github.com/Driver-C/tryssh / TestGetCachedMasterKey_UsesCache

Function TestGetCachedMasterKey_UsesCache

pkg/utils/crypto_test.go:345–361  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

343}
344
345func 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
363func TestClearMasterKey_WhenNil(t *testing.T) {
364 // ClearMasterKey should be safe to call when masterKey is already nil.

Callers

nothing calls this directly

Calls 2

ClearMasterKeyFunction · 0.85
GetCachedMasterKeyFunction · 0.85

Tested by

no test coverage detected