From 3c4051345f722572b2fe68bd524a6116109ceb76 Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Thu, 14 Nov 2024 22:38:04 -0800 Subject: [PATCH] More. --- lib/destination/ddl/ddl_bq_test.go | 8 ++++---- lib/destination/ddl/ddl_sflk_test.go | 6 ++---- lib/destination/types/table_config_test.go | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/destination/ddl/ddl_bq_test.go b/lib/destination/ddl/ddl_bq_test.go index ba849a5f6..a4e42df18 100644 --- a/lib/destination/ddl/ddl_bq_test.go +++ b/lib/destination/ddl/ddl_bq_test.go @@ -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) @@ -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() { @@ -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) } diff --git a/lib/destination/ddl/ddl_sflk_test.go b/lib/destination/ddl/ddl_sflk_test.go index 142f7a76b..0bf3b1744 100644 --- a/lib/destination/ddl/ddl_sflk_test.go +++ b/lib/destination/ddl/ddl_sflk_test.go @@ -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 { @@ -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)) } } diff --git a/lib/destination/types/table_config_test.go b/lib/destination/types/table_config_test.go index 22ae066d5..01b9f2ec3 100644 --- a/lib/destination/types/table_config_test.go +++ b/lib/destination/types/table_config_test.go @@ -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