From dd5b6e840f0b7bdcc15e0465898543661b1114e6 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Mon, 18 Dec 2023 14:58:32 -0800 Subject: [PATCH] internal/session: add helper for listing sessions This is used in an enterprise test --- internal/session/testing.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/session/testing.go b/internal/session/testing.go index ddb4223b47..542cc70edf 100644 --- a/internal/session/testing.go +++ b/internal/session/testing.go @@ -273,3 +273,10 @@ func TestTofu(t testing.TB) []byte { func TestCert(jobId string) (ed25519.PrivateKey, []byte, error) { return newCert(context.Background(), jobId, []string{"127.0.0.1", "localhost"}, time.Now().Add(5*time.Minute), rand.Reader) } + +// TestListSessions returns a list of sessions and the timestamp of the query for testing purposes +func TestListSessions(t testing.TB, ctx context.Context, repo *Repository) ([]*Session, time.Time) { + sess, ttime, err := repo.listSessions(ctx) + require.NoError(t, err) + return sess, ttime +}