From 1d7e1cd74b65b5e174c32be894d3affe6ac618f9 Mon Sep 17 00:00:00 2001 From: Trent Mohay Date: Fri, 16 Aug 2024 11:02:12 +1000 Subject: [PATCH] hack container creation into int test --- ...rce_kubernetes_agent_worker_integration_test.go | 14 ++++++++++++++ octopusdeploy/testing_container_test.go | 1 + 2 files changed, 15 insertions(+) diff --git a/octopusdeploy/resource_kubernetes_agent_worker_integration_test.go b/octopusdeploy/resource_kubernetes_agent_worker_integration_test.go index 87f883e59..13816f1e0 100644 --- a/octopusdeploy/resource_kubernetes_agent_worker_integration_test.go +++ b/octopusdeploy/resource_kubernetes_agent_worker_integration_test.go @@ -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" @@ -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()) diff --git a/octopusdeploy/testing_container_test.go b/octopusdeploy/testing_container_test.go index 1f37ad0a3..324b52ab9 100644 --- a/octopusdeploy/testing_container_test.go +++ b/octopusdeploy/testing_container_test.go @@ -63,6 +63,7 @@ func TestMain(m *testing.M) { URI: url, } } + code := m.Run() os.Exit(code) }