Add gate for TFE tests that use the network (#997)

Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
This commit is contained in:
Christian Mesh
2023-12-12 09:58:13 -05:00
committed by GitHub
parent abd324ea7c
commit 35ca1aeed8
4 changed files with 36 additions and 19 deletions

View File

@@ -38,7 +38,7 @@ func TestCloud_showMissingRun(t *testing.T) {
mockSROWorkspace(t, b, testBackendSingleWorkspaceName)
absentRunID := "run-WwwwXxxxYyyyZzzz"
_, err := b.ShowPlanForRun(context.Background(), absentRunID, "app.terraform.io", true)
_, err := b.ShowPlanForRun(context.Background(), absentRunID, tfeHost, true)
if !strings.Contains(err.Error(), "tofu login") {
t.Fatalf("expected error message to suggest checking your login status, instead got: %s", err)
}
@@ -57,7 +57,7 @@ func TestCloud_showMissingUnredactedJson(t *testing.T) {
t.Fatalf("failed to init test data: %s", err)
}
// Showing the human-formatted plan should still work as expected!
redacted, err := b.ShowPlanForRun(ctx, runID, "app.terraform.io", true)
redacted, err := b.ShowPlanForRun(ctx, runID, tfeHost, true)
if err != nil {
t.Fatalf("failed to show plan for human, even though redacted json should be present: %s", err)
}
@@ -80,7 +80,7 @@ func TestCloud_showMissingUnredactedJson(t *testing.T) {
}
// But show -json should result in a special error.
_, err = b.ShowPlanForRun(ctx, runID, "app.terraform.io", false)
_, err = b.ShowPlanForRun(ctx, runID, tfeHost, false)
if err == nil {
t.Fatalf("unexpected success: reading unredacted json without admin permissions should have errored")
}
@@ -102,7 +102,7 @@ func TestCloud_showIncludesUnredactedJson(t *testing.T) {
t.Fatalf("failed to init test data: %s", err)
}
// Showing the human-formatted plan should work as expected:
redacted, err := b.ShowPlanForRun(ctx, runID, "app.terraform.io", true)
redacted, err := b.ShowPlanForRun(ctx, runID, tfeHost, true)
if err != nil {
t.Fatalf("failed to show plan for human, even though redacted json should be present: %s", err)
}
@@ -110,7 +110,7 @@ func TestCloud_showIncludesUnredactedJson(t *testing.T) {
t.Fatalf("show for human doesn't include expected redacted json content")
}
// Showing the external json plan format should work as expected:
unredacted, err := b.ShowPlanForRun(ctx, runID, "app.terraform.io", false)
unredacted, err := b.ShowPlanForRun(ctx, runID, tfeHost, false)
if err != nil {
t.Fatalf("failed to show plan for robot, even though unredacted json should be present: %s", err)
}
@@ -131,7 +131,7 @@ func TestCloud_showNoChanges(t *testing.T) {
t.Fatalf("failed to init test data: %s", err)
}
// Showing the human-formatted plan should work as expected:
redacted, err := b.ShowPlanForRun(ctx, runID, "app.terraform.io", true)
redacted, err := b.ShowPlanForRun(ctx, runID, tfeHost, true)
if err != nil {
t.Fatalf("failed to show plan for human, even though redacted json should be present: %s", err)
}
@@ -163,7 +163,7 @@ func TestCloud_showFooterNotConfirmable(t *testing.T) {
mc.Runs.Runs[runID].Actions.IsConfirmable = false
// Showing the human-formatted plan should work as expected:
redacted, err := b.ShowPlanForRun(ctx, runID, "app.terraform.io", true)
redacted, err := b.ShowPlanForRun(ctx, runID, tfeHost, true)
if err != nil {
t.Fatalf("failed to show plan for human, even though redacted json should be present: %s", err)
}