From f57354ba522378dca06176b39a8e14648fba7ecf Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Mon, 4 Sep 2023 16:24:35 +0100 Subject: [PATCH 1/3] Enable Postgres store tests Signed-off-by: Babak K. Shandiz --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6f0775c64..412188249 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -47,6 +47,7 @@ jobs: run: go test -mod readonly ./... env: JIMM_DSN: postgresql://jimm:jimm@localhost:5432/jimm + JIMM_TEST_PGXDSN: postgresql://jimm:jimm@localhost:5432/jimm PGHOST: localhost PGPASSWORD: jimm PGSSLMODE: disable From 2d0eae93b1308ea99b245bcdd99252ced4c11b72 Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Mon, 4 Sep 2023 16:54:05 +0100 Subject: [PATCH 2/3] Add dummy `return` to trigger workflows Signed-off-by: Babak K. Shandiz --- internal/db/pgx_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/db/pgx_test.go b/internal/db/pgx_test.go index 3b1275345..d1234c003 100644 --- a/internal/db/pgx_test.go +++ b/internal/db/pgx_test.go @@ -37,6 +37,7 @@ func (s *postgresSuite) Init(c *qt.C) { dsn := os.Getenv("JIMM_TEST_PGXDSN") if dsn == "" { c.Skip("postgresql not configured") + return } connCfg, err := pgx.ParseConfig(dsn) From f5592ad814f40004389c4fcb70fe8d8b3ac1ef3c Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Tue, 5 Sep 2023 08:46:02 +0100 Subject: [PATCH 3/3] Change equal asserts on time structs to deep-equal Signed-off-by: Babak K. Shandiz --- internal/db/secrets_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/db/secrets_test.go b/internal/db/secrets_test.go index e0ba93d1f..64512e2f1 100644 --- a/internal/db/secrets_test.go +++ b/internal/db/secrets_test.go @@ -32,7 +32,7 @@ func (s *dbSuite) TestInsertSecret(c *qt.C) { secret := dbmodel.Secret{} tx := s.Database.DB.First(&secret) c.Assert(tx.Error, qt.IsNil) - c.Assert(secret.Time, qt.Equals, testTime) + c.Assert(secret.Time, qt.DeepEquals, testTime) c.Assert(secret.Type, qt.Equals, "generic") c.Assert(secret.Tag, qt.Equals, "123") c.Assert(secret.Data, qt.IsNil) @@ -61,7 +61,7 @@ func (s *dbSuite) TestUpsertSecret(c *qt.C) { secret := dbmodel.Secret{} tx := s.Database.DB.First(&secret) c.Assert(tx.Error, qt.IsNil) - c.Assert(secret.Time, qt.Equals, newTime) + c.Assert(secret.Time, qt.DeepEquals, newTime) c.Assert([]byte(secret.Data), qt.DeepEquals, []byte("123")) } @@ -79,7 +79,7 @@ func (s *dbSuite) TestGetSecret(c *qt.C) { c.Assert(s.Database.DB.Create(&u).Error, qt.IsNil) secret := dbmodel.Secret{Type: "generic", Tag: "123"} c.Assert(s.Database.GetSecret(ctx, &secret), qt.IsNil) - c.Assert(secret.Time, qt.Equals, testTime) + c.Assert(secret.Time, qt.DeepEquals, testTime) c.Assert(secret.Type, qt.Equals, "generic") c.Assert(secret.Tag, qt.Equals, "123") }