Skip to content

Commit 08db59b

Browse files
committed
Add E2E test scripts for docker-run node
1 parent 752d23e commit 08db59b

9 files changed

Lines changed: 814 additions & 3 deletions

nodes/docker-run@v1.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ func (n *DockerNode) ExecuteImpl(c *core.ExecutionState, inputId core.InputId, p
8080
// I just take this behaviour for the entire system.
8181
// TODO: (Seb) Add an option to override this
8282
currentEnvMap := c.GetContextEnvironMapCopy()
83+
84+
// filter out env variables that would break Linux containers when running on Windows:
85+
// 1. Empty keys or keys starting with '=' - Windows per-drive CWD tracking variables
86+
// (eg =C:=, =D:=, =::=) are parsed by strings.Cut as empty-key entries
87+
// 2. PATH - Windows PATH contains Windows paths that break Linux container commands
88+
for key := range currentEnvMap {
89+
if key == "" || strings.HasPrefix(key, "=") || key == "PATH" {
90+
delete(currentEnvMap, key)
91+
}
92+
}
8393
for _, env := range envs {
8494
if idx := strings.Index(env, "="); idx > 0 {
8595
currentEnvMap[env[:idx]] = env[idx+1:]
@@ -139,7 +149,14 @@ func (n *DockerNode) ExecuteImpl(c *core.ExecutionState, inputId core.InputId, p
139149
return core.CreateErr(c, nil, "Dockerfile not found: %s", dockerfilePath)
140150
}
141151

142-
buildTag := fmt.Sprintf("actrun-docker-%s", uuid.New().String()[:8])
152+
var containerIdSuffix string
153+
if core.IsTestE2eRunning() {
154+
containerIdSuffix = "e2e"
155+
} else {
156+
containerIdSuffix = uuid.New().String()[:8]
157+
}
158+
159+
buildTag := fmt.Sprintf("actrun-docker-%s", containerIdSuffix)
143160
buildContext := filepath.Dir(dockerfilePath)
144161

145162
err = dockerClient.BuildImage(c.Ctx, dockerfilePath, buildContext, buildTag)
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
build hasn't expired yet
2+
looking for value: 'env_file'
3+
no value (is optional) found for: 'env_file'
4+
looking for value: 'config_file'
5+
no value (is optional) found for: 'config_file'
6+
looking for value: 'concurrency'
7+
no value (is optional) found for: 'concurrency'
8+
looking for value: 'graph_file'
9+
found value in: 'env (shell)'
10+
evaluated to: 'docker-alpine.act'
11+
looking for value: 'session_token'
12+
no value (is optional) found for: 'session_token'
13+
looking for value: 'create_debug_session'
14+
found value in flags
15+
evaluated to: 'false'
16+
PushNodeVisit: start, execute: true
17+
🟢 Execute 'Docker Run (docker-basic)'
18+
PushNodeVisit: docker-basic, execute: true
19+
Test 1: Basic echo with env vars - MY_VAR=hello_world
20+
🟢 Execute 'Docker Run (docker-no-socket)'
21+
PushNodeVisit: docker-no-socket, execute: true
22+
Test 2: No docker socket, pull=never
23+
🟢 Execute 'Docker Run (docker-workdir)'
24+
PushNodeVisit: docker-workdir, execute: true
25+
Test 3: Working dir is [REDACTED]/tmp
26+
🟢 Execute 'Docker Run (docker-multi-env)'
27+
PushNodeVisit: docker-multi-env, execute: true
28+
Test 4: VAR1=first VAR2=second VAR3=third
29+
🟢 Execute 'Docker Run (docker-busybox)'
30+
PushNodeVisit: docker-busybox, execute: true
31+
Test 5: Running in busybox!
32+
🟢 Execute 'Docker Run (docker-multiline)'
33+
PushNodeVisit: docker-multiline, execute: true
34+
Test 6: Multi-line script
35+
Line 1: Hello
36+
Line 2: World
37+
Line 3: Done
38+
🟢 Execute 'Docker Run (docker-volume)'
39+
PushNodeVisit: docker-volume, execute: true
40+
Test 7: Volume mount test
41+
Creating file in mounted volume...
42+
test-content-1234
43+
🟢 Execute 'Docker Run (docker-network)'
44+
PushNodeVisit: docker-network, execute: true
45+
Test 8: Network host mode
46+
Hostname: docker-desktop
47+
🟢 Execute 'Docker Run (docker-pull-always)'
48+
PushNodeVisit: docker-pull-always, execute: true
49+
##[group]Pulling image 'alpine:latest'
50+
Pulling from library/alpine
51+
Digest: sha256:25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659
52+
Status: Image is up to date for alpine:latest
53+
##[endgroup]Test 9: Pull always policy
54+
🟢 Execute 'Docker Run (docker-special-chars)'
55+
PushNodeVisit: docker-special-chars, execute: true
56+
Test 10: Special chars test
57+
Quotes: 'single' and "double"
58+
Dollar: $HOME
59+
Backtick: `date`
60+
🟢 Execute 'Docker Run (docker-dockerfile-relative)'
61+
PushNodeVisit: docker-dockerfile-relative, execute: true
62+
##[group]Building image 'actrun-docker-[REDACTED]' from [REDACTED]/Dockerfile.test
63+
Step 1/3 : FROM alpine:latest
64+
---> 25109184c71b
65+
Step 2/3 : ENV MY_BUILD_VAR=default_build_value
66+
---> Using cache
67+
---> fde5e8900876
68+
Step 3/3 : WORKDIR [REDACTED]/app
69+
---> Using cache
70+
---> f6d5f9a2f2a5
71+
Successfully built f6d5f9a2f2a5
72+
Successfully tagged actrun-docker-[REDACTED]:latest
73+
##[endgroup]Test 11: Built from local Dockerfile (relative path)
74+
🟢 Execute 'Docker Run (docker-dockerfile-custom)'
75+
PushNodeVisit: docker-dockerfile-custom, execute: true
76+
##[group]Building image 'actrun-docker-[REDACTED]' from [REDACTED]/Dockerfile.test
77+
Step 1/3 : FROM alpine:latest
78+
---> 25109184c71b
79+
Step 2/3 : ENV MY_BUILD_VAR=default_build_value
80+
---> Using cache
81+
---> fde5e8900876
82+
Step 3/3 : WORKDIR [REDACTED]/app
83+
---> Using cache
84+
---> f6d5f9a2f2a5
85+
Successfully built f6d5f9a2f2a5
86+
Successfully tagged actrun-docker-[REDACTED]:latest
87+
##[endgroup]Test 12: Dockerfile with env and workdir
88+
MY_BUILD_VAR=from_dockerfile_build
89+
Working dir: [REDACTED]/opt
90+
🟢 Execute 'Docker Run (docker-volume-readonly)'
91+
PushNodeVisit: docker-volume-readonly, execute: true
92+
Test 13: Read-only volume mount
93+
test-content-1234
94+
Correctly rejected write on read-only mount
95+
🟢 Execute 'Docker Run (docker-multi-volumes)'
96+
PushNodeVisit: docker-multi-volumes, execute: true
97+
Test 14: Multiple volumes
98+
Vol1 exists: [REDACTED]/vol1
99+
yes
100+
Vol2 exists: [REDACTED]/vol2
101+
yes
102+
Vol3 exists: [REDACTED]/vol3
103+
yes
104+
🟢 Execute 'Docker Run (docker-pipes)'
105+
PushNodeVisit: docker-pipes, execute: true
106+
Test 15: Command with pipes
107+
apple
108+
banana
109+
🟢 Execute 'Docker Run (docker-network-none)'
110+
PushNodeVisit: docker-network-none, execute: true
111+
Test 16: Network none (isolated)
112+
1
113+
🟢 Execute 'Docker Run (docker-env-special)'
114+
PushNodeVisit: docker-env-special, execute: true
115+
Test 17: Env vars with spaces/special chars
116+
SPACE_VAR=hello world with spaces
117+
SPECIAL_VAR=a=b&c=d!@#
118+
🟢 Execute 'Docker Run (docker-default-cmd)'
119+
PushNodeVisit: docker-default-cmd, execute: true
120+
121+
Hello from Docker!
122+
This message shows that your installation appears to be working correctly.
123+
124+
To generate this message, Docker took the following steps:
125+
1. The Docker client contacted the Docker daemon.
126+
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
127+
(amd64)
128+
3. The Docker daemon created a new container from that image which runs the
129+
executable that produces the output you are currently reading.
130+
4. The Docker daemon streamed that output to the Docker client, which sent it
131+
to your terminal.
132+
133+
To try something more ambitious, you can run an Ubuntu container with:
134+
$ docker run -it ubuntu bash
135+
136+
Share images, automate workflows, and more with a free Docker ID:
137+
https:[REDACTED]/
138+
139+
For more examples and ideas, visit:
140+
https:[REDACTED]/
141+
142+
🟢 Execute 'Docker Run (docker-exit-nonzero)'
143+
PushNodeVisit: docker-exit-nonzero, execute: true
144+
Test 19: Non-zero exit code
145+
🟢 Execute 'Docker Run (docker-error-handler)'
146+
PushNodeVisit: docker-error-handler, execute: true
147+
Test 19b: Error handler caught the failure, continuing...
148+
🟢 Execute 'Docker Run (docker-long-args)'
149+
PushNodeVisit: docker-long-args, execute: true
150+
Test 20: Long args list
151+
Iteration 1
152+
Iteration 2
153+
Iteration 3
154+
Iteration 4
155+
Iteration 5
156+
🟢 Execute 'Docker Run (docker-dockerfile-absolute)'
157+
PushNodeVisit: docker-dockerfile-absolute, execute: true
158+
PushNodeVisit: core-filepath-join-v1-pink-hippopotamus-fig, execute: false
159+
PushNodeVisit: core-filepath-location-v1-date-turquoise-teal, execute: false
160+
##[group]Building image 'actrun-docker-[REDACTED]' from [REDACTED]/Dockerfile.test
161+
Step 1/3 : FROM alpine:latest
162+
---> 25109184c71b
163+
Step 2/3 : ENV MY_BUILD_VAR=default_build_value
164+
---> Using cache
165+
---> fde5e8900876
166+
Step 3/3 : WORKDIR [REDACTED]/app
167+
---> Using cache
168+
---> f6d5f9a2f2a5
169+
Successfully built f6d5f9a2f2a5
170+
Successfully tagged actrun-docker-[REDACTED]:latest
171+
##[endgroup]Test 21: Absolute path Dockerfile
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
build hasn't expired yet
2+
looking for value: 'env_file'
3+
no value (is optional) found for: 'env_file'
4+
looking for value: 'config_file'
5+
no value (is optional) found for: 'config_file'
6+
looking for value: 'concurrency'
7+
no value (is optional) found for: 'concurrency'
8+
looking for value: 'graph_file'
9+
found value in: 'env (shell)'
10+
evaluated to: 'docker-hello-world.act'
11+
looking for value: 'session_token'
12+
no value (is optional) found for: 'session_token'
13+
looking for value: 'create_debug_session'
14+
found value in flags
15+
evaluated to: 'false'
16+
PushNodeVisit: start, execute: true
17+
🟢 Execute 'Docker Run (docker-hello-world)'
18+
PushNodeVisit: docker-hello-world, execute: true
19+
20+
Hello from Docker!
21+
This message shows that your installation appears to be working correctly.
22+
23+
To generate this message, Docker took the following steps:
24+
1. The Docker client contacted the Docker daemon.
25+
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
26+
(amd64)
27+
3. The Docker daemon created a new container from that image which runs the
28+
executable that produces the output you are currently reading.
29+
4. The Docker daemon streamed that output to the Docker client, which sent it
30+
to your terminal.
31+
32+
To try something more ambitious, you can run an Ubuntu container with:
33+
$ docker run -it ubuntu bash
34+
35+
Share images, automate workflows, and more with a free Docker ID:
36+
https:[REDACTED]/
37+
38+
For more examples and ideas, visit:
39+
https:[REDACTED]/
40+

tests_e2e/references/reference_group-port-collision.sh_l13

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ error:
2020
↳ group node has an input and output with the same name 'foo'
2121

2222
stack trace:
23-
github.com/actionforge/actrun-cli/nodes.init.40.func1
23+
github.com/actionforge/actrun-cli/nodes.init.41.func1
2424
group@v1.go:154
2525
github.com/actionforge/actrun-cli/core.NewNodeInstance
2626
base.go:619

tests_e2e/references/reference_run-python-embedded.sh_l13

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ hint:
2424
https:[REDACTED]/#not-available
2525

2626
stack trace:
27-
github.com/actionforge/actrun-cli/nodes.init.51.func1
27+
github.com/actionforge/actrun-cli/nodes.init.52.func1
2828
nrun-python-embedded@v1.go:16
2929
github.com/actionforge/actrun-cli/core.NewNodeInstance
3030
base.go:619

0 commit comments

Comments
 (0)