github.com/argoproj/argo-cd/v3@v3.2.1/util/session/state_test.go (about) 1 package session 2 3 import ( 4 "context" 5 "testing" 6 "time" 7 8 "github.com/argoproj/argo-cd/v3/test" 9 10 "github.com/stretchr/testify/assert" 11 "github.com/stretchr/testify/require" 12 ) 13 14 func TestUserStateStorage_LoadRevokedTokens(t *testing.T) { 15 redis, closer := test.NewInMemoryRedis() 16 defer closer() 17 18 err := redis.Set(t.Context(), revokedTokenPrefix+"abc", "", time.Hour).Err() 19 require.NoError(t, err) 20 21 ctx, cancel := context.WithCancel(t.Context()) 22 defer cancel() 23 24 storage := NewUserStateStorage(redis) 25 storage.Init(ctx) 26 time.Sleep(time.Millisecond * 100) 27 28 assert.True(t, storage.IsTokenRevoked("abc")) 29 }