From 10b087640fe37f575fc20149f73157885f912089 Mon Sep 17 00:00:00 2001 From: Elias Schneider Date: Sun, 24 Aug 2025 19:15:26 +0200 Subject: [PATCH] tests: fix postgres e2e tests (#877) --- backend/internal/service/e2etest_service.go | 6 +++--- tests/data.ts | 8 ++++---- tests/setup/docker-compose-postgres.yml | 3 +++ tests/specs/oidc.spec.ts | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/backend/internal/service/e2etest_service.go b/backend/internal/service/e2etest_service.go index e41d1df5..1cb35499 100644 --- a/backend/internal/service/e2etest_service.go +++ b/backend/internal/service/e2etest_service.go @@ -343,7 +343,7 @@ func (s *TestService) SeedDatabase(baseURL string) error { }, { Base: model.Base{ - ID: "b2c3d4e5-f6g7-8901-bcde-f12345678901", + ID: "dc3c9c96-714e-48eb-926e-2d7c7858e6cf", }, Token: "PARTIAL567890ABC", ExpiresAt: datatype.DateTime(time.Now().Add(7 * 24 * time.Hour)), @@ -352,7 +352,7 @@ func (s *TestService) SeedDatabase(baseURL string) error { }, { Base: model.Base{ - ID: "c3d4e5f6-g7h8-9012-cdef-123456789012", + ID: "44de1863-ffa5-4db1-9507-4887cd7a1e3f", }, Token: "EXPIRED34567890B", ExpiresAt: datatype.DateTime(time.Now().Add(-24 * time.Hour)), // Expired @@ -361,7 +361,7 @@ func (s *TestService) SeedDatabase(baseURL string) error { }, { Base: model.Base{ - ID: "d4e5f6g7-h8i9-0123-def0-234567890123", + ID: "f1b1678b-7720-4d8b-8f91-1dbff1e2d02b", }, Token: "FULLYUSED567890C", ExpiresAt: datatype.DateTime(time.Now().Add(24 * time.Hour)), diff --git a/tests/data.ts b/tests/data.ts index 76775140..72b51c02 100644 --- a/tests/data.ts +++ b/tests/data.ts @@ -40,7 +40,7 @@ export const oidcClients = { id: '7c21a609-96b5-4011-9900-272b8d31a9d1', name: 'Tailscale', callbackUrl: 'http://tailscale/auth/callback', - secret: 'n4VfQeXlTzA6yKpWbR9uJcMdSx2qH0Lo', + secret: 'n4VfQeXlTzA6yKpWbR9uJcMdSx2qH0Lo' }, federated: { id: 'c48232ff-ff65-45ed-ae96-7afa8a9b443b', @@ -116,7 +116,7 @@ export const signupTokens = { createdAt: new Date().toISOString() }, partiallyUsed: { - id: 'b2c3d4e5-f6g7-8901-bcde-f12345678901', + id: 'dc3c9c96-714e-48eb-926e-2d7c7858e6cf', token: 'PARTIAL567890ABC', expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString(), usageLimit: 5, @@ -124,7 +124,7 @@ export const signupTokens = { createdAt: new Date(Date.now() - 2 * 24 * 60 * 60 * 1000).toISOString() }, expired: { - id: 'c3d4e5f6-g7h8-9012-cdef-123456789012', + id: '44de1863-ffa5-4db1-9507-4887cd7a1e3f', token: 'EXPIRED34567890B', expiresAt: new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString(), usageLimit: 3, @@ -132,7 +132,7 @@ export const signupTokens = { createdAt: new Date(Date.now() - 3 * 24 * 60 * 60 * 1000).toISOString() }, fullyUsed: { - id: 'd4e5f6g7-h8i9-0123-def0-234567890123', + id: 'f1b1678b-7720-4d8b-8f91-1dbff1e2d02b', token: 'FULLYUSED567890C', expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(), usageLimit: 1, diff --git a/tests/setup/docker-compose-postgres.yml b/tests/setup/docker-compose-postgres.yml index ccd18b15..0171a91b 100644 --- a/tests/setup/docker-compose-postgres.yml +++ b/tests/setup/docker-compose-postgres.yml @@ -19,6 +19,9 @@ services: extends: file: docker-compose.yml service: pocket-id + environment: + - DB_PROVIDER=postgres + - DB_CONNECTION_STRING=postgres://postgres:postgres@postgres:5432/pocket-id depends_on: postgres: condition: service_healthy diff --git a/tests/specs/oidc.spec.ts b/tests/specs/oidc.spec.ts index 3eb7b3ae..ab24f5e6 100644 --- a/tests/specs/oidc.spec.ts +++ b/tests/specs/oidc.spec.ts @@ -215,7 +215,7 @@ test('Refresh token fails when used for the wrong user', async ({ request }) => data: { rt: token, client: clientId, - user: 'bad-user' + user: '44cb5d71-db31-4555-9a1b-5484650f6002' } }) .then((r) => r.text());