From c3ef93329be1a16237371234c8044b41f7e125c9 Mon Sep 17 00:00:00 2001 From: Miles Yucht Date: Wed, 11 Dec 2024 13:21:07 +0100 Subject: [PATCH] more --- internal/acceptance/budget_test.go | 4 +-- ...ta_mws_network_connectivity_config_test.go | 2 +- ...a_mws_network_connectivity_configs_test.go | 2 +- internal/acceptance/init.go | 26 +++++++------- internal/acceptance/job_test.go | 2 +- internal/acceptance/model_serving_test.go | 6 ++-- internal/acceptance/mws_workspaces_test.go | 2 +- internal/acceptance/permissions_test.go | 4 +-- internal/acceptance/service_principal_test.go | 4 +-- internal/acceptance/sql_global_config_test.go | 2 +- internal/acceptance/sql_table_test.go | 34 +++++++++---------- internal/acceptance/vector_search_test.go | 2 +- 12 files changed, 45 insertions(+), 45 deletions(-) diff --git a/internal/acceptance/budget_test.go b/internal/acceptance/budget_test.go index 3344e94aad..c139daa47f 100644 --- a/internal/acceptance/budget_test.go +++ b/internal/acceptance/budget_test.go @@ -43,7 +43,7 @@ var ( func TestMwsAccBudgetCreate(t *testing.T) { LoadAccountEnv(t) if IsGcp(t) { - skipf(t)("not available on GCP") + Skipf(t)("not available on GCP") } AccountLevel(t, Step{ Template: fmt.Sprintf(budgetTemplate, "840"), @@ -53,7 +53,7 @@ func TestMwsAccBudgetCreate(t *testing.T) { func TestMwsAccBudgetUpdate(t *testing.T) { LoadAccountEnv(t) if IsGcp(t) { - skipf(t)("not available on GCP") + Skipf(t)("not available on GCP") } AccountLevel(t, Step{ Template: fmt.Sprintf(budgetTemplate, "840"), diff --git a/internal/acceptance/data_mws_network_connectivity_config_test.go b/internal/acceptance/data_mws_network_connectivity_config_test.go index 7d7b423ec3..b76f9bee44 100755 --- a/internal/acceptance/data_mws_network_connectivity_config_test.go +++ b/internal/acceptance/data_mws_network_connectivity_config_test.go @@ -10,7 +10,7 @@ import ( func TestAccDataSourceMwsNetworkConnectivityConfigTest(t *testing.T) { LoadWorkspaceEnv(t) if IsGcp(t) { - skipf(t)("GCP not supported") + Skipf(t)("GCP not supported") } var sourceRegion string if IsAzure(t) { diff --git a/internal/acceptance/data_mws_network_connectivity_configs_test.go b/internal/acceptance/data_mws_network_connectivity_configs_test.go index 0ab5196435..ecf61dd807 100755 --- a/internal/acceptance/data_mws_network_connectivity_configs_test.go +++ b/internal/acceptance/data_mws_network_connectivity_configs_test.go @@ -10,7 +10,7 @@ import ( func TestAccDataSourceMwsNetworkConnectivityConfigsTest(t *testing.T) { LoadWorkspaceEnv(t) if IsGcp(t) { - skipf(t)("GCP not supported") + Skipf(t)("GCP not supported") } var region string if IsAzure(t) { diff --git a/internal/acceptance/init.go b/internal/acceptance/init.go index 9ecdd9d89a..4a869919cf 100644 --- a/internal/acceptance/init.go +++ b/internal/acceptance/init.go @@ -125,7 +125,7 @@ func environmentTemplate(t *testing.T, template string, otherVars ...map[string] "RANDOM_UUID": createUuid(), } if len(otherVars) > 1 { - skipf(t)("cannot have more than one custom variable map") + Skipf(t)("cannot have more than one custom variable map") } if len(otherVars) == 1 { for k, v := range otherVars[0] { @@ -147,14 +147,14 @@ func environmentTemplate(t *testing.T, template string, otherVars ...map[string] value = vars[varName] } if value == "" { - skipf(t)("Missing %s %s variable.", varType, varName) + Skipf(t)("Missing %s %s variable.", varType, varName) missing++ continue } template = strings.ReplaceAll(template, `{`+varType+`.`+varName+`}`, value) } if missing > 0 { - skipf(t)("please set %d variables and restart", missing) + Skipf(t)("please set %d variables and restart", missing) } return commands.TrimLeadingWhitespace(template) } @@ -291,7 +291,7 @@ const hexCharset = "0123456789abcdef" func GetEnvOrSkipTest(t *testing.T, name string) string { value := os.Getenv(name) if value == "" { - skipf(t)("Environment variable %s is missing", name) + Skipf(t)("Environment variable %s is missing", name) } return value } @@ -300,7 +300,7 @@ func GetEnvInt64OrSkipTest(t *testing.T, name string) int64 { v := GetEnvOrSkipTest(t, name) i, err := strconv.ParseInt(v, 10, 64) if err != nil { - skipf(t)("`%s` is not int64: %s", v, err) + Skipf(t)("`%s` is not int64: %s", v, err) } return i } @@ -338,7 +338,7 @@ func RandomHex(prefix string, randLen int) string { return string(b) } -func skipf(t *testing.T) func(format string, args ...any) { +func Skipf(t *testing.T) func(format string, args ...any) { if isInDebug() { // VSCode "debug test" feature doesn't show dlv logs, // so that we fail here for maintainer productivity. @@ -362,34 +362,34 @@ func setDebugLogger() { func LoadWorkspaceEnv(t *testing.T) { initTest(t, "workspace") if os.Getenv("DATABRICKS_ACCOUNT_ID") != "" { - skipf(t)("Skipping workspace test on account level") + Skipf(t)("Skipping workspace test on account level") } } func LoadAccountEnv(t *testing.T) { initTest(t, "account") if os.Getenv("DATABRICKS_ACCOUNT_ID") == "" { - skipf(t)("Skipping account test on workspace level") + Skipf(t)("Skipping account test on workspace level") } } func LoadUcwsEnv(t *testing.T) { initTest(t, "ucws") if os.Getenv("TEST_METASTORE_ID") == "" { - skipf(t)("Skipping non-Unity Catalog test") + Skipf(t)("Skipping non-Unity Catalog test") } if os.Getenv("DATABRICKS_ACCOUNT_ID") != "" { - skipf(t)("Skipping workspace test on account level") + Skipf(t)("Skipping workspace test on account level") } } func LoadUcacctEnv(t *testing.T) { initTest(t, "ucacct") if os.Getenv("TEST_METASTORE_ID") == "" { - skipf(t)("Skipping non-Unity Catalog test") + Skipf(t)("Skipping non-Unity Catalog test") } if os.Getenv("DATABRICKS_ACCOUNT_ID") == "" { - skipf(t)("Skipping account test on workspace level") + Skipf(t)("Skipping account test on workspace level") } } @@ -411,7 +411,7 @@ func IsGcp(t *testing.T) bool { func isCloudEnvInList(t *testing.T, cloudEnvs []string) bool { cloudEnv := os.Getenv("CLOUD_ENV") if cloudEnv == "" { - skipf(t)("Acceptance tests skipped unless env 'CLOUD_ENV' is set") + Skipf(t)("Acceptance tests skipped unless env 'CLOUD_ENV' is set") } return slices.Contains(cloudEnvs, cloudEnv) } diff --git a/internal/acceptance/job_test.go b/internal/acceptance/job_test.go index 10f918a30b..61aa41a8fc 100644 --- a/internal/acceptance/job_test.go +++ b/internal/acceptance/job_test.go @@ -396,7 +396,7 @@ func TestUcAccJobRunAsMutations(t *testing.T) { } func TestAccRemoveWebhooks(t *testing.T) { - skipf(t)("There is no API to create notification destinations. Once available, add here and enable this test.") + Skipf(t)("There is no API to create notification destinations. Once available, add here and enable this test.") WorkspaceLevel(t, Step{ Template: ` resource databricks_job test { diff --git a/internal/acceptance/model_serving_test.go b/internal/acceptance/model_serving_test.go index 73711667c9..a7c0887df1 100644 --- a/internal/acceptance/model_serving_test.go +++ b/internal/acceptance/model_serving_test.go @@ -10,7 +10,7 @@ import ( func TestAccModelServing(t *testing.T) { LoadWorkspaceEnv(t) if IsGcp(t) { - skipf(t)("not available on GCP") + Skipf(t)("not available on GCP") } name := fmt.Sprintf("terraform-test-model-serving-%s", @@ -88,7 +88,7 @@ func TestAccModelServing(t *testing.T) { func TestUcAccModelServingProvisionedThroughput(t *testing.T) { LoadWorkspaceEnv(t) if IsGcp(t) { - skipf(t)("not available on GCP") + Skipf(t)("not available on GCP") } name := fmt.Sprintf("terraform-test-model-serving-pt-%s", @@ -163,7 +163,7 @@ func TestUcAccModelServingProvisionedThroughput(t *testing.T) { func TestAccModelServingExternalModel(t *testing.T) { LoadWorkspaceEnv(t) if IsGcp(t) { - skipf(t)("not available on GCP") + Skipf(t)("not available on GCP") } name := fmt.Sprintf("terraform-test-model-serving-em-%s", diff --git a/internal/acceptance/mws_workspaces_test.go b/internal/acceptance/mws_workspaces_test.go index d13424bec5..e0ce44c72e 100644 --- a/internal/acceptance/mws_workspaces_test.go +++ b/internal/acceptance/mws_workspaces_test.go @@ -302,7 +302,7 @@ func TestMwsAccGcpPscWorkspaces(t *testing.T) { func TestMwsAccAwsChangeToServicePrincipal(t *testing.T) { if !IsAws(t) { - skipf(t)("TestMwsAccAwsChangeToServicePrincipal should only run on AWS") + Skipf(t)("TestMwsAccAwsChangeToServicePrincipal should only run on AWS") } workspaceTemplate := func(tokenBlock string) string { return ` diff --git a/internal/acceptance/permissions_test.go b/internal/acceptance/permissions_test.go index 6177716334..254a8a8a0b 100644 --- a/internal/acceptance/permissions_test.go +++ b/internal/acceptance/permissions_test.go @@ -583,7 +583,7 @@ func TestAccPermissions_Repo_Path(t *testing.T) { } func TestAccPermissions_Authorization_Passwords(t *testing.T) { - skipf(t)("ACLs for passwords are disabled on testing workspaces") + Skipf(t)("ACLs for passwords are disabled on testing workspaces") loadDebugEnvIfRunsFromIDE(t, "workspace") WorkspaceLevel(t, Step{ Template: makePermissionsTestStage("authorization", "\"passwords\"", groupPermissions("CAN_USE")), @@ -834,7 +834,7 @@ func TestAccPermissions_RegisteredModel_Root(t *testing.T) { func TestAccPermissions_ServingEndpoint(t *testing.T) { loadDebugEnvIfRunsFromIDE(t, "workspace") if IsGcp(t) { - skipf(t)("Serving endpoints are not supported on GCP") + Skipf(t)("Serving endpoints are not supported on GCP") } endpointTemplate := ` resource "databricks_model_serving" "endpoint" { diff --git a/internal/acceptance/service_principal_test.go b/internal/acceptance/service_principal_test.go index 44a9d22305..6bf750a838 100644 --- a/internal/acceptance/service_principal_test.go +++ b/internal/acceptance/service_principal_test.go @@ -24,7 +24,7 @@ const awsSpn = `resource "databricks_service_principal" "this" { func TestAccServicePrincipalHomeDeleteSuccess(t *testing.T) { LoadWorkspaceEnv(t) if !IsAzure(t) { - skipf(t)("Test only valid for Azure") + Skipf(t)("Test only valid for Azure") } uuid := createUuid() template := ` @@ -60,7 +60,7 @@ func TestAccServicePrincipalHomeDeleteSuccess(t *testing.T) { func TestAccServicePrinicpalHomeDeleteNotDeleted(t *testing.T) { LoadWorkspaceEnv(t) if !IsAzure(t) { - skipf(t)("Test only valid for Azure") + Skipf(t)("Test only valid for Azure") } uuid := createUuid() template := ` diff --git a/internal/acceptance/sql_global_config_test.go b/internal/acceptance/sql_global_config_test.go index e813547ca2..61d0b0b2f7 100644 --- a/internal/acceptance/sql_global_config_test.go +++ b/internal/acceptance/sql_global_config_test.go @@ -51,7 +51,7 @@ func TestAccSQLGlobalConfig(t *testing.T) { func TestAccSQLGlobalConfigServerless(t *testing.T) { LoadWorkspaceEnv(t) if IsGcp(t) { - skipf(t)("GCP does not support serverless compute") + Skipf(t)("GCP does not support serverless compute") } checkServerlessEnabled := func(enabled bool) func(state *terraform.State) error { diff --git a/internal/acceptance/sql_table_test.go b/internal/acceptance/sql_table_test.go index 6ba5a83714..1c7412a57c 100644 --- a/internal/acceptance/sql_table_test.go +++ b/internal/acceptance/sql_table_test.go @@ -12,7 +12,7 @@ import ( func TestUcAccResourceSqlTable_Managed(t *testing.T) { if os.Getenv("GOOGLE_CREDENTIALS") != "" { - skipf(t)("databricks_sql_table resource not available on GCP") + Skipf(t)("databricks_sql_table resource not available on GCP") } UnityWorkspaceLevel(t, Step{ Template: ` @@ -74,7 +74,7 @@ func TestUcAccResourceSqlTable_Managed(t *testing.T) { func TestUcAccResourceSqlTableWithIdentityColumn_Managed(t *testing.T) { if os.Getenv("GOOGLE_CREDENTIALS") != "" { - skipf(t)("databricks_sql_table resource not available on GCP") + Skipf(t)("databricks_sql_table resource not available on GCP") } UnityWorkspaceLevel(t, Step{ Template: ` @@ -175,7 +175,7 @@ func TestUcAccResourceSqlTable_External(t *testing.T) { func TestUcAccResourceSqlTable_View(t *testing.T) { if os.Getenv("GOOGLE_CREDENTIALS") != "" { - skipf(t)("databricks_sql_table resource not available on GCP") + Skipf(t)("databricks_sql_table resource not available on GCP") } UnityWorkspaceLevel(t, Step{ Template: ` @@ -226,7 +226,7 @@ func TestUcAccResourceSqlTable_View(t *testing.T) { func TestUcAccResourceSqlTable_WarehousePartition(t *testing.T) { if os.Getenv("GOOGLE_CREDENTIALS") != "" { - skipf(t)("databricks_sql_table resource not available on GCP") + Skipf(t)("databricks_sql_table resource not available on GCP") } UnityWorkspaceLevel(t, Step{ Template: ` @@ -277,7 +277,7 @@ func TestUcAccResourceSqlTable_WarehousePartition(t *testing.T) { } func TestUcAccResourceSqlTable_Liquid(t *testing.T) { if os.Getenv("GOOGLE_CREDENTIALS") != "" { - skipf(t)("databricks_sql_table resource not available on GCP") + Skipf(t)("databricks_sql_table resource not available on GCP") } UnityWorkspaceLevel(t, Step{ Template: ` @@ -381,7 +381,7 @@ var inlineAndMembershipChangeErrorRegex = regexp.MustCompile(inlineAndMembership func TestUcAccResourceSqlTable_RenameColumn(t *testing.T) { if os.Getenv("GOOGLE_CREDENTIALS") != "" { - skipf(t)("databricks_sql_table resource not available on GCP") + Skipf(t)("databricks_sql_table resource not available on GCP") } tableName := RandomName() UnityWorkspaceLevel(t, Step{ @@ -406,7 +406,7 @@ func constructManagedSqlTableTemplateWithColumnTypeUpdates(tableName string, col func TestUcAccResourceSqlTable_ColumnTypeSuppressDiff(t *testing.T) { if os.Getenv("GOOGLE_CREDENTIALS") != "" { - skipf(t)("databricks_sql_table resource not available on GCP") + Skipf(t)("databricks_sql_table resource not available on GCP") } tableName := RandomName() columnName := RandomName() @@ -448,7 +448,7 @@ func TestUcAccResourceSqlTable_ColumnTypeSuppressDiff(t *testing.T) { func TestUcAccResourceSqlTable_AddColumnComment(t *testing.T) { if os.Getenv("GOOGLE_CREDENTIALS") != "" { - skipf(t)("databricks_sql_table resource not available on GCP") + Skipf(t)("databricks_sql_table resource not available on GCP") } tableName := RandomName() UnityWorkspaceLevel(t, Step{ @@ -460,7 +460,7 @@ func TestUcAccResourceSqlTable_AddColumnComment(t *testing.T) { func TestUcAccResourceSqlTable_DropColumnNullable(t *testing.T) { if os.Getenv("GOOGLE_CREDENTIALS") != "" { - skipf(t)("databricks_sql_table resource not available on GCP") + Skipf(t)("databricks_sql_table resource not available on GCP") } tableName := RandomName() UnityWorkspaceLevel(t, Step{ @@ -472,7 +472,7 @@ func TestUcAccResourceSqlTable_DropColumnNullable(t *testing.T) { func TestUcAccResourceSqlTable_MultipleColumnUpdates(t *testing.T) { if os.Getenv("GOOGLE_CREDENTIALS") != "" { - skipf(t)("databricks_sql_table resource not available on GCP") + Skipf(t)("databricks_sql_table resource not available on GCP") } tableName := RandomName() UnityWorkspaceLevel(t, Step{ @@ -484,7 +484,7 @@ func TestUcAccResourceSqlTable_MultipleColumnUpdates(t *testing.T) { func TestUcAccResourceSqlTable_ChangeColumnTypeThrows(t *testing.T) { if os.Getenv("GOOGLE_CREDENTIALS") != "" { - skipf(t)("databricks_sql_table resource not available on GCP") + Skipf(t)("databricks_sql_table resource not available on GCP") } tableName := RandomName() @@ -498,7 +498,7 @@ func TestUcAccResourceSqlTable_ChangeColumnTypeThrows(t *testing.T) { func TestUcAccResourceSqlTable_DropColumn(t *testing.T) { if os.Getenv("GOOGLE_CREDENTIALS") != "" { - skipf(t)("databricks_sql_table resource not available on GCP") + Skipf(t)("databricks_sql_table resource not available on GCP") } tableName := RandomName() UnityWorkspaceLevel(t, Step{ @@ -513,7 +513,7 @@ func TestUcAccResourceSqlTable_DropColumn(t *testing.T) { func TestUcAccResourceSqlTable_DropMultipleColumns(t *testing.T) { if os.Getenv("GOOGLE_CREDENTIALS") != "" { - skipf(t)("databricks_sql_table resource not available on GCP") + Skipf(t)("databricks_sql_table resource not available on GCP") } tableName := RandomName() UnityWorkspaceLevel(t, Step{ @@ -529,7 +529,7 @@ func TestUcAccResourceSqlTable_DropMultipleColumns(t *testing.T) { func TestUcAccResourceSqlTable_AddColumn(t *testing.T) { if os.Getenv("GOOGLE_CREDENTIALS") != "" { - skipf(t)("databricks_sql_table resource not available on GCP") + Skipf(t)("databricks_sql_table resource not available on GCP") } tableName := RandomName() UnityWorkspaceLevel(t, Step{ @@ -544,7 +544,7 @@ func TestUcAccResourceSqlTable_AddColumn(t *testing.T) { func TestUcAccResourceSqlTable_AddMultipleColumns(t *testing.T) { if os.Getenv("GOOGLE_CREDENTIALS") != "" { - skipf(t)("databricks_sql_table resource not available on GCP") + Skipf(t)("databricks_sql_table resource not available on GCP") } tableName := RandomName() UnityWorkspaceLevel(t, Step{ @@ -560,7 +560,7 @@ func TestUcAccResourceSqlTable_AddMultipleColumns(t *testing.T) { func TestUcAccResourceSqlTable_AddColumnAndUpdateThrows(t *testing.T) { if os.Getenv("GOOGLE_CREDENTIALS") != "" { - skipf(t)("databricks_sql_table resource not available on GCP") + Skipf(t)("databricks_sql_table resource not available on GCP") } tableName := RandomName() @@ -577,7 +577,7 @@ func TestUcAccResourceSqlTable_AddColumnAndUpdateThrows(t *testing.T) { func TestUcAccResourceSqlTable_DropColumnAndUpdateThrows(t *testing.T) { if os.Getenv("GOOGLE_CREDENTIALS") != "" { - skipf(t)("databricks_sql_table resource not available on GCP") + Skipf(t)("databricks_sql_table resource not available on GCP") } tableName := RandomName() diff --git a/internal/acceptance/vector_search_test.go b/internal/acceptance/vector_search_test.go index 9e8712b6ad..1b09302a94 100644 --- a/internal/acceptance/vector_search_test.go +++ b/internal/acceptance/vector_search_test.go @@ -10,7 +10,7 @@ import ( func TestUcAccVectorSearchEndpoint(t *testing.T) { LoadUcwsEnv(t) if IsGcp(t) { - skipf(t)("not available on GCP") + Skipf(t)("not available on GCP") } name := fmt.Sprintf("terraform-test-vector-search-%[1]s",