Skip to content

Commit 62e9ec8

Browse files
committed
tests: fix tests
1 parent 404dc51 commit 62e9ec8

6 files changed

+78
-83
lines changed

stack_configuration_integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestStackConfigurationList(t *testing.T) {
2727
stack, err := client.Stacks.Create(ctx, StackCreateOptions{
2828
Name: "test-stack-list",
2929
VCSRepo: &StackVCSRepoOptions{
30-
Identifier: "hashicorp-guides/pet-nulls-stack",
30+
Identifier: "ctrombley/linked-stacks-demo-network",
3131
OAuthTokenID: oauthClient.OAuthTokens[0].ID,
3232
},
3333
Project: &Project{

stack_configuration_summary_integration_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestStackConfigurationSummaryList(t *testing.T) {
2727
stack, err := client.Stacks.Create(ctx, StackCreateOptions{
2828
Name: "aa-test-stack",
2929
VCSRepo: &StackVCSRepoOptions{
30-
Identifier: "hashicorp-guides/pet-nulls-stack",
30+
Identifier: "ctrombley/linked-stacks-demo-network",
3131
OAuthTokenID: oauthClient.OAuthTokens[0].ID,
3232
},
3333
Project: &Project{
@@ -39,7 +39,7 @@ func TestStackConfigurationSummaryList(t *testing.T) {
3939
stack2, err := client.Stacks.Create(ctx, StackCreateOptions{
4040
Name: "bb-test-stack",
4141
VCSRepo: &StackVCSRepoOptions{
42-
Identifier: "hashicorp-guides/pet-nulls-stack",
42+
Identifier: "ctrombley/linked-stacks-demo-network",
4343
OAuthTokenID: oauthClient.OAuthTokens[0].ID,
4444
},
4545
Project: &Project{

stack_deployment_groups_integration_test.go

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func TestStackDeploymentGroupsList(t *testing.T) {
2525
stack, err := client.Stacks.Create(ctx, StackCreateOptions{
2626
Name: "test-stack",
2727
VCSRepo: &StackVCSRepoOptions{
28-
Identifier: "hashicorp-guides/pet-nulls-stack",
28+
Identifier: "ctrombley/linked-stacks-demo-network",
2929
OAuthTokenID: oauthClient.OAuthTokens[0].ID,
3030
},
3131
Project: &Project{
@@ -39,10 +39,9 @@ func TestStackDeploymentGroupsList(t *testing.T) {
3939
stackUpdated, err := client.Stacks.FetchConfiguration(ctx, stack.ID)
4040
require.NoError(t, err)
4141
require.NotNil(t, stackUpdated)
42-
require.NotEmpty(t, stackUpdated.LatestStackConfiguration.ID)
4342

44-
stackUpdated = pollStackDeployments(t, ctx, client, stackUpdated.ID)
45-
require.NotNil(t, stackUpdated.LatestStackConfiguration)
43+
stackUpdated = pollStackDeploymentGroups(t, ctx, client, stackUpdated.ID)
44+
require.NotEmpty(t, stackUpdated.LatestStackConfiguration.ID)
4645

4746
t.Run("List with valid stack configuration ID", func(t *testing.T) {
4847
sdgl, err := client.StackDeploymentGroups.List(ctx, stackUpdated.LatestStackConfiguration.ID, nil)
@@ -91,7 +90,7 @@ func TestStackDeploymentGroupsRead(t *testing.T) {
9190
stack, err := client.Stacks.Create(ctx, StackCreateOptions{
9291
Name: "test-stack",
9392
VCSRepo: &StackVCSRepoOptions{
94-
Identifier: "hashicorp-guides/pet-nulls-stack",
93+
Identifier: "ctrombley/linked-stacks-demo-network",
9594
OAuthTokenID: oauthClient.OAuthTokens[0].ID,
9695
},
9796
Project: &Project{
@@ -106,7 +105,7 @@ func TestStackDeploymentGroupsRead(t *testing.T) {
106105
require.NoError(t, err)
107106
require.NotNil(t, stackUpdated)
108107

109-
stackUpdated = pollStackDeployments(t, ctx, client, stackUpdated.ID)
108+
stackUpdated = pollStackDeploymentGroups(t, ctx, client, stackUpdated.ID)
110109
require.NotNil(t, stackUpdated.LatestStackConfiguration)
111110

112111
sdgl, err := client.StackDeploymentGroups.List(ctx, stackUpdated.LatestStackConfiguration.ID, nil)
@@ -143,7 +142,7 @@ func TestStackDeploymentGroupsApproveAllPlans(t *testing.T) {
143142
stack, err := client.Stacks.Create(ctx, StackCreateOptions{
144143
Name: "test-stack",
145144
VCSRepo: &StackVCSRepoOptions{
146-
Identifier: "hashicorp-guides/pet-nulls-stack",
145+
Identifier: "ctrombley/linked-stacks-demo-network",
147146
OAuthTokenID: oauthClient.OAuthTokens[0].ID,
148147
Branch: "main",
149148
},
@@ -158,11 +157,11 @@ func TestStackDeploymentGroupsApproveAllPlans(t *testing.T) {
158157
require.NoError(t, err)
159158
require.NotNil(t, stackUpdated)
160159

161-
stack = pollStackDeployments(t, ctx, client, stackUpdated.ID)
162-
require.NotNil(t, stack.LatestStackConfiguration)
160+
stackUpdated = pollStackDeploymentGroups(t, ctx, client, stackUpdated.ID)
161+
require.NotNil(t, stackUpdated.LatestStackConfiguration)
163162

164163
// Get the deployment group ID from the stack configuration
165-
deploymentGroups, err := client.StackDeploymentGroups.List(ctx, stack.LatestStackConfiguration.ID, nil)
164+
deploymentGroups, err := client.StackDeploymentGroups.List(ctx, stackUpdated.LatestStackConfiguration.ID, nil)
166165
require.NoError(t, err)
167166
require.NotNil(t, deploymentGroups)
168167
require.NotEmpty(t, deploymentGroups.Items)
@@ -190,7 +189,7 @@ func TestStackDeploymentGroupsRerun(t *testing.T) {
190189
stack, err := client.Stacks.Create(ctx, StackCreateOptions{
191190
Name: "test-stack",
192191
VCSRepo: &StackVCSRepoOptions{
193-
Identifier: "hashicorp-guides/pet-nulls-stack",
192+
Identifier: "ctrombley/linked-stacks-demo-network",
194193
OAuthTokenID: oauthClient.OAuthTokens[0].ID,
195194
Branch: "main",
196195
},
@@ -205,10 +204,10 @@ func TestStackDeploymentGroupsRerun(t *testing.T) {
205204
require.NoError(t, err)
206205
require.NotNil(t, stackUpdated)
207206

208-
stack = pollStackDeployments(t, ctx, client, stackUpdated.ID)
209-
require.NotNil(t, stack.LatestStackConfiguration)
207+
stackUpdated = pollStackDeploymentGroups(t, ctx, client, stackUpdated.ID)
208+
require.NotNil(t, stackUpdated.LatestStackConfiguration)
210209

211-
deploymentGroups, err := client.StackDeploymentGroups.List(ctx, stack.LatestStackConfiguration.ID, nil)
210+
deploymentGroups, err := client.StackDeploymentGroups.List(ctx, stackUpdated.LatestStackConfiguration.ID, nil)
212211
require.NoError(t, err)
213212
require.NotNil(t, deploymentGroups)
214213
require.NotEmpty(t, deploymentGroups.Items)

stack_deployment_runs_integration_test.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestStackDeploymentRunsList(t *testing.T) {
2727
stack, err := client.Stacks.Create(ctx, StackCreateOptions{
2828
Name: "test-stack",
2929
VCSRepo: &StackVCSRepoOptions{
30-
Identifier: "hashicorp-guides/pet-nulls-stack",
30+
Identifier: "ctrombley/linked-stacks-demo-network",
3131
OAuthTokenID: oauthClient.OAuthTokens[0].ID,
3232
Branch: "main",
3333
},
@@ -42,11 +42,11 @@ func TestStackDeploymentRunsList(t *testing.T) {
4242
require.NoError(t, err)
4343
require.NotNil(t, stackUpdated)
4444

45-
stack = pollStackDeployments(t, ctx, client, stackUpdated.ID)
46-
require.NotNil(t, stack.LatestStackConfiguration)
45+
stackUpdated = pollStackDeploymentGroups(t, ctx, client, stackUpdated.ID)
46+
require.NotNil(t, stackUpdated.LatestStackConfiguration)
4747

4848
// Get the deployment group ID from the stack configuration
49-
deploymentGroups, err := client.StackDeploymentGroups.List(ctx, stack.LatestStackConfiguration.ID, nil)
49+
deploymentGroups, err := client.StackDeploymentGroups.List(ctx, stackUpdated.LatestStackConfiguration.ID, nil)
5050
require.NoError(t, err)
5151
require.NotNil(t, deploymentGroups)
5252
require.NotEmpty(t, deploymentGroups.Items)
@@ -90,7 +90,7 @@ func TestStackDeploymentRunsRead(t *testing.T) {
9090
Project: orgTest.DefaultProject,
9191
Name: "test-stack",
9292
VCSRepo: &StackVCSRepoOptions{
93-
Identifier: "hashicorp-guides/pet-nulls-stack",
93+
Identifier: "ctrombley/linked-stacks-demo-network",
9494
OAuthTokenID: oauthClient.OAuthTokens[0].ID,
9595
Branch: "main",
9696
},
@@ -102,10 +102,10 @@ func TestStackDeploymentRunsRead(t *testing.T) {
102102
require.NoError(t, err)
103103
require.NotNil(t, stackUpdated)
104104

105-
stack = pollStackDeployments(t, ctx, client, stackUpdated.ID)
106-
require.NotNil(t, stack.LatestStackConfiguration)
105+
stackUpdated = pollStackDeploymentGroups(t, ctx, client, stackUpdated.ID)
106+
require.NotNil(t, stackUpdated.LatestStackConfiguration)
107107

108-
stackDeploymentGroups, err := client.StackDeploymentGroups.List(ctx, stack.LatestStackConfiguration.ID, nil)
108+
stackDeploymentGroups, err := client.StackDeploymentGroups.List(ctx, stackUpdated.LatestStackConfiguration.ID, nil)
109109
require.NoError(t, err)
110110
require.NotEmpty(t, stackDeploymentGroups)
111111

@@ -115,7 +115,7 @@ func TestStackDeploymentRunsRead(t *testing.T) {
115115
require.NoError(t, err)
116116
require.NotEmpty(t, stackDeploymentRuns)
117117

118-
sdr := stackDeploymentGroups.Items[0]
118+
sdr := stackDeploymentRuns.Items[0]
119119

120120
t.Run("Read with valid ID", func(t *testing.T) {
121121
run, err := client.StackDeploymentRuns.Read(ctx, sdr.ID)
@@ -145,7 +145,7 @@ func TestStackDeploymentRunsApproveAllPlans(t *testing.T) {
145145
Project: orgTest.DefaultProject,
146146
Name: "test-stack",
147147
VCSRepo: &StackVCSRepoOptions{
148-
Identifier: "hashicorp-guides/pet-nulls-stack",
148+
Identifier: "ctrombley/linked-stacks-demo-network",
149149
OAuthTokenID: oauthClient.OAuthTokens[0].ID,
150150
Branch: "main",
151151
},
@@ -157,11 +157,11 @@ func TestStackDeploymentRunsApproveAllPlans(t *testing.T) {
157157
require.NoError(t, err)
158158
require.NotNil(t, stackUpdated)
159159

160-
stack = pollStackDeployments(t, ctx, client, stackUpdated.ID)
161-
require.NotNil(t, stack.LatestStackConfiguration)
160+
stackUpdated = pollStackDeploymentGroups(t, ctx, client, stackUpdated.ID)
161+
require.NotNil(t, stackUpdated.LatestStackConfiguration)
162162

163163
// Get the deployment group ID from the stack configuration
164-
deploymentGroups, err := client.StackDeploymentGroups.List(ctx, stack.LatestStackConfiguration.ID, nil)
164+
deploymentGroups, err := client.StackDeploymentGroups.List(ctx, stackUpdated.LatestStackConfiguration.ID, nil)
165165
require.NoError(t, err)
166166
require.NotNil(t, deploymentGroups)
167167
require.NotEmpty(t, deploymentGroups.Items)
@@ -198,7 +198,7 @@ func TestStackDeploymentRunsCancel(t *testing.T) {
198198
Project: orgTest.DefaultProject,
199199
Name: "test-stack",
200200
VCSRepo: &StackVCSRepoOptions{
201-
Identifier: "hashicorp-guides/pet-nulls-stack",
201+
Identifier: "ctrombley/linked-stacks-demo-network",
202202
OAuthTokenID: oauthClient.OAuthTokens[0].ID,
203203
Branch: "main",
204204
},
@@ -210,11 +210,11 @@ func TestStackDeploymentRunsCancel(t *testing.T) {
210210
require.NoError(t, err)
211211
require.NotNil(t, stackUpdated)
212212

213-
stack = pollStackDeployments(t, ctx, client, stackUpdated.ID)
214-
require.NotNil(t, stack.LatestStackConfiguration)
213+
stackUpdated = pollStackDeploymentGroups(t, ctx, client, stackUpdated.ID)
214+
require.NotNil(t, stackUpdated.LatestStackConfiguration)
215215

216216
// Get the deployment group ID from the stack configuration
217-
deploymentGroups, err := client.StackDeploymentGroups.List(ctx, stack.LatestStackConfiguration.ID, nil)
217+
deploymentGroups, err := client.StackDeploymentGroups.List(ctx, stackUpdated.LatestStackConfiguration.ID, nil)
218218
require.NoError(t, err)
219219
require.NotNil(t, deploymentGroups)
220220
require.NotEmpty(t, deploymentGroups.Items)

stack_deployment_steps_integration_test.go

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ func TestStackDeploymentStepsList(t *testing.T) {
2828
Project: orgTest.DefaultProject,
2929
Name: "test-stack",
3030
VCSRepo: &StackVCSRepoOptions{
31-
Identifier: "hashicorp-guides/pet-nulls-stack",
32-
OAuthTokenID: oauthClient.OAuthTokens[0].ID,
33-
Branch: "main",
31+
Identifier: "ctrombley/linked-stacks-demo-network", OAuthTokenID: oauthClient.OAuthTokens[0].ID,
32+
Branch: "main",
3433
},
3534
})
3635
require.NoError(t, err)
@@ -40,10 +39,10 @@ func TestStackDeploymentStepsList(t *testing.T) {
4039
require.NoError(t, err)
4140
require.NotNil(t, stackUpdated)
4241

43-
stack = pollStackDeployments(t, ctx, client, stackUpdated.ID)
44-
require.NotNil(t, stack.LatestStackConfiguration)
42+
stackUpdated = pollStackDeploymentGroups(t, ctx, client, stackUpdated.ID)
43+
require.NotNil(t, stackUpdated.LatestStackConfiguration)
4544

46-
stackDeploymentGroups, err := client.StackDeploymentGroups.List(ctx, stack.LatestStackConfiguration.ID, nil)
45+
stackDeploymentGroups, err := client.StackDeploymentGroups.List(ctx, stackUpdated.LatestStackConfiguration.ID, nil)
4746
require.NoError(t, err)
4847
require.NotEmpty(t, stackDeploymentGroups)
4948

@@ -76,7 +75,7 @@ func TestStackDeploymentStepsList(t *testing.T) {
7675
assert.NotNil(t, step.Status)
7776

7877
require.NotNil(t, step.StackDeploymentRun)
79-
assert.Equal(t, sdg.ID, step.StackDeploymentRun.ID)
78+
assert.Equal(t, sdr.ID, step.StackDeploymentRun.ID)
8079
})
8180

8281
t.Run("List with pagination", func(t *testing.T) {
@@ -98,7 +97,7 @@ func TestStackDeploymentStepsList(t *testing.T) {
9897
assert.NotNil(t, step.Status)
9998

10099
require.NotNil(t, step.StackDeploymentRun)
101-
assert.Equal(t, sdg.ID, step.StackDeploymentRun.ID)
100+
assert.Equal(t, sdr.ID, step.StackDeploymentRun.ID)
102101
})
103102
}
104103

@@ -118,9 +117,8 @@ func TestStackDeploymentStepsRead(t *testing.T) {
118117
Project: orgTest.DefaultProject,
119118
Name: "test-stack",
120119
VCSRepo: &StackVCSRepoOptions{
121-
Identifier: "hashicorp-guides/pet-nulls-stack",
122-
OAuthTokenID: oauthClient.OAuthTokens[0].ID,
123-
Branch: "main",
120+
Identifier: "ctrombley/linked-stacks-demo-network", OAuthTokenID: oauthClient.OAuthTokens[0].ID,
121+
Branch: "main",
124122
},
125123
})
126124
require.NoError(t, err)
@@ -130,10 +128,10 @@ func TestStackDeploymentStepsRead(t *testing.T) {
130128
require.NoError(t, err)
131129
require.NotNil(t, stackUpdated)
132130

133-
stack = pollStackDeployments(t, ctx, client, stackUpdated.ID)
134-
require.NotNil(t, stack.LatestStackConfiguration)
131+
stackUpdated = pollStackDeploymentGroups(t, ctx, client, stackUpdated.ID)
132+
require.NotNil(t, stackUpdated.LatestStackConfiguration)
135133

136-
stackDeploymentGroups, err := client.StackDeploymentGroups.List(ctx, stack.LatestStackConfiguration.ID, nil)
134+
stackDeploymentGroups, err := client.StackDeploymentGroups.List(ctx, stackUpdated.LatestStackConfiguration.ID, nil)
137135
require.NoError(t, err)
138136
require.NotEmpty(t, stackDeploymentGroups)
139137

@@ -180,9 +178,8 @@ func TestStackDeploymentStepsAdvance(t *testing.T) {
180178
Project: orgTest.DefaultProject,
181179
Name: "testing-stack",
182180
VCSRepo: &StackVCSRepoOptions{
183-
Identifier: "hashicorp-guides/pet-nulls-stack",
184-
OAuthTokenID: oauthClient.OAuthTokens[0].ID,
185-
Branch: "main",
181+
Identifier: "ctrombley/linked-stacks-demo-network", OAuthTokenID: oauthClient.OAuthTokens[0].ID,
182+
Branch: "main",
186183
},
187184
})
188185
require.NoError(t, err)
@@ -192,10 +189,10 @@ func TestStackDeploymentStepsAdvance(t *testing.T) {
192189
require.NoError(t, err)
193190
require.NotNil(t, stackUpdated)
194191

195-
stack = pollStackDeployments(t, ctx, client, stackUpdated.ID)
196-
require.NotNil(t, stack.LatestStackConfiguration)
192+
stackUpdated = pollStackDeploymentGroups(t, ctx, client, stackUpdated.ID)
193+
require.NotNil(t, stackUpdated.LatestStackConfiguration)
197194

198-
stackDeploymentGroups, err := client.StackDeploymentGroups.List(ctx, stack.LatestStackConfiguration.ID, nil)
195+
stackDeploymentGroups, err := client.StackDeploymentGroups.List(ctx, stackUpdated.LatestStackConfiguration.ID, nil)
199196
require.NoError(t, err)
200197
require.NotEmpty(t, stackDeploymentGroups)
201198

0 commit comments

Comments
 (0)