mirror of
https://github.com/anchore/syft
synced 2024-11-10 06:14:16 +00:00
af3aaa0397
Signed-off-by: Keith Zantow <kzantow@gmail.com>
32 lines
626 B
Go
32 lines
626 B
Go
package cache
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func Test_SetManager(t *testing.T) {
|
|
original := GetManager()
|
|
defer SetManager(original)
|
|
|
|
SetManager(nil)
|
|
|
|
require.NotNil(t, GetManager())
|
|
require.IsType(t, &bypassedCache{}, GetManager())
|
|
|
|
SetManager(NewInMemory(0))
|
|
|
|
require.NotNil(t, GetManager())
|
|
require.IsType(t, &bypassedCache{}, GetManager())
|
|
|
|
SetManager(NewInMemory(1 * time.Hour))
|
|
|
|
require.NotNil(t, GetManager())
|
|
require.IsType(t, &filesystemCache{}, GetManager())
|
|
|
|
SetManager(nil)
|
|
require.NotNil(t, GetManager())
|
|
require.IsType(t, &bypassedCache{}, GetManager())
|
|
}
|