From d84d079b99962bc7d6bace958629f191160130f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Garcia?= Date: Sun, 3 Nov 2024 23:15:04 -0300 Subject: [PATCH] Remove test that would enforce a way of scanning values into an *int The reason for removing this test is that PGx4 and PGx5 don't agree on how to work with *int, thus, if I made the behavior of KSQL match pgx5 the test for pgx4 would break and vice-versa. Fyi KSQL was made to do the same as pgx4 for now, I will create an issue on pgx to ask why pgx5 is doing it differently, maybe if he has a good reason for this I should do the same. --- adapters/kpgx5/kpgx_test.go | 2 +- test_adapters.go | 32 -------------------------------- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/adapters/kpgx5/kpgx_test.go b/adapters/kpgx5/kpgx_test.go index 308e3b2..0e9b468 100644 --- a/adapters/kpgx5/kpgx_test.go +++ b/adapters/kpgx5/kpgx_test.go @@ -21,7 +21,7 @@ func TestAdapter(t *testing.T) { postgresURL, closePostgres := startPostgresDB(ctx, "ksql") defer closePostgres() - ksql.RunTestsForAdapter(t, "kpgx", sqldialect.PostgresDialect{}, postgresURL, func(t *testing.T) (ksql.DBAdapter, io.Closer) { + ksql.RunTestsForAdapter(t, "kpgx5", sqldialect.PostgresDialect{}, postgresURL, func(t *testing.T) (ksql.DBAdapter, io.Closer) { pool, err := pgxpool.New(ctx, postgresURL) if err != nil { t.Fatal(err.Error()) diff --git a/test_adapters.go b/test_adapters.go index f4f82bc..3ca62b5 100644 --- a/test_adapters.go +++ b/test_adapters.go @@ -869,38 +869,6 @@ func InsertTest( tt.AssertEqual(t, result.Address, u.Address) }) - t.Run("should insert one user correctly when the ID is a pointer to int reusing existing int", func(t *testing.T) { - c := newTestDB(db, dialect) - - type ptrUser struct { - ID *uint `ksql:"id"` - Name string `ksql:"name"` - Address address `ksql:"address,json"` - Age int `ksql:"age"` - } - var id uint = 0 - u := ptrUser{ - ID: &id, - Name: "Paulo", - Address: address{ - Country: "Brazil", - }, - } - - err := c.Insert(ctx, usersTable, &u) - tt.AssertNoErr(t, err) - tt.AssertNotEqual(t, u.ID, nil) - tt.AssertEqual(t, id, *u.ID) - - result := user{} - err = getUserByID(db, dialect, &result, *u.ID) - tt.AssertNoErr(t, err) - - tt.AssertEqual(t, result.ID, id) - tt.AssertEqual(t, result.Name, u.Name) - tt.AssertEqual(t, result.Address, u.Address) - }) - t.Run("should insert ignoring the ID with multiple ids", func(t *testing.T) { if dialect.InsertMethod() != sqldialect.InsertWithLastInsertID { return