Skip to content

Commit bb898ed

Browse files
committed
Cleaned up testing task
1 parent ddabec5 commit bb898ed

File tree

10 files changed

+126
-41
lines changed

10 files changed

+126
-41
lines changed

.actrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-P ubuntu-latest=catthehacker/ubuntu:act-latest
2+
--container-daemon-socket /var/run/docker.sock

.vscode/tasks.json

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,57 @@
99
"features",
1010
"test",
1111
"--features",
12-
"devbox",
13-
"${localWorkspaceFolder}",
12+
"jetify-devbox",
13+
"${workspaceFolder}"
1414
],
1515
"group": "test",
1616
"problemMatcher": []
17+
},
18+
{
19+
"type": "shell",
20+
"label": "Run GitHub Actions Locally (act)",
21+
"command": "act",
22+
"args": [
23+
"--container-architecture",
24+
"linux/amd64"
25+
],
26+
"group": "test",
27+
"problemMatcher": [],
28+
"options": {
29+
"cwd": "${workspaceFolder}"
30+
},
31+
"presentation": {
32+
"echo": true,
33+
"reveal": "always",
34+
"focus": false,
35+
"panel": "shared",
36+
"showReuseMessage": true,
37+
"clear": false
38+
}
39+
},
40+
{
41+
"type": "shell",
42+
"label": "Run GitHub Actions - Test Scenarios (act)",
43+
"command": "act",
44+
"args": [
45+
"-j",
46+
"test-scenarios",
47+
"--container-architecture",
48+
"linux/amd64"
49+
],
50+
"group": "test",
51+
"problemMatcher": [],
52+
"options": {
53+
"cwd": "${workspaceFolder}"
54+
},
55+
"presentation": {
56+
"echo": true,
57+
"reveal": "always",
58+
"focus": false,
59+
"panel": "shared",
60+
"showReuseMessage": true,
61+
"clear": false
62+
}
1763
}
1864
]
1965
}

test/jetify-devbox/devbox.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

test/jetify-devbox/scenarios.json

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
{
2-
"auto_update_enabled": {
2+
"test_auto_update_enabled": {
33
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
44
"features": {
55
"jetify-devbox": {
66
"autoUpdate": true
77
}
8-
},
9-
"mounts": [
10-
"source=${PWD}/test-assets,target=/tmp/test-assets,type=bind"
11-
],
12-
"onCreateCommand": "cp /tmp/test-assets/devbox.json ."
8+
}
139
},
14-
"auto_update_disabled": {
10+
"test_auto_update_disabled": {
1511
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
1612
"features": {
1713
"jetify-devbox": {
@@ -26,10 +22,6 @@
2622
"autoUpdate": true
2723
}
2824
},
29-
"mounts": [
30-
"source=${PWD}/test-assets,target=/tmp/test-assets,type=bind"
31-
],
32-
"onCreateCommand": "cp /tmp/test-assets/devbox.json .",
3325
"customizations": {
3426
"vscode": {
3527
"settings": {

test/jetify-devbox/test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
#!/bin/bash
12
# ==================================================
23
# test/jetify-devbox/test.sh - Basic functionality test
34
# ==================================================
4-
#!/bin/bash
55
set -e
66

77
# Import test library
@@ -18,7 +18,7 @@ check "devbox in PATH" which devbox
1818
check "can initialize devbox" bash -c "devbox init && test -f devbox.json"
1919

2020
# Test that devbox shell works
21-
check "devbox shell works" devbox shell -- echo 'Shell test passed'
21+
check "devbox shell works" bash -c "echo 'echo Shell test passed' | devbox shell"
2222

2323
# Cleanup
2424
rm -f devbox.json devbox.lock

test/jetify-devbox/test_auto_update_enabled.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@ set -e
66

77
source dev-container-features-test-lib
88

9+
# Create devbox.json to simulate the onCreateCommand
10+
cat > devbox.json << 'EOF'
11+
{
12+
"packages": [
13+
"python@3.11",
14+
"nodejs@18",
15+
"jq@latest"
16+
],
17+
"shell": {
18+
"init_hook": [
19+
"echo 'Welcome to Devbox!'"
20+
]
21+
}
22+
}
23+
EOF
24+
925
# Check that the post-setup script was created
1026
check "post-setup script exists" test -f /usr/local/share/devbox-post-setup.sh
1127

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
echo "Testing Devbox feature on different base image (ubuntu:jammy)..."
6+
7+
source dev-container-features-test-lib
8+
9+
check "devbox is installed" which devbox
10+
check "devbox version works" devbox version
11+
check "devbox feature installed env var" bash -c "[ \"\$DEVBOX_FEATURE_INSTALLED\" = 'true' ]"
12+
13+
check "post-setup script exists" test -f /usr/local/share/devbox-post-setup.sh
14+
check "manual setup script exists" test -f /usr/local/bin/devbox-setup
15+
check "auto-update flag exists" test -f /usr/local/share/devbox-auto-update-enabled
16+
17+
check "devbox init works" bash -c "cd /tmp && devbox init"
18+
check "devbox.json created" test -f /tmp/devbox.json
19+
20+
reportResults

test/jetify-devbox/test_vscode_integration.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@ set -e
66

77
source dev-container-features-test-lib
88

9+
# Create devbox.json to test integration
10+
cat > devbox.json << 'EOF'
11+
{
12+
"packages": [
13+
"python@3.11",
14+
"nodejs@18",
15+
"jq@latest"
16+
],
17+
"shell": {
18+
"init_hook": [
19+
"echo 'Welcome to Devbox!'"
20+
]
21+
}
22+
}
23+
EOF
24+
925
# Check devbox was installed
1026
check "devbox installed" devbox version
1127

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
echo "Testing Devbox feature with user onCreate command..."
6+
7+
source dev-container-features-test-lib
8+
9+
check "devbox is installed" which devbox
10+
check "devbox version works" devbox version
11+
check "devbox feature installed env var" bash -c "[ \"\$DEVBOX_FEATURE_INSTALLED\" = 'true' ]"
12+
13+
check "user onCreate command ran" test -f /tmp/user-oncreate.log
14+
check "user onCreate content" grep "User onCreate ran after feature" /tmp/user-oncreate.log
15+
16+
check "post-setup script exists" test -f /usr/local/share/devbox-post-setup.sh
17+
check "manual setup script exists" test -f /usr/local/bin/devbox-setup
18+
19+
reportResults

test/test-assets/devbox.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)