diff --git a/flow/connectors/postgres/postgres_repl_test.go b/flow/connectors/postgres/postgres_repl_test.go index 1084614ebe..4fb1012d4b 100644 --- a/flow/connectors/postgres/postgres_repl_test.go +++ b/flow/connectors/postgres/postgres_repl_test.go @@ -17,14 +17,13 @@ import ( ) type PostgresReplicationSnapshotTestSuite struct { - got.G t *testing.T connector *PostgresConnector schema string } -func setupSuite(t *testing.T, g got.G) PostgresReplicationSnapshotTestSuite { +func setupSuite(t *testing.T) PostgresReplicationSnapshotTestSuite { connector, err := NewPostgresConnector(context.Background(), &protos.PostgresConfig{ Host: "localhost", Port: 7132, @@ -66,7 +65,6 @@ func setupSuite(t *testing.T, g got.G) PostgresReplicationSnapshotTestSuite { require.NoError(t, err) return PostgresReplicationSnapshotTestSuite{ - G: g, t: t, connector: connector, schema: schema, @@ -111,12 +109,12 @@ func (suite PostgresReplicationSnapshotTestSuite) TearDownSuite() { err = teardownTx.Commit(context.Background()) require.NoError(suite.t, err) - suite.True(suite.connector.ConnectionActive() == nil) + require.True(suite.t, suite.connector.ConnectionActive() == nil) err = suite.connector.Close() require.NoError(suite.t, err) - suite.False(suite.connector.ConnectionActive() == nil) + require.False(suite.t, suite.connector.ConnectionActive() == nil) } func (suite PostgresReplicationSnapshotTestSuite) TestSimpleSlotCreation() { diff --git a/flow/connectors/postgres/postgres_schema_delta_test.go b/flow/connectors/postgres/postgres_schema_delta_test.go index fc747b3101..13e07c3ba6 100644 --- a/flow/connectors/postgres/postgres_schema_delta_test.go +++ b/flow/connectors/postgres/postgres_schema_delta_test.go @@ -14,7 +14,6 @@ import ( ) type PostgresSchemaDeltaTestSuite struct { - got.G t *testing.T connector *PostgresConnector @@ -22,14 +21,13 @@ type PostgresSchemaDeltaTestSuite struct { const schemaDeltaTestSchemaName = "pgschema_delta_test" -func setupSchemaDeltaSuite(t *testing.T, g got.G) PostgresSchemaDeltaTestSuite { +func setupSchemaDeltaSuite(t *testing.T) PostgresSchemaDeltaTestSuite { connector, err := NewPostgresConnector(context.Background(), &protos.PostgresConfig{ Host: "localhost", Port: 7132, User: "postgres", Password: "postgres", Database: "postgres", - }) }, false) require.NoError(t, err) @@ -49,7 +47,6 @@ func setupSchemaDeltaSuite(t *testing.T, g got.G) PostgresSchemaDeltaTestSuite { err = setupTx.Commit(context.Background()) require.NoError(t, err) return PostgresSchemaDeltaTestSuite{ - G: g, t: t, connector: connector, } @@ -70,10 +67,10 @@ func (suite PostgresSchemaDeltaTestSuite) TearDownSuite() { err = teardownTx.Commit(context.Background()) require.NoError(suite.t, err) - suite.True(suite.connector.ConnectionActive() == nil) + require.True(suite.t, suite.connector.ConnectionActive() == nil) err = suite.connector.Close() require.NoError(suite.t, err) - suite.False(suite.connector.ConnectionActive() == nil) + require.False(suite.t, suite.connector.ConnectionActive() == nil) } func (suite PostgresSchemaDeltaTestSuite) TestSimpleAddColumn() { @@ -96,7 +93,7 @@ func (suite PostgresSchemaDeltaTestSuite) TestSimpleAddColumn() { TableIdentifiers: []string{tableName}, }) require.NoError(suite.t, err) - suite.Equal(&protos.TableSchema{ + require.Equal(suite.t, &protos.TableSchema{ TableIdentifier: tableName, Columns: map[string]string{ "id": string(qvalue.QValueKindInt32), @@ -157,7 +154,7 @@ func (suite PostgresSchemaDeltaTestSuite) TestAddAllColumnTypes() { TableIdentifiers: []string{tableName}, }) require.NoError(suite.t, err) - suite.Equal(expectedTableSchema, output.TableNameSchemaMapping[tableName]) + require.Equal(suite.t, expectedTableSchema, output.TableNameSchemaMapping[tableName]) } func (suite PostgresSchemaDeltaTestSuite) TestAddTrickyColumnNames() { @@ -203,7 +200,7 @@ func (suite PostgresSchemaDeltaTestSuite) TestAddTrickyColumnNames() { TableIdentifiers: []string{tableName}, }) require.NoError(suite.t, err) - suite.Equal(expectedTableSchema, output.TableNameSchemaMapping[tableName]) + require.Equal(suite.t, expectedTableSchema, output.TableNameSchemaMapping[tableName]) } func (suite PostgresSchemaDeltaTestSuite) TestAddDropWhitespaceColumnNames() { @@ -243,7 +240,7 @@ func (suite PostgresSchemaDeltaTestSuite) TestAddDropWhitespaceColumnNames() { TableIdentifiers: []string{tableName}, }) require.NoError(suite.t, err) - suite.Equal(expectedTableSchema, output.TableNameSchemaMapping[tableName]) + require.Equal(suite.t, expectedTableSchema, output.TableNameSchemaMapping[tableName]) } func TestPostgresSchemaDeltaTestSuite(t *testing.T) { diff --git a/flow/e2e/bigquery/peer_flow_bq_test.go b/flow/e2e/bigquery/peer_flow_bq_test.go index be57f6a376..4dba50aa53 100644 --- a/flow/e2e/bigquery/peer_flow_bq_test.go +++ b/flow/e2e/bigquery/peer_flow_bq_test.go @@ -20,7 +20,6 @@ import ( ) type PeerFlowE2ETestSuiteBQ struct { - got.G t *testing.T bqSuffix string @@ -102,7 +101,7 @@ func setupBigQuery(t *testing.T) *BigQueryTestHelper { } // Implement SetupAllSuite interface to setup the test suite -func setupSuite(t *testing.T, g got.G) PeerFlowE2ETestSuiteBQ { +func setupSuite(t *testing.T) PeerFlowE2ETestSuiteBQ { err := godotenv.Load() if err != nil { // it's okay if the .env file is not present @@ -122,7 +121,6 @@ func setupSuite(t *testing.T, g got.G) PeerFlowE2ETestSuiteBQ { bq := setupBigQuery(t) return PeerFlowE2ETestSuiteBQ{ - G: g, t: t, bqSuffix: bqSuffix, pool: pool, @@ -134,13 +132,13 @@ func (s PeerFlowE2ETestSuiteBQ) TearDownSuite() { err := e2e.TearDownPostgres(s.pool, s.bqSuffix) if err != nil { slog.Error("failed to tear down postgres", slog.Any("error", err)) - s.FailNow() + s.t.FailNow() } err = s.bqHelper.DropDataset() if err != nil { slog.Error("failed to tear down bigquery", slog.Any("error", err)) - s.FailNow() + s.t.FailNow() } } @@ -316,7 +314,7 @@ func (s PeerFlowE2ETestSuiteBQ) Test_Complete_Simple_Flow_BQ() { count, err := s.bqHelper.countRows(dstTableName) require.NoError(s.t, err) - s.Equal(10, count) + require.Equal(s.t, 10, count) // TODO: verify that the data is correctly synced to the destination table // on the bigquery side @@ -798,8 +796,8 @@ func (s PeerFlowE2ETestSuiteBQ) Test_Multi_Table_BQ() { count2, err := s.bqHelper.countRows(dstTable2Name) require.NoError(s.t, err) - s.Equal(1, count1) - s.Equal(1, count2) + require.Equal(s.t, 1, count1) + require.Equal(s.t, 1, count2) env.AssertExpectations(s.t) } diff --git a/flow/e2e/postgres/qrep_flow_pg_test.go b/flow/e2e/postgres/qrep_flow_pg_test.go index cab6ac7841..7c0532ee33 100644 --- a/flow/e2e/postgres/qrep_flow_pg_test.go +++ b/flow/e2e/postgres/qrep_flow_pg_test.go @@ -20,7 +20,6 @@ import ( ) type PeerFlowE2ETestSuitePG struct { - got.G t *testing.T pool *pgxpool.Pool @@ -33,7 +32,7 @@ func TestPeerFlowE2ETestSuitePG(t *testing.T) { got.Each(t, e2eshared.GotSuite(setupSuite)) } -func setupSuite(t *testing.T, g got.G) PeerFlowE2ETestSuitePG { +func setupSuite(t *testing.T) PeerFlowE2ETestSuitePG { err := godotenv.Load() if err != nil { // it's okay if the .env file is not present @@ -59,7 +58,6 @@ func setupSuite(t *testing.T, g got.G) PeerFlowE2ETestSuitePG { }, false) require.NoError(t, err) return PeerFlowE2ETestSuitePG{ - G: g, t: t, pool: pool, peer: peer, diff --git a/flow/e2e/s3/qrep_flow_s3_test.go b/flow/e2e/s3/qrep_flow_s3_test.go index e46e0f3005..d9ecc4dacc 100644 --- a/flow/e2e/s3/qrep_flow_s3_test.go +++ b/flow/e2e/s3/qrep_flow_s3_test.go @@ -18,7 +18,6 @@ import ( ) type PeerFlowE2ETestSuiteS3 struct { - got.G t *testing.T pool *pgxpool.Pool @@ -41,7 +40,7 @@ func setupS3(mode string) (*S3TestHelper, error) { return NewS3TestHelper(mode == "gcs") } -func setupSuite(t *testing.T, g got.G) PeerFlowE2ETestSuiteS3 { +func setupSuite(t *testing.T) PeerFlowE2ETestSuiteS3 { err := godotenv.Load() if err != nil { // it's okay if the .env file is not present @@ -61,7 +60,6 @@ func setupSuite(t *testing.T, g got.G) PeerFlowE2ETestSuiteS3 { } return PeerFlowE2ETestSuiteS3{ - G: g, t: t, pool: pool, s3Helper: helper, diff --git a/flow/e2e/snowflake/peer_flow_sf_test.go b/flow/e2e/snowflake/peer_flow_sf_test.go index 29d51d6337..0d84e35b82 100644 --- a/flow/e2e/snowflake/peer_flow_sf_test.go +++ b/flow/e2e/snowflake/peer_flow_sf_test.go @@ -24,7 +24,6 @@ import ( ) type PeerFlowE2ETestSuiteSF struct { - got.G t *testing.T pgSuffix string @@ -45,7 +44,7 @@ func (s PeerFlowE2ETestSuiteSF) attachSuffix(input string) string { return fmt.Sprintf("%s_%s", input, s.pgSuffix) } -func setupSuite(t *testing.T, g got.G) PeerFlowE2ETestSuiteSF { +func setupSuite(t *testing.T) PeerFlowE2ETestSuiteSF { err := godotenv.Load() if err != nil { // it's okay if the .env file is not present @@ -60,13 +59,13 @@ func setupSuite(t *testing.T, g got.G) PeerFlowE2ETestSuiteSF { pool, err := e2e.SetupPostgres(pgSuffix) if err != nil || pool == nil { slog.Error("failed to setup Postgres", slog.Any("error", err)) - g.FailNow() + t.FailNow() } sfHelper, err := NewSnowflakeTestHelper() if err != nil { slog.Error("failed to setup Snowflake", slog.Any("error", err)) - g.FailNow() + t.FailNow() } connector, err := connsnowflake.NewSnowflakeConnector( @@ -76,7 +75,6 @@ func setupSuite(t *testing.T, g got.G) PeerFlowE2ETestSuiteSF { require.NoError(t, err) suite := PeerFlowE2ETestSuiteSF{ - G: g, t: t, pgSuffix: pgSuffix, pool: pool, @@ -92,14 +90,14 @@ func (s PeerFlowE2ETestSuiteSF) TearDownSuite() { err := e2e.TearDownPostgres(s.pool, s.pgSuffix) if err != nil { slog.Error("failed to tear down Postgres", slog.Any("error", err)) - s.FailNow() + s.t.FailNow() } if s.sfHelper != nil { err = s.sfHelper.Cleanup() if err != nil { slog.Error("failed to tear down Snowflake", slog.Any("error", err)) - s.FailNow() + s.t.FailNow() } } @@ -107,7 +105,7 @@ func (s PeerFlowE2ETestSuiteSF) TearDownSuite() { if err != nil { slog.Error("failed to close Snowflake connector", slog.Any("error", err)) - s.FailNow() + s.t.FailNow() } } @@ -169,7 +167,7 @@ func (s PeerFlowE2ETestSuiteSF) Test_Complete_Simple_Flow_SF() { count, err := s.sfHelper.CountRows("test_simple_flow_sf") require.NoError(s.t, err) - s.Equal(20, count) + require.Equal(s.t, 20, count) // check the number of rows where _PEERDB_SYNCED_AT is newer than 5 mins ago // it should match the count. @@ -178,7 +176,7 @@ func (s PeerFlowE2ETestSuiteSF) Test_Complete_Simple_Flow_SF() { `, dstTableName) numNewRows, err := s.sfHelper.RunIntQuery(newerSyncedAtQuery) require.NoError(s.t, err) - s.Equal(20, numNewRows) + require.Equal(s.t, 20, numNewRows) // TODO: verify that the data is correctly synced to the destination table // on the Snowflake side @@ -247,7 +245,7 @@ func (s PeerFlowE2ETestSuiteSF) Test_Flow_ReplicaIdentity_Index_No_Pkey() { count, err := s.sfHelper.CountRows("test_replica_identity_no_pkey") require.NoError(s.t, err) - s.Equal(20, count) + require.Equal(s.t, 20, count) env.AssertExpectations(s.t) } @@ -325,11 +323,11 @@ func (s PeerFlowE2ETestSuiteSF) Test_Invalid_Geo_SF_Avro_CDC() { // They should have been filtered out as null on destination lineCount, err := s.sfHelper.CountNonNullRows("test_invalid_geo_sf_avro_cdc", "line") require.NoError(s.t, err) - s.Equal(6, lineCount) + require.Equal(s.t, 6, lineCount) polyCount, err := s.sfHelper.CountNonNullRows("test_invalid_geo_sf_avro_cdc", "poly") require.NoError(s.t, err) - s.Equal(6, polyCount) + require.Equal(s.t, 6, polyCount) // TODO: verify that the data is correctly synced to the destination table // on the bigquery side @@ -452,7 +450,7 @@ func (s PeerFlowE2ETestSuiteSF) Test_Toast_Nochanges_SF() { if err != nil { slog.Error("Error executing transaction", slog.Any("error", err)) - s.FailNow() + s.t.FailNow() } wg.Done() @@ -752,7 +750,7 @@ func (s PeerFlowE2ETestSuiteSF) Test_Types_SF() { fmt.Println("error %w", err) } // Make sure that there are no nulls - s.Equal(noNulls, true) + require.Equal(s.t, noNulls, true) env.AssertExpectations(s.t) } @@ -810,8 +808,8 @@ func (s PeerFlowE2ETestSuiteSF) Test_Multi_Table_SF() { count2, err := s.sfHelper.CountRows("test2_sf") require.NoError(s.t, err) - s.Equal(1, count1) - s.Equal(1, count2) + require.Equal(s.t, 1, count1) + require.Equal(s.t, 1, count2) env.AssertExpectations(s.t) } @@ -871,7 +869,7 @@ func (s PeerFlowE2ETestSuiteSF) Test_Simple_Schema_Changes_SF() { TableIdentifiers: []string{dstTableName}, }) require.NoError(s.t, err) - s.Equal(expectedTableSchema, output.TableNameSchemaMapping[dstTableName]) + require.Equal(s.t, expectedTableSchema, output.TableNameSchemaMapping[dstTableName]) s.compareTableContentsSF("test_simple_schema_changes", "id,c1", false) // alter source table, add column c2 and insert another row. @@ -900,7 +898,7 @@ func (s PeerFlowE2ETestSuiteSF) Test_Simple_Schema_Changes_SF() { TableIdentifiers: []string{dstTableName}, }) require.NoError(s.t, err) - s.Equal(expectedTableSchema, output.TableNameSchemaMapping[dstTableName]) + require.Equal(s.t, expectedTableSchema, output.TableNameSchemaMapping[dstTableName]) s.compareTableContentsSF("test_simple_schema_changes", "id,c1,c2", false) // alter source table, add column c3, drop column c2 and insert another row. @@ -930,7 +928,7 @@ func (s PeerFlowE2ETestSuiteSF) Test_Simple_Schema_Changes_SF() { TableIdentifiers: []string{dstTableName}, }) require.NoError(s.t, err) - s.Equal(expectedTableSchema, output.TableNameSchemaMapping[dstTableName]) + require.Equal(s.t, expectedTableSchema, output.TableNameSchemaMapping[dstTableName]) s.compareTableContentsSF("test_simple_schema_changes", "id,c1,c3", false) // alter source table, drop column c3 and insert another row. @@ -960,7 +958,7 @@ func (s PeerFlowE2ETestSuiteSF) Test_Simple_Schema_Changes_SF() { TableIdentifiers: []string{dstTableName}, }) require.NoError(s.t, err) - s.Equal(expectedTableSchema, output.TableNameSchemaMapping[dstTableName]) + require.Equal(s.t, expectedTableSchema, output.TableNameSchemaMapping[dstTableName]) s.compareTableContentsSF("test_simple_schema_changes", "id,c1", false) }() @@ -1276,8 +1274,8 @@ func (s PeerFlowE2ETestSuiteSF) Test_Column_Exclusion() { for _, field := range sfRows.Schema.Fields { require.NotEqual(s.t, field.Name, "c2") } - s.Equal(5, len(sfRows.Schema.Fields)) - s.Equal(10, len(sfRows.Records)) + require.Equal(s.t, 5, len(sfRows.Schema.Fields)) + require.Equal(s.t, 10, len(sfRows.Records)) } func (s PeerFlowE2ETestSuiteSF) Test_Soft_Delete_Basic() { @@ -1447,7 +1445,7 @@ func (s PeerFlowE2ETestSuiteSF) Test_Soft_Delete_IUD_Same_Batch() { SELECT COUNT(*) FROM %s WHERE _PEERDB_IS_DELETED = TRUE`, dstTableName) numNewRows, err := s.sfHelper.RunIntQuery(newerSyncedAtQuery) require.NoError(s.t, err) - s.Equal(1, numNewRows) + require.Equal(s.t, 1, numNewRows) } func (s PeerFlowE2ETestSuiteSF) Test_Soft_Delete_UD_Same_Batch() { @@ -1534,7 +1532,7 @@ func (s PeerFlowE2ETestSuiteSF) Test_Soft_Delete_UD_Same_Batch() { SELECT COUNT(*) FROM %s WHERE _PEERDB_IS_DELETED = TRUE`, dstTableName) numNewRows, err := s.sfHelper.RunIntQuery(newerSyncedAtQuery) require.NoError(s.t, err) - s.Equal(1, numNewRows) + require.Equal(s.t, 1, numNewRows) } func (s PeerFlowE2ETestSuiteSF) Test_Soft_Delete_Insert_After_Delete() { @@ -1609,5 +1607,5 @@ func (s PeerFlowE2ETestSuiteSF) Test_Soft_Delete_Insert_After_Delete() { SELECT COUNT(*) FROM %s WHERE _PEERDB_IS_DELETED = TRUE`, dstTableName) numNewRows, err := s.sfHelper.RunIntQuery(newerSyncedAtQuery) require.NoError(s.t, err) - s.Equal(0, numNewRows) + require.Equal(s.t, 0, numNewRows) } diff --git a/flow/e2e/snowflake/snowflake_schema_delta_test.go b/flow/e2e/snowflake/snowflake_schema_delta_test.go index 2c38f63cf5..68e64651c1 100644 --- a/flow/e2e/snowflake/snowflake_schema_delta_test.go +++ b/flow/e2e/snowflake/snowflake_schema_delta_test.go @@ -10,30 +10,20 @@ import ( "github.com/PeerDB-io/peer-flow/e2eshared" "github.com/PeerDB-io/peer-flow/generated/protos" "github.com/PeerDB-io/peer-flow/model/qvalue" + "github.com/stretchr/testify/require" "github.com/ysmood/got" ) const schemaDeltaTestSchemaName = "PUBLIC" type SnowflakeSchemaDeltaTestSuite struct { - got.G t *testing.T connector *connsnowflake.SnowflakeConnector sfTestHelper *SnowflakeTestHelper } -func (suite SnowflakeSchemaDeltaTestSuite) failTestError(err error) { - if err != nil { - slog.Error("Error in test", slog.Any("error", err)) - suite.FailNow() - } -} - -func setupSchemaDeltaSuite( - t *testing.T, - g got.G, -) SnowflakeSchemaDeltaTestSuite { +func setupSchemaDeltaSuite(t *testing.T) SnowflakeSchemaDeltaTestSuite { sfTestHelper, err := NewSnowflakeTestHelper() if err != nil { slog.Error("Error in test", slog.Any("error", err)) @@ -50,7 +40,6 @@ func setupSchemaDeltaSuite( } return SnowflakeSchemaDeltaTestSuite{ - G: g, t: t, connector: connector, sfTestHelper: sfTestHelper, @@ -59,15 +48,15 @@ func setupSchemaDeltaSuite( func (suite SnowflakeSchemaDeltaTestSuite) TearDownSuite() { err := suite.sfTestHelper.Cleanup() - suite.failTestError(err) + require.NoError(suite.t, err) err = suite.connector.Close() - suite.failTestError(err) + require.NoError(suite.t, err) } func (suite SnowflakeSchemaDeltaTestSuite) TestSimpleAddColumn() { tableName := fmt.Sprintf("%s.SIMPLE_ADD_COLUMN", schemaDeltaTestSchemaName) err := suite.sfTestHelper.RunCommand(fmt.Sprintf("CREATE TABLE %s(ID TEXT PRIMARY KEY)", tableName)) - suite.failTestError(err) + require.NoError(suite.t, err) err = suite.connector.ReplayTableSchemaDeltas("schema_delta_flow", []*protos.TableSchemaDelta{{ SrcTableName: tableName, @@ -77,13 +66,13 @@ func (suite SnowflakeSchemaDeltaTestSuite) TestSimpleAddColumn() { ColumnType: string(qvalue.QValueKindJSON), }}, }}) - suite.failTestError(err) + require.NoError(suite.t, err) output, err := suite.connector.GetTableSchema(&protos.GetTableSchemaBatchInput{ TableIdentifiers: []string{tableName}, }) - suite.failTestError(err) - suite.Equal(&protos.TableSchema{ + require.NoError(suite.t, err) + require.Equal(suite.t, &protos.TableSchema{ TableIdentifier: tableName, Columns: map[string]string{ "ID": string(qvalue.QValueKindString), @@ -95,7 +84,7 @@ func (suite SnowflakeSchemaDeltaTestSuite) TestSimpleAddColumn() { func (suite SnowflakeSchemaDeltaTestSuite) TestAddAllColumnTypes() { tableName := fmt.Sprintf("%s.ADD_DROP_ALL_COLUMN_TYPES", schemaDeltaTestSchemaName) err := suite.sfTestHelper.RunCommand(fmt.Sprintf("CREATE TABLE %s(ID TEXT PRIMARY KEY)", tableName)) - suite.failTestError(err) + require.NoError(suite.t, err) expectedTableSchema := &protos.TableSchema{ TableIdentifier: tableName, @@ -129,19 +118,19 @@ func (suite SnowflakeSchemaDeltaTestSuite) TestAddAllColumnTypes() { DstTableName: tableName, AddedColumns: addedColumns, }}) - suite.failTestError(err) + require.NoError(suite.t, err) output, err := suite.connector.GetTableSchema(&protos.GetTableSchemaBatchInput{ TableIdentifiers: []string{tableName}, }) - suite.failTestError(err) - suite.Equal(expectedTableSchema, output.TableNameSchemaMapping[tableName]) + require.NoError(suite.t, err) + require.Equal(suite.t, expectedTableSchema, output.TableNameSchemaMapping[tableName]) } func (suite SnowflakeSchemaDeltaTestSuite) TestAddTrickyColumnNames() { tableName := fmt.Sprintf("%s.ADD_DROP_TRICKY_COLUMN_NAMES", schemaDeltaTestSchemaName) err := suite.sfTestHelper.RunCommand(fmt.Sprintf("CREATE TABLE %s(id TEXT PRIMARY KEY)", tableName)) - suite.failTestError(err) + require.NoError(suite.t, err) expectedTableSchema := &protos.TableSchema{ TableIdentifier: tableName, @@ -173,19 +162,19 @@ func (suite SnowflakeSchemaDeltaTestSuite) TestAddTrickyColumnNames() { DstTableName: tableName, AddedColumns: addedColumns, }}) - suite.failTestError(err) + require.NoError(suite.t, err) output, err := suite.connector.GetTableSchema(&protos.GetTableSchemaBatchInput{ TableIdentifiers: []string{tableName}, }) - suite.failTestError(err) - suite.Equal(expectedTableSchema, output.TableNameSchemaMapping[tableName]) + require.NoError(suite.t, err) + require.Equal(suite.t, expectedTableSchema, output.TableNameSchemaMapping[tableName]) } func (suite SnowflakeSchemaDeltaTestSuite) TestAddWhitespaceColumnNames() { tableName := fmt.Sprintf("%s.ADD_DROP_WHITESPACE_COLUMN_NAMES", schemaDeltaTestSchemaName) err := suite.sfTestHelper.RunCommand(fmt.Sprintf("CREATE TABLE %s(\" \" TEXT PRIMARY KEY)", tableName)) - suite.failTestError(err) + require.NoError(suite.t, err) expectedTableSchema := &protos.TableSchema{ TableIdentifier: tableName, @@ -211,13 +200,13 @@ func (suite SnowflakeSchemaDeltaTestSuite) TestAddWhitespaceColumnNames() { DstTableName: tableName, AddedColumns: addedColumns, }}) - suite.failTestError(err) + require.NoError(suite.t, err) output, err := suite.connector.GetTableSchema(&protos.GetTableSchemaBatchInput{ TableIdentifiers: []string{tableName}, }) - suite.failTestError(err) - suite.Equal(expectedTableSchema, output.TableNameSchemaMapping[tableName]) + require.NoError(suite.t, err) + require.Equal(suite.t, expectedTableSchema, output.TableNameSchemaMapping[tableName]) } func TestSnowflakeSchemaDeltaTestSuite(t *testing.T) { diff --git a/flow/e2e/sqlserver/qrep_flow_sqlserver_test.go b/flow/e2e/sqlserver/qrep_flow_sqlserver_test.go index b10ced83eb..248c3dff1e 100644 --- a/flow/e2e/sqlserver/qrep_flow_sqlserver_test.go +++ b/flow/e2e/sqlserver/qrep_flow_sqlserver_test.go @@ -24,7 +24,6 @@ import ( ) type PeerFlowE2ETestSuiteSQLServer struct { - got.G t *testing.T pool *pgxpool.Pool @@ -48,7 +47,7 @@ func setupSQLServer(t *testing.T) *SQLServerHelper { return sqlsHelper } -func setupSuite(t *testing.T, g got.G) PeerFlowE2ETestSuiteSQLServer { +func setupSuite(t *testing.T) PeerFlowE2ETestSuiteSQLServer { err := godotenv.Load() if err != nil { // it's okay if the .env file is not present @@ -63,7 +62,6 @@ func setupSuite(t *testing.T, g got.G) PeerFlowE2ETestSuiteSQLServer { } return PeerFlowE2ETestSuiteSQLServer{ - G: g, t: t, pool: pool, sqlsHelper: setupSQLServer(t), diff --git a/flow/e2eshared/e2eshared.go b/flow/e2eshared/e2eshared.go index e68b6164a6..7dd7b2239c 100644 --- a/flow/e2eshared/e2eshared.go +++ b/flow/e2eshared/e2eshared.go @@ -5,20 +5,14 @@ import ( "io" "os" "testing" - - "github.com/ysmood/got" ) -func GotSuite[T interface{ TearDownSuite() }](setup func(t *testing.T, g got.G) T) func(t *testing.T) T { +func GotSuite[T interface{ TearDownSuite() }](setup func(t *testing.T) T) func(t *testing.T) T { return func(t *testing.T) T { - g := got.New(t) - g.Parallel() - - suite := setup(t, g) - g.Cleanup(func() { + suite := setup(t) + t.Cleanup(func() { suite.TearDownSuite() }) - return suite } }