Skip to content

Commit b68a355

Browse files
authored
test: add option for keep the test container (task test:gateway REMOVE_CONTAINERS=false) (#13)
Signed-off-by: Peter Balogh <p.balogh.sa@gmail.com>
1 parent be56c24 commit b68a355

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

integrations/Taskfile.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,15 @@ tasks:
181181

182182
test:gateway:
183183
desc: Gateway test
184+
vars:
185+
REMOVE_CONTAINERS: '{{ .REMOVE_CONTAINERS | default "true" }}'
184186
cmds:
185187
- task: k8s:port-forward:setup:gateway
186188
- defer: { task: k8s:port-forward:teardown:gateway }
187189
- task: test:autogen-agent:run
188190
- defer: { task: test:autogen-agent:remove }
189191
- docker pull {{ .IMAGE_REPO }}/csit/test-langchain-agent:{{ .TEST_APP_TAG }}
190-
- IMAGE_REPO={{.IMAGE_REPO}} TEST_APP_TAG={{.TEST_APP_TAG}} go test ./agntcy-agp/tests -v -failfast -test.v -test.paniconexit0 -ginkgo.timeout 30m -timeout 30m -ginkgo.v
192+
- REMOVE_CONTAINERS={{.REMOVE_CONTAINERS}} IMAGE_REPO={{.IMAGE_REPO}} TEST_APP_TAG={{.TEST_APP_TAG}} go test ./agntcy-agp/tests -v -failfast -test.v -test.paniconexit0 -ginkgo.timeout 30m -timeout 30m -ginkgo.v
191193

192194
version:
193195
desc: Get version

integrations/testutils/docker_runner.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package testutils
66
import (
77
"bytes"
88
"fmt"
9+
"os"
910
"os/exec"
1011
"runtime"
1112
)
@@ -18,7 +19,12 @@ type DockerRunner struct {
1819
func NewDockerRunner(dockerImage, mountString string, envVars map[string]string) *DockerRunner {
1920
baseArgs := []string{
2021
"run",
21-
"--rm",
22+
}
23+
24+
if os.Getenv("REMOVE_CONTAINERS") == "true" {
25+
baseArgs = append(baseArgs,
26+
"--rm",
27+
)
2228
}
2329

2430
if mountString != "" {

0 commit comments

Comments
 (0)