Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Dec 29, 2023
1 parent 7da08c4 commit 0dda6b9
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 110 deletions.
74 changes: 37 additions & 37 deletions flow/connectors/postgres/postgres_schema_delta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ func (suite *PostgresSchemaDeltaTestSuite) TestSimpleAddColumn() {
suite.failTestError(err)
suite.Equal(&protos.TableSchema{
TableIdentifier: tableName,
Columns: map[string]string{
"id": string(qvalue.QValueKindInt32),
"hi": string(qvalue.QValueKindInt64),
ColumnNameType: []string{
"id", string(qvalue.QValueKindInt32),
"hi", string(qvalue.QValueKindInt64),
},
PrimaryKeyColumns: []string{"id"},
}, output.TableNameSchemaMapping[tableName])
Expand All @@ -113,24 +113,24 @@ func (suite *PostgresSchemaDeltaTestSuite) TestAddAllColumnTypes() {
expectedTableSchema := &protos.TableSchema{
TableIdentifier: tableName,
// goal is to test all types we're currently mapping to, not all QValue types
Columns: map[string]string{
"id": string(qvalue.QValueKindInt32),
"c1": string(qvalue.QValueKindBit),
"c2": string(qvalue.QValueKindBoolean),
"c3": string(qvalue.QValueKindBytes),
"c4": string(qvalue.QValueKindDate),
"c5": string(qvalue.QValueKindFloat32),
"c6": string(qvalue.QValueKindFloat64),
"c7": string(qvalue.QValueKindInt16),
"c8": string(qvalue.QValueKindInt32),
"c9": string(qvalue.QValueKindInt64),
"c10": string(qvalue.QValueKindJSON),
"c11": string(qvalue.QValueKindNumeric),
"c12": string(qvalue.QValueKindString),
"c13": string(qvalue.QValueKindTime),
"c14": string(qvalue.QValueKindTimestamp),
"c15": string(qvalue.QValueKindTimestampTZ),
"c16": string(qvalue.QValueKindUUID),
ColumnNameType: []string{
"id", string(qvalue.QValueKindInt32),
"c1", string(qvalue.QValueKindBit),
"c2", string(qvalue.QValueKindBoolean),
"c3", string(qvalue.QValueKindBytes),
"c4", string(qvalue.QValueKindDate),
"c5", string(qvalue.QValueKindFloat32),
"c6", string(qvalue.QValueKindFloat64),
"c7", string(qvalue.QValueKindInt16),
"c8", string(qvalue.QValueKindInt32),
"c9", string(qvalue.QValueKindInt64),
"c10", string(qvalue.QValueKindJSON),
"c11", string(qvalue.QValueKindNumeric),
"c12", string(qvalue.QValueKindString),
"c13", string(qvalue.QValueKindTime),
"c14", string(qvalue.QValueKindTimestamp),
"c15", string(qvalue.QValueKindTimestampTZ),
"c16", string(qvalue.QValueKindUUID),
},
PrimaryKeyColumns: []string{"id"},
}
Expand Down Expand Up @@ -166,17 +166,17 @@ func (suite *PostgresSchemaDeltaTestSuite) TestAddTrickyColumnNames() {

expectedTableSchema := &protos.TableSchema{
TableIdentifier: tableName,
Columns: map[string]string{
"id": string(qvalue.QValueKindInt32),
"c1": string(qvalue.QValueKindString),
"C1": string(qvalue.QValueKindString),
"C 1": string(qvalue.QValueKindString),
"right": string(qvalue.QValueKindString),
"select": string(qvalue.QValueKindString),
"XMIN": string(qvalue.QValueKindString),
"Cariño": string(qvalue.QValueKindString),
"±ªþ³§": string(qvalue.QValueKindString),
"カラム": string(qvalue.QValueKindString),
ColumnNameType: []string{
"id", string(qvalue.QValueKindInt32),
"c1", string(qvalue.QValueKindString),
"C1", string(qvalue.QValueKindString),
"C 1", string(qvalue.QValueKindString),
"right", string(qvalue.QValueKindString),
"select", string(qvalue.QValueKindString),
"XMIN", string(qvalue.QValueKindString),
"Cariño", string(qvalue.QValueKindString),
"±ªþ³§", string(qvalue.QValueKindString),
"カラム", string(qvalue.QValueKindString),
},
PrimaryKeyColumns: []string{"id"},
}
Expand Down Expand Up @@ -212,11 +212,11 @@ func (suite *PostgresSchemaDeltaTestSuite) TestAddDropWhitespaceColumnNames() {

expectedTableSchema := &protos.TableSchema{
TableIdentifier: tableName,
Columns: map[string]string{
" ": string(qvalue.QValueKindInt32),
" ": string(qvalue.QValueKindString),
" ": string(qvalue.QValueKindInt64),
" ": string(qvalue.QValueKindDate),
ColumnNameType: []string{
" ", string(qvalue.QValueKindInt32),
" ", string(qvalue.QValueKindString),
" ", string(qvalue.QValueKindInt64),
" ", string(qvalue.QValueKindDate),
},
PrimaryKeyColumns: []string{" "},
}
Expand Down
34 changes: 17 additions & 17 deletions flow/e2e/postgres/peer_flow_pg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ func (s *PeerFlowE2ETestSuitePG) Test_Simple_Schema_Changes_PG() {
e2e.NormalizeFlowCountQuery(env, connectionGen, 2)
expectedTableSchema := &protos.TableSchema{
TableIdentifier: dstTableName,
Columns: map[string]string{
"id": string(qvalue.QValueKindInt64),
"c1": string(qvalue.QValueKindInt64),
ColumnNameType: []string{
"id", string(qvalue.QValueKindInt64),
"c1", string(qvalue.QValueKindInt64),
},
PrimaryKeyColumns: []string{"id"},
}
Expand All @@ -175,10 +175,10 @@ func (s *PeerFlowE2ETestSuitePG) Test_Simple_Schema_Changes_PG() {
e2e.NormalizeFlowCountQuery(env, connectionGen, 4)
expectedTableSchema = &protos.TableSchema{
TableIdentifier: dstTableName,
Columns: map[string]string{
"id": string(qvalue.QValueKindInt64),
"c1": string(qvalue.QValueKindInt64),
"c2": string(qvalue.QValueKindInt64),
ColumnNameType: []string{
"id", string(qvalue.QValueKindInt64),
"c1", string(qvalue.QValueKindInt64),
"c2", string(qvalue.QValueKindInt64),
},
PrimaryKeyColumns: []string{"id"},
}
Expand All @@ -204,11 +204,11 @@ func (s *PeerFlowE2ETestSuitePG) Test_Simple_Schema_Changes_PG() {
e2e.NormalizeFlowCountQuery(env, connectionGen, 6)
expectedTableSchema = &protos.TableSchema{
TableIdentifier: dstTableName,
Columns: map[string]string{
"id": string(qvalue.QValueKindInt64),
"c1": string(qvalue.QValueKindInt64),
"c2": string(qvalue.QValueKindInt64),
"c3": string(qvalue.QValueKindInt64),
ColumnNameType: []string{
"id", string(qvalue.QValueKindInt64),
"c1", string(qvalue.QValueKindInt64),
"c2", string(qvalue.QValueKindInt64),
"c3", string(qvalue.QValueKindInt64),
},
PrimaryKeyColumns: []string{"id"},
}
Expand All @@ -234,11 +234,11 @@ func (s *PeerFlowE2ETestSuitePG) Test_Simple_Schema_Changes_PG() {
e2e.NormalizeFlowCountQuery(env, connectionGen, 8)
expectedTableSchema = &protos.TableSchema{
TableIdentifier: dstTableName,
Columns: map[string]string{
"id": string(qvalue.QValueKindInt64),
"c1": string(qvalue.QValueKindInt64),
"c2": string(qvalue.QValueKindInt64),
"c3": string(qvalue.QValueKindInt64),
ColumnNameType: []string{
"id", string(qvalue.QValueKindInt64),
"c1", string(qvalue.QValueKindInt64),
"c2", string(qvalue.QValueKindInt64),
"c3", string(qvalue.QValueKindInt64),
},
PrimaryKeyColumns: []string{"id"},
}
Expand Down
52 changes: 26 additions & 26 deletions flow/e2e/snowflake/peer_flow_sf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,11 +858,11 @@ func (s PeerFlowE2ETestSuiteSF) Test_Simple_Schema_Changes_SF() {
e2e.NormalizeFlowCountQuery(env, connectionGen, 2)
expectedTableSchema := &protos.TableSchema{
TableIdentifier: strings.ToUpper(dstTableName),
Columns: map[string]string{
"ID": string(qvalue.QValueKindNumeric),
"C1": string(qvalue.QValueKindNumeric),
"_PEERDB_IS_DELETED": string(qvalue.QValueKindBoolean),
"_PEERDB_SYNCED_AT": string(qvalue.QValueKindTimestamp),
ColumnNameType: []string{
"ID", string(qvalue.QValueKindNumeric),
"C1", string(qvalue.QValueKindNumeric),
"_PEERDB_IS_DELETED", string(qvalue.QValueKindBoolean),
"_PEERDB_SYNCED_AT", string(qvalue.QValueKindTimestamp),
},
}
output, err := s.connector.GetTableSchema(&protos.GetTableSchemaBatchInput{
Expand All @@ -886,12 +886,12 @@ func (s PeerFlowE2ETestSuiteSF) Test_Simple_Schema_Changes_SF() {
e2e.NormalizeFlowCountQuery(env, connectionGen, 4)
expectedTableSchema = &protos.TableSchema{
TableIdentifier: strings.ToUpper(dstTableName),
Columns: map[string]string{
"ID": string(qvalue.QValueKindNumeric),
"C1": string(qvalue.QValueKindNumeric),
"C2": string(qvalue.QValueKindNumeric),
"_PEERDB_IS_DELETED": string(qvalue.QValueKindBoolean),
"_PEERDB_SYNCED_AT": string(qvalue.QValueKindTimestamp),
ColumnNameType: []string{
"ID", string(qvalue.QValueKindNumeric),
"C1", string(qvalue.QValueKindNumeric),
"C2", string(qvalue.QValueKindNumeric),
"_PEERDB_IS_DELETED", string(qvalue.QValueKindBoolean),
"_PEERDB_SYNCED_AT", string(qvalue.QValueKindTimestamp),
},
}
output, err = s.connector.GetTableSchema(&protos.GetTableSchemaBatchInput{
Expand All @@ -915,13 +915,13 @@ func (s PeerFlowE2ETestSuiteSF) Test_Simple_Schema_Changes_SF() {
e2e.NormalizeFlowCountQuery(env, connectionGen, 6)
expectedTableSchema = &protos.TableSchema{
TableIdentifier: strings.ToUpper(dstTableName),
Columns: map[string]string{
"ID": string(qvalue.QValueKindNumeric),
"C1": string(qvalue.QValueKindNumeric),
"C2": string(qvalue.QValueKindNumeric),
"C3": string(qvalue.QValueKindNumeric),
"_PEERDB_IS_DELETED": string(qvalue.QValueKindBoolean),
"_PEERDB_SYNCED_AT": string(qvalue.QValueKindTimestamp),
ColumnNameType: []string{
"ID", string(qvalue.QValueKindNumeric),
"C1", string(qvalue.QValueKindNumeric),
"C2", string(qvalue.QValueKindNumeric),
"C3", string(qvalue.QValueKindNumeric),
"_PEERDB_IS_DELETED", string(qvalue.QValueKindBoolean),
"_PEERDB_SYNCED_AT", string(qvalue.QValueKindTimestamp),
},
}
output, err = s.connector.GetTableSchema(&protos.GetTableSchemaBatchInput{
Expand All @@ -945,13 +945,13 @@ func (s PeerFlowE2ETestSuiteSF) Test_Simple_Schema_Changes_SF() {
e2e.NormalizeFlowCountQuery(env, connectionGen, 8)
expectedTableSchema = &protos.TableSchema{
TableIdentifier: strings.ToUpper(dstTableName),
Columns: map[string]string{
"ID": string(qvalue.QValueKindNumeric),
"C1": string(qvalue.QValueKindNumeric),
"C2": string(qvalue.QValueKindNumeric),
"C3": string(qvalue.QValueKindNumeric),
"_PEERDB_IS_DELETED": string(qvalue.QValueKindBoolean),
"_PEERDB_SYNCED_AT": string(qvalue.QValueKindTimestamp),
ColumnNameType: []string{
"ID", string(qvalue.QValueKindNumeric),
"C1", string(qvalue.QValueKindNumeric),
"C2", string(qvalue.QValueKindNumeric),
"C3", string(qvalue.QValueKindNumeric),
"_PEERDB_IS_DELETED", string(qvalue.QValueKindBoolean),
"_PEERDB_SYNCED_AT", string(qvalue.QValueKindTimestamp),
},
}
output, err = s.connector.GetTableSchema(&protos.GetTableSchemaBatchInput{
Expand Down Expand Up @@ -1655,7 +1655,7 @@ func (s PeerFlowE2ETestSuiteSF) Test_Supported_Mixed_Case_Table_SF() {
`, s.pgSuffix, "testMixedCase"), testKey, testValue)
require.NoError(s.t, err)
}
fmt.Println("Inserted 20 rows into the source table")
s.t.Log("Inserted 20 rows into the source table")
}()

env.ExecuteWorkflow(peerflow.CDCFlowWorkflowWithConfig, flowConnConfig, &limits, nil)
Expand Down
60 changes: 30 additions & 30 deletions flow/e2e/snowflake/snowflake_schema_delta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ func (suite SnowflakeSchemaDeltaTestSuite) TestSimpleAddColumn() {
suite.failTestError(err)
suite.Equal(&protos.TableSchema{
TableIdentifier: tableName,
Columns: map[string]string{
"ID": string(qvalue.QValueKindString),
"HI": string(qvalue.QValueKindJSON),
ColumnNameType: []string{
"ID", string(qvalue.QValueKindString),
"HI", string(qvalue.QValueKindJSON),
},
}, output.TableNameSchemaMapping[tableName])
}
Expand All @@ -96,18 +96,18 @@ func (suite SnowflakeSchemaDeltaTestSuite) TestAddAllColumnTypes() {
expectedTableSchema := &protos.TableSchema{
TableIdentifier: tableName,
// goal is to test all types we're currently mapping to, not all QValue types
Columns: map[string]string{
"ID": string(qvalue.QValueKindString),
"C1": string(qvalue.QValueKindBoolean),
"C2": string(qvalue.QValueKindBytes),
"C3": string(qvalue.QValueKindDate),
"C4": string(qvalue.QValueKindFloat64),
"C5": string(qvalue.QValueKindJSON),
"C6": string(qvalue.QValueKindNumeric),
"C7": string(qvalue.QValueKindString),
"C8": string(qvalue.QValueKindTime),
"C9": string(qvalue.QValueKindTimestamp),
"C10": string(qvalue.QValueKindTimestampTZ),
ColumnNameType: []string{
"ID", string(qvalue.QValueKindString),
"C1", string(qvalue.QValueKindBoolean),
"C2", string(qvalue.QValueKindBytes),
"C3", string(qvalue.QValueKindDate),
"C4", string(qvalue.QValueKindFloat64),
"C5", string(qvalue.QValueKindJSON),
"C6", string(qvalue.QValueKindNumeric),
"C7", string(qvalue.QValueKindString),
"C8", string(qvalue.QValueKindTime),
"C9", string(qvalue.QValueKindTimestamp),
"C10", string(qvalue.QValueKindTimestampTZ),
},
}
addedColumns := make([]*protos.DeltaAddedColumn, 0)
Expand Down Expand Up @@ -142,16 +142,16 @@ func (suite SnowflakeSchemaDeltaTestSuite) TestAddTrickyColumnNames() {
expectedTableSchema := &protos.TableSchema{
TableIdentifier: tableName,
// strings.ToUpper also does Unicode uppercasing :)
Columns: map[string]string{
"ID": string(qvalue.QValueKindString),
"C1": string(qvalue.QValueKindString),
"C 1": string(qvalue.QValueKindString),
"RIGHT": string(qvalue.QValueKindString),
"SELECT": string(qvalue.QValueKindString),
"XMIN": string(qvalue.QValueKindString),
"CARIÑO": string(qvalue.QValueKindString),
"±ªÞ³§": string(qvalue.QValueKindString),
"カラム": string(qvalue.QValueKindString),
ColumnNameType: []string{
"ID", string(qvalue.QValueKindString),
"C1", string(qvalue.QValueKindString),
"C 1", string(qvalue.QValueKindString),
"RIGHT", string(qvalue.QValueKindString),
"SELECT", string(qvalue.QValueKindString),
"XMIN", string(qvalue.QValueKindString),
"CARIÑO", string(qvalue.QValueKindString),
"±ªÞ³§", string(qvalue.QValueKindString),
"カラム", string(qvalue.QValueKindString),
},
}
addedColumns := make([]*protos.DeltaAddedColumn, 0)
Expand Down Expand Up @@ -185,11 +185,11 @@ func (suite SnowflakeSchemaDeltaTestSuite) TestAddWhitespaceColumnNames() {

expectedTableSchema := &protos.TableSchema{
TableIdentifier: tableName,
Columns: map[string]string{
" ": string(qvalue.QValueKindString),
" ": string(qvalue.QValueKindString),
" ": string(qvalue.QValueKindTime),
" ": string(qvalue.QValueKindDate),
ColumnNameType: []string{
" ", string(qvalue.QValueKindString),
" ", string(qvalue.QValueKindString),
" ", string(qvalue.QValueKindTime),
" ", string(qvalue.QValueKindDate),
},
}
addedColumns := make([]*protos.DeltaAddedColumn, 0)
Expand Down

0 comments on commit 0dda6b9

Please sign in to comment.