Skip to content

Commit

Permalink
hack container creation into int test
Browse files Browse the repository at this point in the history
  • Loading branch information
rain-on committed Aug 16, 2024
1 parent 8bdcb0b commit 1d7e1cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions octopusdeploy/resource_kubernetes_agent_worker_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package octopusdeploy
import (
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/machines"
"github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework/test"
"log"
"os"
"path/filepath"
stdslices "slices"
"testing"
Expand All @@ -14,6 +16,18 @@ func TestKubernetesAgentWorkerResource(t *testing.T) {
"OCTOPUS__FeatureToggles__KubernetesAgentAsWorkerFeatureToggle": "true",
},
}

// If local - use local, otherwise create a new container
if os.Getenv("TF_ACC_LOCAL") == "" {
octoContainer, octoClient, sqlServerContainer, network, err = testFramework.ArrangeContainer()
if err != nil {
log.Printf("Failed to arrange containers: (%s)", err.Error())
}
os.Setenv("OCTOPUS_URL", octoContainer.URI)
os.Setenv("OCTOPUS_APIKEY", test.ApiKey)
os.Setenv("TF_ACC", "1")
}

_, err := testFramework.Act(t, octoContainer, "../terraform", "58-kubernetesagentworker", []string{})
if err != nil {
t.Fatal(err.Error())
Expand Down
1 change: 1 addition & 0 deletions octopusdeploy/testing_container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func TestMain(m *testing.M) {
URI: url,
}
}

code := m.Run()
os.Exit(code)
}
Expand Down

0 comments on commit 1d7e1cd

Please sign in to comment.