Skip to content

Commit

Permalink
More.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Nov 15, 2024
1 parent e49936f commit 3c40513
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 4 additions & 4 deletions lib/destination/ddl/ddl_bq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ func (d *DDLTestSuite) TestAlterTableAddColumnsSomeAlreadyExist() {
}

// Check all the columns, make sure it's correct. (length)
assert.Equal(d.T(), existingColsLen, len(d.bigQueryStore.GetConfigMap().TableConfigCache(tableID).Columns().GetColumns()), d.bigQueryStore.GetConfigMap().TableConfigCache(tableID).Columns())
assert.Len(d.T(), d.bigQueryStore.GetConfigMap().TableConfigCache(tableID).Columns().GetColumns(), existingColsLen)
// Check by iterating over the columns
for _, column := range d.bigQueryStore.GetConfigMap().TableConfigCache(tableID).Columns().GetColumns() {
for _, column := range d.bigQueryStore.GetConfigMap().TableConfigCache(tableID).GetColumns() {
existingCol, isOk := existingCols.GetColumn(column.Name())
assert.True(d.T(), isOk)
assert.Equal(d.T(), column.KindDetails, existingCol.KindDetails)
Expand Down Expand Up @@ -254,7 +254,7 @@ func (d *DDLTestSuite) TestAlterTableDropColumnsBigQuerySafety() {
}

assert.Equal(d.T(), 0, len(d.bigQueryStore.GetConfigMap().TableConfigCache(tableID).ReadOnlyColumnsToDelete()))
assert.Equal(d.T(), originalColumnLength, len(d.bigQueryStore.GetConfigMap().TableConfigCache(tableID).Columns().GetColumns()))
assert.Len(d.T(), d.bigQueryStore.GetConfigMap().TableConfigCache(tableID).Columns().GetColumns(), originalColumnLength)

// Now try to delete again and with an increased TS. It should now be all deleted.
for _, column := range cols.GetColumns() {
Expand All @@ -274,5 +274,5 @@ func (d *DDLTestSuite) TestAlterTableDropColumnsBigQuerySafety() {

// Columns still exist
assert.Equal(d.T(), 0, len(d.bigQueryStore.GetConfigMap().TableConfigCache(tableID).ReadOnlyColumnsToDelete()))
assert.Equal(d.T(), originalColumnLength, len(d.bigQueryStore.GetConfigMap().TableConfigCache(tableID).Columns().GetColumns()))
assert.Len(d.T(), d.bigQueryStore.GetConfigMap().TableConfigCache(tableID).Columns().GetColumns(), originalColumnLength)
}
6 changes: 2 additions & 4 deletions lib/destination/ddl/ddl_sflk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (d *DDLTestSuite) TestAlterTableAdd() {

// Check the table config
tableConfig := d.snowflakeStagesStore.GetConfigMap().TableConfigCache(tableID)
for _, column := range tableConfig.Columns().GetColumns() {
for _, column := range tableConfig.GetColumns() {
var found bool
for _, expCol := range cols {
if found = column.Name() == expCol.Name(); found {
Expand All @@ -113,9 +113,7 @@ func (d *DDLTestSuite) TestAlterTableAdd() {
}
}

assert.True(d.T(), found,
fmt.Sprintf("Col not found: %s, actual list: %v, expected list: %v",
column.Name(), tableConfig.Columns(), cols))
assert.True(d.T(), found, fmt.Sprintf("Col not found: %s, actual list: %v, expected list: %v", column.Name(), tableConfig.GetColumns(), cols))
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/destination/types/table_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestDwhTableConfig_ColumnsConcurrency(t *testing.T) {
go func(tableCfg *types.DwhTableConfig) {
defer wg.Done()
for j := 0; j < 100; j++ {
assert.Equal(t, 3, len(tableCfg.Columns().GetColumns()), tableCfg.Columns().GetColumns())
assert.Len(t, tableCfg.GetColumns(), 3)
kindDetails := typing.Integer
if (j % 2) == 0 {
kindDetails = typing.Array
Expand Down

0 comments on commit 3c40513

Please sign in to comment.