Skip to content

Commit 62cd3c1

Browse files
committed
fix
1 parent 93877b0 commit 62cd3c1

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

internal/provider/provider_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ func explicitHostConfig() string {
7777
provider "astronomer" {
7878
organization_id = "%v"
7979
host = "%v"
80-
}`, os.Getenv("HYBRID_ORGANIZATION_ID"), os.Getenv("ASTRO_API_HOST")) + dataSourceConfig()
80+
token = "%v"
81+
}`, os.Getenv("HYBRID_ORGANIZATION_ID"), os.Getenv("ASTRO_API_HOST"), os.Getenv("HYBRID_ORGANIZATION_API_TOKEN")) + dataSourceConfig()
8182
}
8283

8384
func missingOrganizationIdConfig() string {

internal/provider/provider_test_utils.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,24 @@ func TestAccPreCheck(t *testing.T) {
2222
// You can add code here to run prior to any test case execution, for example assertions
2323
// about the appropriate environment variables being set are common to see in a pre-check
2424
// function.
25-
var errMsgs []string
25+
var missingEnvVars []string
2626
if hostedToken := os.Getenv("HOSTED_ORGANIZATION_API_TOKEN"); len(hostedToken) == 0 {
27-
errMsgs = append(errMsgs, "HOSTED_ORGANIZATION_API_TOKEN must be set for acceptance tests")
27+
missingEnvVars = append(missingEnvVars, "HOSTED_ORGANIZATION_API_TOKEN")
2828
}
2929
if hostedOrgId := os.Getenv("HOSTED_ORGANIZATION_ID"); len(hostedOrgId) == 0 {
30-
errMsgs = append(errMsgs, "HOSTED_ORGANIZATION_ID must be set for acceptance tests")
30+
missingEnvVars = append(missingEnvVars, "HOSTED_ORGANIZATION_ID")
3131
}
3232
if hybridToken := os.Getenv("HYBRID_ORGANIZATION_API_TOKEN"); len(hybridToken) == 0 {
33-
errMsgs = append(errMsgs, "HYBRID_ORGANIZATION_API_TOKEN must be set for acceptance tests")
33+
missingEnvVars = append(missingEnvVars, "HYBRID_ORGANIZATION_API_TOKEN")
3434
}
3535
if hybridOrgId := os.Getenv("HYBRID_ORGANIZATION_ID"); len(hybridOrgId) == 0 {
36-
errMsgs = append(errMsgs, "HYBRID_ORGANIZATION_ID must be set for acceptance tests")
36+
missingEnvVars = append(missingEnvVars, "HYBRID_ORGANIZATION_ID")
3737
}
3838
if host := os.Getenv("ASTRO_API_HOST"); len(host) == 0 {
39-
errMsgs = append(errMsgs, "ASTRO_API_HOST must be set for acceptance tests")
39+
missingEnvVars = append(missingEnvVars, "ASTRO_API_HOST")
4040
}
41-
if len(errMsgs) > 0 {
42-
t.Fatalf("Pre-check failed: %+v", strings.Join(errMsgs, ", "))
41+
if len(missingEnvVars) > 0 {
42+
t.Fatalf("Pre-check failed: %+v must be set for acceptance tests", strings.Join(missingEnvVars, ", "))
4343
}
4444
}
4545

internal/provider/resources/resource_standard_deployment_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -308,14 +308,14 @@ func deleteDeploymentOutsideOfTerraform(t *testing.T, name string) {
308308
assert.NoError(t, err)
309309

310310
ctx := context.Background()
311-
resp, err := client.ListDeploymentsWithResponse(ctx, os.Getenv("ASTRO_HOSTED_ORGANIZATION_ID"), &platform.ListDeploymentsParams{
311+
resp, err := client.ListDeploymentsWithResponse(ctx, os.Getenv("HOSTED_ORGANIZATION_ID"), &platform.ListDeploymentsParams{
312312
Names: &[]string{name},
313313
})
314314
if err != nil {
315315
assert.NoError(t, err)
316316
}
317317
assert.True(t, len(resp.JSON200.Deployments) >= 1, "deployment should exist but list deployments did not find it")
318-
_, err = client.DeleteDeploymentWithResponse(ctx, os.Getenv("ASTRO_HOSTED_ORGANIZATION_ID"), resp.JSON200.Deployments[0].Id)
318+
_, err = client.DeleteDeploymentWithResponse(ctx, os.Getenv("HOSTED_ORGANIZATION_ID"), resp.JSON200.Deployments[0].Id)
319319
assert.NoError(t, err)
320320
}
321321

@@ -326,7 +326,7 @@ func testAccCheckDeploymentExistence(t *testing.T, name string, shouldExist bool
326326
assert.NoError(t, err)
327327

328328
ctx := context.Background()
329-
resp, err := client.ListDeploymentsWithResponse(ctx, os.Getenv("ASTRO_HOSTED_ORGANIZATION_ID"), &platform.ListDeploymentsParams{
329+
resp, err := client.ListDeploymentsWithResponse(ctx, os.Getenv("HOSTED_ORGANIZATION_ID"), &platform.ListDeploymentsParams{
330330
Names: &[]string{name},
331331
})
332332
if err != nil {

0 commit comments

Comments
 (0)