Skip to content

Commit

Permalink
remove build tags for cloud e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
omarismail committed Nov 11, 2021
1 parent 5ef82dd commit 63d780b
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 37 deletions.
3 changes: 1 addition & 2 deletions internal/cloud/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

To run them, use:
```
TF_ACC=1 go test -tags=e2e ./internal/cloud/e2e/... -ldflags "-X \"github.com/hashicorp/terraform/version.Prerelease=<PRE-RELEASE>\""
TFE_TOKEN=<token> TFE_HOSTNAME=<hostname> TF_ACC=1 go test ./internal/cloud/e2e/... -ldflags "-X \"github.com/hashicorp/terraform/version.Prerelease=<PRE-RELEASE>\""
```

Required flags
* `-tags=e2e` for running e2e tests.
* `TF_ACC=1`. This variable is used as part of terraform for tests that make
external network calls. This is needed to run these tests. Without it, the
tests do not run.
Expand Down
3 changes: 0 additions & 3 deletions internal/cloud/e2e/apply_auto_approve_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build e2e
// +build e2e

package main

import (
Expand Down
3 changes: 0 additions & 3 deletions internal/cloud/e2e/backend_apply_before_init_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build e2e
// +build e2e

package main

import (
Expand Down
3 changes: 0 additions & 3 deletions internal/cloud/e2e/helper_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build e2e
// +build e2e

package main

import (
Expand Down
3 changes: 0 additions & 3 deletions internal/cloud/e2e/init_with_empty_tags_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build e2e
// +build e2e

package main

import (
Expand Down
16 changes: 11 additions & 5 deletions internal/cloud/e2e/main_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build e2e
// +build e2e

package main

import (
Expand All @@ -27,8 +24,9 @@ var verboseMode bool

func TestMain(m *testing.M) {
log.SetFlags(log.LstdFlags | log.Lshortfile)
if !accTest() {
// if TF_ACC is not set, we want to skip all these tests.
hasRequiredEnvVars := accTest() && hasHostname() && hasToken()
if !hasRequiredEnvVars {
// if the above three required variables are not set, then skip all tests.
return
}
teardown := setup()
Expand All @@ -44,6 +42,14 @@ func accTest() bool {
return os.Getenv("TF_ACC") != ""
}

func hasHostname() bool {
return os.Getenv("TFE_HOSTNAME") != ""
}

func hasToken() bool {
return os.Getenv("TFE_TOKEN") != ""
}

func setup() func() {
tfOutput := flag.Bool("tfoutput", false, "This flag produces the terraform output from tests.")
flag.Parse()
Expand Down
3 changes: 0 additions & 3 deletions internal/cloud/e2e/migrate_state_multi_to_tfc_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build e2e
// +build e2e

package main

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build e2e
// +build e2e

package main

import (
Expand Down
3 changes: 0 additions & 3 deletions internal/cloud/e2e/migrate_state_single_to_tfc_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build e2e
// +build e2e

package main

import (
Expand Down
3 changes: 0 additions & 3 deletions internal/cloud/e2e/migrate_state_tfc_to_other_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build e2e
// +build e2e

package main

import (
Expand Down
3 changes: 0 additions & 3 deletions internal/cloud/e2e/migrate_state_tfc_to_tfc_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build e2e
// +build e2e

package main

import (
Expand Down
3 changes: 0 additions & 3 deletions internal/cloud/e2e/run_variables_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build e2e
// +build e2e

package main

import (
Expand Down

0 comments on commit 63d780b

Please sign in to comment.