terraform-bundle: re-enable e2e tests (#25516)

This commit is contained in:
Kristin Laemmert 2020-08-10 15:17:47 -04:00 committed by GitHub
parent 73fc1c451d
commit a8d9809234
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 21 deletions

View File

@ -56,6 +56,7 @@ func (c *Config) validate() error {
if v, err = c.Terraform.Version.Parse(); err != nil { if v, err = c.Terraform.Version.Parse(); err != nil {
return fmt.Errorf("terraform.version: %s", err) return fmt.Errorf("terraform.version: %s", err)
} }
if !zeroThirteen.Allows(v) { if !zeroThirteen.Allows(v) {
return fmt.Errorf("this version of terraform-bundle can only build bundles for Terraform v0.13 and later; build terraform-bundle from a release tag (such as v0.12.*) to construct bundles for earlier versions") return fmt.Errorf("this version of terraform-bundle can only build bundles for Terraform v0.13 and later; build terraform-bundle from a release tag (such as v0.12.*) to construct bundles for earlier versions")
} }

View File

@ -14,10 +14,6 @@ import (
func TestPackage_empty(t *testing.T) { func TestPackage_empty(t *testing.T) {
t.Parallel() t.Parallel()
// The e2etests can be reenabled when there is a terraform v0.13* release
// available on releases.hashicorp.com.
t.Skip("terraform-bundle e2e tests are temporarily paused")
// This test reaches out to releases.hashicorp.com to download the // This test reaches out to releases.hashicorp.com to download the
// template provider, so it can only run if network access is allowed. // template provider, so it can only run if network access is allowed.
// We intentionally don't try to stub this here, because there's already // We intentionally don't try to stub this here, because there's already
@ -38,10 +34,10 @@ func TestPackage_empty(t *testing.T) {
t.Errorf("unexpected stderr output:\n%s", stderr) t.Errorf("unexpected stderr output:\n%s", stderr)
} }
if !strings.Contains(stdout, "Fetching Terraform 0.12.0 core package...") { if !strings.Contains(stdout, "Fetching Terraform 0.13.0 core package...") {
t.Errorf("success message is missing from output:\n%s", stdout) t.Errorf("success message is missing from output:\n%s", stdout)
} }
if !strings.Contains(stdout, "Creating terraform_0.12.0-bundle") { if !strings.Contains(stdout, "Creating terraform_0.13.0-bundle") {
t.Errorf("success message is missing from output:\n%s", stdout) t.Errorf("success message is missing from output:\n%s", stdout)
} }
if !strings.Contains(stdout, "All done!") { if !strings.Contains(stdout, "All done!") {
@ -52,10 +48,6 @@ func TestPackage_empty(t *testing.T) {
func TestPackage_manyProviders(t *testing.T) { func TestPackage_manyProviders(t *testing.T) {
t.Parallel() t.Parallel()
// The e2etests can be reenabled when there is a terraform v0.13* release
// available on releases.hashicorp.com.
t.Skip("terraform-bundle e2e tests are temporarily paused")
// This test reaches out to releases.hashicorp.com to download providers, so // This test reaches out to releases.hashicorp.com to download providers, so
// it can only run if network access is allowed. We intentionally don't try // it can only run if network access is allowed. We intentionally don't try
// to stub this here, because there's already a stubbed version of this in // to stub this here, because there's already a stubbed version of this in
@ -98,10 +90,10 @@ func TestPackage_manyProviders(t *testing.T) {
t.Errorf("success message is missing from output:\n%s", stdout) t.Errorf("success message is missing from output:\n%s", stdout)
} }
if !strings.Contains(stdout, "Fetching Terraform 0.12.0 core package...") { if !strings.Contains(stdout, "Fetching Terraform 0.13.0 core package...") {
t.Errorf("success message is missing from output:\n%s", stdout) t.Errorf("success message is missing from output:\n%s", stdout)
} }
if !strings.Contains(stdout, "Creating terraform_0.12.0-bundle") { if !strings.Contains(stdout, "Creating terraform_0.13.0-bundle") {
t.Errorf("success message is missing from output:\n%s", stdout) t.Errorf("success message is missing from output:\n%s", stdout)
} }
if !strings.Contains(stdout, "All done!") { if !strings.Contains(stdout, "All done!") {
@ -114,7 +106,7 @@ func TestPackage_manyProviders(t *testing.T) {
t.Fatalf("error reading workdir: %s", err) t.Fatalf("error reading workdir: %s", err)
} }
for _, file := range files { for _, file := range files {
if strings.Contains(file.Name(), "terraform_0.12.0-bundle") { if strings.Contains(file.Name(), "terraform_0.13.0-bundle") {
read, err := zip.OpenReader(filepath.Join(tfBundle.WorkDir(), file.Name())) read, err := zip.OpenReader(filepath.Join(tfBundle.WorkDir(), file.Name()))
if err != nil { if err != nil {
t.Fatalf("Failed to open archive: %s", err) t.Fatalf("Failed to open archive: %s", err)
@ -151,10 +143,6 @@ func TestPackage_manyProviders(t *testing.T) {
func TestPackage_localProviders(t *testing.T) { func TestPackage_localProviders(t *testing.T) {
t.Parallel() t.Parallel()
// The e2etests can be reenabled when there is a terraform v0.13* release
// available on releases.hashicorp.com.
t.Skip("terraform-bundle e2e tests are temporarily paused")
// This test reaches out to releases.hashicorp.com to download terrafrom, so // This test reaches out to releases.hashicorp.com to download terrafrom, so
// it can only run if network access is allowed. The providers are installed // it can only run if network access is allowed. The providers are installed
// from the local cache. // from the local cache.
@ -176,10 +164,10 @@ func TestPackage_localProviders(t *testing.T) {
// Here we have to check each provider separately // Here we have to check each provider separately
// because it's internally held in a map (i.e. not guaranteed order) // because it's internally held in a map (i.e. not guaranteed order)
if !strings.Contains(stdout, "Fetching Terraform 0.12.0 core package...") { if !strings.Contains(stdout, "Fetching Terraform 0.13.0 core package...") {
t.Errorf("success message is missing from output:\n%s", stdout) t.Errorf("success message is missing from output:\n%s", stdout)
} }
if !strings.Contains(stdout, "Creating terraform_0.12.0-bundle") { if !strings.Contains(stdout, "Creating terraform_0.13.0-bundle") {
t.Errorf("success message is missing from output:\n%s", stdout) t.Errorf("success message is missing from output:\n%s", stdout)
} }
if !strings.Contains(stdout, "All done!") { if !strings.Contains(stdout, "All done!") {
@ -192,7 +180,7 @@ func TestPackage_localProviders(t *testing.T) {
t.Fatalf("error reading workdir: %s", err) t.Fatalf("error reading workdir: %s", err)
} }
for _, file := range files { for _, file := range files {
if strings.Contains(file.Name(), "terraform_0.12.0-bundle") { if strings.Contains(file.Name(), "terraform_0.13.0-bundle") {
read, err := zip.OpenReader(filepath.Join(tfBundle.WorkDir(), file.Name())) read, err := zip.OpenReader(filepath.Join(tfBundle.WorkDir(), file.Name()))
if err != nil { if err != nil {
t.Fatalf("Failed to open archive: %s", err) t.Fatalf("Failed to open archive: %s", err)

View File

@ -1,5 +1,5 @@
terraform { terraform {
version = "0.3.0" version = "0.13.0"
} }
providers { providers {