@@ -3,7 +3,6 @@ package resources_test
3
3
import (
4
4
"context"
5
5
"fmt"
6
- "strconv"
7
6
"strings"
8
7
9
8
"github.com/samber/lo"
@@ -26,10 +25,8 @@ func TestAcc_ResourceHybridClusterWorkspaceAuthorization(t *testing.T) {
26
25
27
26
workspaceName := fmt .Sprintf ("%v_workspace" , namePrefix )
28
27
workspaceResourceVar := fmt .Sprintf ("astro_workspace.%v" , workspaceName )
29
- hybridWorkspaceIdsStr := os .Getenv ("HYBRID_WORKSPACE_IDS" )
30
- hybridWorkspaceIds := strings .Split (hybridWorkspaceIdsStr , "," )
31
28
32
- clusterId := os .Getenv ("HYBRID_CLUSTER_ID " )
29
+ clusterId := os .Getenv ("HYBRID_DRY_RUN_CLUSTER_ID " )
33
30
clusterWorkspaceAuth := fmt .Sprintf ("%v_auth" , namePrefix )
34
31
resourceVar := fmt .Sprintf ("astro_hybrid_cluster_workspace_authorization.%v" , clusterWorkspaceAuth )
35
32
@@ -41,35 +38,19 @@ func TestAcc_ResourceHybridClusterWorkspaceAuthorization(t *testing.T) {
41
38
testAccCheckHybridClusterWorkspaceAuthorizationExistence (t , clusterWorkspaceAuth , false ),
42
39
),
43
40
Steps : []resource.TestStep {
44
- // Test with existing workspaces and one created through terraform
41
+ // Test with workspace created through terraform
45
42
{
46
43
Config : astronomerprovider .ProviderConfig (t , false ) +
47
44
workspace (workspaceName , workspaceName , utils .TestResourceDescription , false ) +
48
45
hybridClusterWorkspaceAuthorization (hybridClusterWorkspaceAuthorizationInput {
49
46
Name : clusterWorkspaceAuth ,
50
47
ClusterId : clusterId ,
51
- WorkspaceIds : append ( hybridWorkspaceIds , fmt .Sprintf ("%v.id" , workspaceResourceVar )) ,
48
+ WorkspaceIds : [] string { fmt .Sprintf ("%v.id" , workspaceResourceVar )} ,
52
49
}),
53
50
Check : resource .ComposeTestCheckFunc (
54
51
// Check hybrid cluster workspace authorization
55
52
resource .TestCheckResourceAttr (resourceVar , "cluster_id" , clusterId ),
56
- resource .TestCheckResourceAttr (resourceVar , "workspace_ids.#" , strconv .Itoa (len (hybridWorkspaceIds )+ 1 )),
57
-
58
- testAccCheckHybridClusterWorkspaceAuthorizationExistence (t , clusterWorkspaceAuth , true ),
59
- ),
60
- },
61
- // Remove terraform created workspace from cluster workspace authorization
62
- {
63
- Config : astronomerprovider .ProviderConfig (t , false ) +
64
- hybridClusterWorkspaceAuthorization (hybridClusterWorkspaceAuthorizationInput {
65
- Name : clusterWorkspaceAuth ,
66
- ClusterId : clusterId ,
67
- WorkspaceIds : hybridWorkspaceIds ,
68
- }),
69
- Check : resource .ComposeTestCheckFunc (
70
- // Check hybrid cluster workspace authorization
71
- resource .TestCheckResourceAttr (resourceVar , "cluster_id" , clusterId ),
72
- resource .TestCheckResourceAttr (resourceVar , "workspace_ids.#" , strconv .Itoa (len (hybridWorkspaceIds ))),
53
+ resource .TestCheckResourceAttr (resourceVar , "workspace_ids.#" , "1" ),
73
54
74
55
testAccCheckHybridClusterWorkspaceAuthorizationExistence (t , clusterWorkspaceAuth , true ),
75
56
),
@@ -133,7 +114,7 @@ func testAccCheckHybridClusterWorkspaceAuthorizationExistence(t *testing.T, name
133
114
assert .NoError (t , err )
134
115
135
116
organizationId := os .Getenv ("HYBRID_ORGANIZATION_ID" )
136
- clusterId := os .Getenv ("HYBRID_CLUSTER_ID " )
117
+ clusterId := os .Getenv ("HYBRID_DRY_RUN_CLUSTER_ID " )
137
118
138
119
ctx := context .Background ()
139
120
resp , err := client .GetClusterWithResponse (ctx , organizationId , clusterId )
0 commit comments