Skip to content

Commit

Permalink
Test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanNWatt committed Oct 16, 2024
1 parent dcfa514 commit ada2026
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/superset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"time"

"github.com/gruntwork-io/terratest/modules/k8s"
"github.com/gruntwork-io/terratest/modules/logger"
"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -28,8 +29,10 @@ func TestSuperset(t *testing.T) {
// Write kubeconfig to a file
kubeconfigPath := filepath.Join("", ".terraform-test")

err = os.WriteFile(kubeconfigPath, []byte(os.Getenv("KUBECONFIG")), 0644)
require.NoError(t, err)
if kubeconfig := os.Getenv("KUBECONFIG"); kubeconfig != "" {
err = os.WriteFile(kubeconfigPath, []byte(os.Getenv("KUBECONFIG")), 0644)
require.NoError(t, err)
}

terraformOptions := &terraform.Options{
TerraformDir: ".", // Use the current directory (test/)
Expand All @@ -45,6 +48,8 @@ func TestSuperset(t *testing.T) {
BackendConfig: map[string]interface{}{
"path": filepath.Join(tempDir, "terraform.tfstate"),
},
NoColor: true,
Logger: logger.Discard,
}

defer terraform.Destroy(t, terraformOptions)
Expand Down

0 comments on commit ada2026

Please sign in to comment.