internal/session: add helper for listing sessions

This is used in an enterprise test
This commit is contained in:
Johan Brandhorst-Satzkorn committed 2024-01-05 07:43:21 -08:00
1 parent f29d559d60
commit 6757510205
1 file changed
+7
+7
View File
@@ -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
}