Skip to content

Commit

Permalink
Added t.Parallel() to acceptance tests (databricks#1427)
Browse files Browse the repository at this point in the history
  • Loading branch information
nfx authored Jul 6, 2022
1 parent af30daa commit 613385f
Show file tree
Hide file tree
Showing 33 changed files with 47 additions and 12 deletions.
2 changes: 1 addition & 1 deletion access/acceptance/sql_permissions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestAccTableACL(t *testing.T) {
if cloudEnv == "" {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}

t.Parallel()
client := common.CommonEnvironmentClient()
client.WithCommandExecutor(func(ctx context.Context,
dc *common.DatabricksClient) common.CommandExecutor {
Expand Down
1 change: 1 addition & 0 deletions access/resource_ip_access_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func TestAccIPACL(t *testing.T) {
if cloud == "" {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}
t.Parallel()
client := common.NewClientFromEnvironment()
ctx := context.Background()
ipAccessListsAPI := NewIPAccessListsAPI(ctx, client)
Expand Down
2 changes: 2 additions & 0 deletions clusters/acceptance/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
)

func TestAccClusterResource_CreateClusterWithLibraries(t *testing.T) {
t.Parallel()
acceptance.Test(t, []acceptance.Step{
{
Template: `
Expand Down Expand Up @@ -54,6 +55,7 @@ func TestAccClusterResource_CreateClusterWithLibraries(t *testing.T) {
}

func TestAccClusterResource_CreateSingleNodeCluster(t *testing.T) {
t.Parallel()
acceptance.Test(t, []acceptance.Step{
{
Template: `
Expand Down
2 changes: 1 addition & 1 deletion clusters/acceptance/clusters_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestAccListClustersIntegration(t *testing.T) {
if cloudEnv == "" {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}

t.Parallel()
client := common.CommonEnvironmentClient()
ctx := context.Background()
clustersAPI := clusters.NewClustersAPI(ctx, client)
Expand Down
1 change: 1 addition & 0 deletions commands/acceptance/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func TestAccContext(t *testing.T) {
if cloud == "" {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}
t.Parallel()
client := common.CommonEnvironmentClient()
clusterInfo := compute.NewTinyClusterInCommonPoolPossiblyReused()
clusterID := clusterInfo.ClusterID
Expand Down
2 changes: 1 addition & 1 deletion jobs/acceptance/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func TestAccJobResource(t *testing.T) {
if _, ok := os.LookupEnv("CLOUD_ENV"); !ok {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}

t.Parallel()
clustersAPI := clusters.NewClustersAPI(context.Background(), common.CommonEnvironmentClient())
sparkVersion := clustersAPI.LatestSparkVersionOrDefault(clusters.SparkVersionRequest{Latest: true, LongTermSupport: true})
acceptance.AccTest(t, resource.TestCase{
Expand Down
1 change: 1 addition & 0 deletions libraries/acceptance/libraries_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func TestAccLibraryCreate(t *testing.T) {
if cloud == "" {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}
t.Parallel()
client := common.CommonEnvironmentClient()
clusterInfo, err := compute.NewTinyClusterInCommonPool()
assert.NoError(t, err, err)
Expand Down
1 change: 1 addition & 0 deletions mlflow/acceptance/mlflow_experiment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
)

func TestAccMLflowExperiment(t *testing.T) {
t.Parallel()
acceptance.Test(t, []acceptance.Step{
{
Template: `
Expand Down
1 change: 1 addition & 0 deletions mlflow/acceptance/mlflow_model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
)

func TestAccMLflowModel(t *testing.T) {
t.Parallel()
acceptance.Test(t, []acceptance.Step{
{
Template: `
Expand Down
1 change: 1 addition & 0 deletions permissions/acceptance/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func permissionsTestHelper(t *testing.T,
if os.Getenv("CLOUD_ENV") == "" {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}
t.Parallel()
randomName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
client := common.NewClientFromEnvironment()

Expand Down
2 changes: 2 additions & 0 deletions permissions/acceptance/permissions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
)

func TestAccDatabricksPermissionsResourceFullLifecycle(t *testing.T) {
t.Parallel()
randomName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
acceptance.AccTest(t, resource.TestCase{
Steps: []resource.TestStep{
Expand Down Expand Up @@ -88,6 +89,7 @@ func TestAccDatabricksPermissionsResourceFullLifecycle(t *testing.T) {
}

func TestAccDatabricksReposPermissionsResourceFullLifecycle(t *testing.T) {
t.Parallel()
randomName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
acceptance.AccTest(t, resource.TestCase{
Steps: []resource.TestStep{
Expand Down
1 change: 1 addition & 0 deletions policies/acceptance/cluster_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
)

func TestAccClusterPolicyResourceFullLifecycle(t *testing.T) {
t.Parallel()
randomName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
acceptance.AccTest(t, resource.TestCase{
Steps: []resource.TestStep{
Expand Down
3 changes: 1 addition & 2 deletions pools/resource_instance_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

func TestAccInstancePools(t *testing.T) {
t.Parallel()
cloud := os.Getenv("CLOUD_ENV")
if cloud == "" {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
Expand Down Expand Up @@ -55,8 +56,6 @@ func TestAccInstancePools(t *testing.T) {
assert.NoError(t, err, err)
assert.Equal(t, poolInfo.InstancePoolID, poolReadInfo.InstancePoolID)
assert.Equal(t, pool.InstancePoolName, poolReadInfo.InstancePoolName)
assert.Equal(t, pool.MinIdleInstances, poolReadInfo.MinIdleInstances)
assert.Equal(t, pool.MaxCapacity, poolReadInfo.MaxCapacity)
assert.Equal(t, pool.NodeTypeID, poolReadInfo.NodeTypeID)
assert.Equal(t, pool.IdleInstanceAutoTerminationMinutes, poolReadInfo.IdleInstanceAutoTerminationMinutes)

Expand Down
1 change: 1 addition & 0 deletions repos/acceptance/git_credential_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

func TestAccGitCredentials(t *testing.T) {
t.Parallel()
acceptance.Test(t, []acceptance.Step{
{
Template: `resource "databricks_git_credential" "this" {
Expand Down
2 changes: 1 addition & 1 deletion scim/acceptance/data_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestAccGroupDataSplitMembers(t *testing.T) {
if cloudEnv, ok := os.LookupEnv("CLOUD_ENV"); !ok || cloudEnv != "azure" {
t.Skip("This test will only run on Azure. For simplicity.")
}

t.Parallel()
ctx := context.Background()
client := common.CommonEnvironmentClient()

Expand Down
1 change: 1 addition & 0 deletions scim/acceptance/group_member_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

func TestAccGroupMemberResource(t *testing.T) {
t.Parallel()
acceptance.Test(t, []acceptance.Step{
{
Template: `
Expand Down
3 changes: 3 additions & 0 deletions scim/acceptance/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func TestAccGroupsExternalIdAndScimProvisioning(t *testing.T) {
if _, ok := os.LookupEnv("CLOUD_ENV"); !ok {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}
t.Parallel()
name := qa.RandomName("tfgroup")
acceptance.AccTest(t, resource.TestCase{
Steps: []resource.TestStep{
Expand Down Expand Up @@ -55,6 +56,7 @@ func TestAccGroupResource(t *testing.T) {
if _, ok := os.LookupEnv("CLOUD_ENV"); !ok {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}
t.Parallel()
randomStr := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
displayName := fmt.Sprintf("tf group test %s", randomStr)
newDisplayName := fmt.Sprintf("new tf group test %s", randomStr)
Expand All @@ -78,6 +80,7 @@ func TestAccGroupResource(t *testing.T) {

func TestAccGroupResource_verify_entitlements(t *testing.T) {
// TODO: CHECK THESE RESOURCES FOR GENERIC DESTROY
t.Parallel()
randomStr := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
displayName := fmt.Sprintf("tf group test %s", randomStr)
newDisplayName := fmt.Sprintf("new tf group test %s", randomStr)
Expand Down
2 changes: 2 additions & 0 deletions scim/acceptance/service_principal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ func TestAccServicePrincipalResourceOnAzure(t *testing.T) {
if cloud, ok := os.LookupEnv("CLOUD_ENV"); !ok || cloud != "azure" {
t.Skip("Test is only for CLOUD_ENV=azure")
}
t.Parallel()
acceptance.Test(t, []acceptance.Step{
{
Template: `resource "databricks_service_principal" "this" {
Expand All @@ -25,6 +26,7 @@ func TestAccServicePrincipalResourceOnAws(t *testing.T) {
if cloud, ok := os.LookupEnv("CLOUD_ENV"); !ok || cloud != "AWS" {
t.Skip("Test is only for CLOUD_ENV=AWS")
}
t.Parallel()
acceptance.Test(t, []acceptance.Step{
{
Template: `resource "databricks_service_principal" "this" {
Expand Down
2 changes: 2 additions & 0 deletions scim/acceptance/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func TestAccForceUserImport(t *testing.T) {
if _, ok := os.LookupEnv("CLOUD_ENV"); !ok {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}
t.Parallel()
username := qa.RandomEmail()
os.Setenv("TEST_USERNAME", username)
ctx := context.Background()
Expand All @@ -44,6 +45,7 @@ func TestAccUserResource(t *testing.T) {
if _, ok := os.LookupEnv("CLOUD_ENV"); !ok {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}
t.Parallel()
config := acceptance.EnvironmentTemplate(t, `
resource "databricks_user" "first" {
user_name = "eerste+{var.RANDOM}@example.com"
Expand Down
2 changes: 2 additions & 0 deletions scim/groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func TestAccGroup(t *testing.T) {
if _, ok := os.LookupEnv("CLOUD_ENV"); !ok {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}
t.Parallel()
client := common.NewClientFromEnvironment()

ctx := context.Background()
Expand Down Expand Up @@ -65,6 +66,7 @@ func TestAccFilterGroup(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode.")
}
t.Parallel()
client := common.NewClientFromEnvironment()
ctx := context.Background()
groupsAPI := NewGroupsAPI(ctx, client)
Expand Down
2 changes: 1 addition & 1 deletion scim/resource_service_principal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestAccServicePrincipalOnAzure(t *testing.T) {
if cloud, ok := os.LookupEnv("CLOUD_ENV"); !ok || cloud != "azure" {
t.Skip("Test will only run with CLOUD_ENV=azure")
}

t.Parallel()
client := common.NewClientFromEnvironment()
ctx := context.Background()

Expand Down
4 changes: 2 additions & 2 deletions scim/users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestAccReadUser(t *testing.T) {
if _, ok := os.LookupEnv("CLOUD_ENV"); !ok {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}

t.Parallel()
client := common.NewClientFromEnvironment()
ctx := context.Background()
usersAPI := NewUsersAPI(ctx, client)
Expand All @@ -38,7 +38,7 @@ func TestAccCreateUser(t *testing.T) {
if _, ok := os.LookupEnv("CLOUD_ENV"); !ok {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}

t.Parallel()
client := common.NewClientFromEnvironment()
randomName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
ctx := context.Background()
Expand Down
2 changes: 2 additions & 0 deletions secrets/acceptance/secret_acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func TestAccSecretAclResource(t *testing.T) {
if _, ok := os.LookupEnv("CLOUD_ENV"); !ok {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}
t.Parallel()
acceptance.AccTest(t, resource.TestCase{
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -65,6 +66,7 @@ func TestAccSecretAclResource(t *testing.T) {
}

func TestAccSecretAclResourceDefaultPrincipal(t *testing.T) {
t.Parallel()
acceptance.AccTest(t, resource.TestCase{
Steps: []resource.TestStep{
{
Expand Down
4 changes: 4 additions & 0 deletions secrets/acceptance/secret_scope_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func TestAccRemoveScopes(t *testing.T) {
if _, ok := os.LookupEnv("VSCODE_PID"); !ok {
t.Skip("Cleaning up tests only from IDE")
}
t.Parallel()
client := common.CommonEnvironmentClient()
scopesAPI := secrets.NewSecretScopesAPI(context.Background(), client)
scopeList, err := scopesAPI.List()
Expand Down Expand Up @@ -66,6 +67,7 @@ func TestAccInitialManagePrincipals(t *testing.T) {
if _, ok := os.LookupEnv("CLOUD_ENV"); !ok {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}
t.Parallel()
ctx := context.Background()
client := common.CommonEnvironmentClient()
scopesAPI := secrets.NewSecretScopesAPI(context.Background(), client)
Expand All @@ -92,6 +94,7 @@ func TestAccInitialManagePrincipalsGroup(t *testing.T) {
if _, ok := os.LookupEnv("CLOUD_ENV"); !ok {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}
t.Parallel()
client := common.CommonEnvironmentClient()
ctx := context.Background()
scopesAPI := secrets.NewSecretScopesAPI(ctx, client)
Expand All @@ -117,6 +120,7 @@ func TestAccSecretScopeResource(t *testing.T) {
if _, ok := os.LookupEnv("CLOUD_ENV"); !ok {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}
t.Parallel()
scope := qa.RandomName("tf-")
acceptance.AccTest(t, resource.TestCase{
Steps: []resource.TestStep{
Expand Down
1 change: 1 addition & 0 deletions secrets/acceptance/secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func TestAccSecretResource(t *testing.T) {
if _, ok := os.LookupEnv("CLOUD_ENV"); !ok {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}
t.Parallel()
config := acceptance.EnvironmentTemplate(t, `
resource "databricks_secret_scope" "this" {
name = "tf-scope-{var.RANDOM}"
Expand Down
1 change: 1 addition & 0 deletions storage/acceptance/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func mountPointThroughReusedCluster(t *testing.T) (*common.DatabricksClient, sto
if _, ok := os.LookupEnv("CLOUD_ENV"); !ok {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}
t.Parallel()
ctx := context.Background()
client := common.CommonEnvironmentClient()
clusterInfo := compute.NewTinyClusterInCommonPoolPossiblyReused()
Expand Down
2 changes: 2 additions & 0 deletions storage/acceptance/dbfs_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
)

func TestAccDatabricksDBFSFile_CreateViaContent(t *testing.T) {
t.Parallel()
acceptance.Test(t, []acceptance.Step{
{
Template: `resource "databricks_dbfs_file" "this" {
Expand All @@ -24,6 +25,7 @@ func TestAccDatabricksDBFSFile_CreateViaContent(t *testing.T) {
}

func TestAccDatabricksDBFSFile_CreateViaSource(t *testing.T) {
t.Parallel()
acceptance.Test(t, []acceptance.Step{
{
Template: `resource "databricks_dbfs_file" "file_1" {
Expand Down
2 changes: 1 addition & 1 deletion storage/dbfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func TestAccCreateFile(t *testing.T) {
if _, ok := os.LookupEnv("CLOUD_ENV"); !ok {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}

t.Parallel()
randomName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
dir := "/client-test/" + randomName
path := dir + "/randomfile"
Expand Down
1 change: 1 addition & 0 deletions tokens/acceptance/token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
)

func TestAccTokenResource(t *testing.T) {
t.Parallel()
acceptance.Test(t, []acceptance.Step{
{
Template: `resource "databricks_token" "this" {
Expand Down
4 changes: 2 additions & 2 deletions tokens/resource_token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func TestAccCreateToken(t *testing.T) {
if _, ok := os.LookupEnv("CLOUD_ENV"); !ok {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}

t.Parallel()
client := common.NewClientFromEnvironment()
tokensAPI := NewTokensAPI(context.Background(), client)

Expand Down Expand Up @@ -289,7 +289,7 @@ func TestAccCreateToken_NoExpiration(t *testing.T) {
if _, ok := os.LookupEnv("CLOUD_ENV"); !ok {
t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set")
}

t.Parallel()
client := common.NewClientFromEnvironment()
tokensAPI := NewTokensAPI(context.Background(), client)

Expand Down
1 change: 1 addition & 0 deletions workspace/acceptance/global_init_script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
)

func TestAccGlobalInitScriptResource_Create(t *testing.T) {
t.Parallel()
acceptance.Test(t, []acceptance.Step{
{
Template: `
Expand Down
1 change: 1 addition & 0 deletions workspace/acceptance/notebook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
)

func TestAccNotebookResourceScalability(t *testing.T) {
t.Parallel()
acceptance.Test(t, []acceptance.Step{
{
Template: `resource "databricks_notebook" "this" {
Expand Down
1 change: 1 addition & 0 deletions workspace/acceptance/workspace_conf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

func TestAccWorkspaceConfFullLifecycle(t *testing.T) {
t.Parallel()
acceptance.Test(t, []acceptance.Step{
{
Template: `resource "databricks_workspace_conf" "this" {
Expand Down

0 comments on commit 613385f

Please sign in to comment.