Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
mgyucht committed Dec 11, 2024
1 parent 07a77bc commit c3ef933
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 45 deletions.
4 changes: 2 additions & 2 deletions internal/acceptance/budget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
26 changes: 13 additions & 13 deletions internal/acceptance/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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] {
Expand All @@ -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)
}
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down Expand Up @@ -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.
Expand All @@ -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")
}
}

Expand All @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/acceptance/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions internal/acceptance/model_serving_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion internal/acceptance/mws_workspaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 `
Expand Down
4 changes: 2 additions & 2 deletions internal/acceptance/permissions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
Expand Down Expand Up @@ -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" {
Expand Down
4 changes: 2 additions & 2 deletions internal/acceptance/service_principal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := `
Expand Down Expand Up @@ -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 := `
Expand Down
2 changes: 1 addition & 1 deletion internal/acceptance/sql_global_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
34 changes: 17 additions & 17 deletions internal/acceptance/sql_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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: `
Expand Down Expand Up @@ -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: `
Expand Down Expand Up @@ -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: `
Expand Down Expand Up @@ -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: `
Expand Down Expand Up @@ -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: `
Expand Down Expand Up @@ -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{
Expand All @@ -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()
Expand Down Expand Up @@ -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{
Expand All @@ -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{
Expand All @@ -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{
Expand All @@ -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()

Expand All @@ -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{
Expand All @@ -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{
Expand All @@ -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{
Expand All @@ -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{
Expand All @@ -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()
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion internal/acceptance/vector_search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit c3ef933

Please sign in to comment.