Skip to content

Commit af6a1b5

Browse files
authored
Add dev-tunnels CI tests (#29)
1 parent e4b325f commit af6a1b5

File tree

8 files changed

+38
-48
lines changed

8 files changed

+38
-48
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
features:
3636
- azure-cli-persistence
3737
- shell-history
38+
- dev-tunnels
3839
steps:
3940
- uses: actions/checkout@v4
4041

test-project/.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"extensions": "containerapp,ssh"
1919
},
2020
"./src/shell-history": {},
21-
"./src/azure-cli-persistence": {}
21+
"./src/azure-cli-persistence": {},
22+
"./src/dev-tunnels" : {}
2223
}
2324
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Version":"1.0.1401\u002B3d725ee539"}

test/_global/color_and_hello.sh

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

test/_global/scenarios.json

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

test/dev-tunnels/base.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Optional: Import test library bundled with the devcontainer CLI
5+
# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib
6+
# Provides the 'check' and 'reportResults' commands.
7+
source dev-container-features-test-lib
8+
9+
# Feature-specific tests
10+
# The 'check' command comes from the dev-container-features-test-lib. Syntax is...
11+
# check <LABEL> <cmd> [args...]
12+
13+
# NOTE: currently have to run the test using zsh as the devtunnel install script only adds the PATH to the first shell config it finds
14+
# and when running as root in the dev container base image used for testing, that is .zshrc
15+
# check "Check devtunnel is installed" zsh --interactive -c "devtunnel --version" | grep 'Tunnel CLI'
16+
17+
check "Check devtunnel is installed" bash -c "devtunnel --version" | grep 'Tunnel CLI'
18+
19+
# Report result
20+
# If any of the checks above exited with a non-zero exit code, the test will fail.
21+
reportResults

test/dev-tunnels/scenarios.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"base": {
3+
"image": "mcr.microsoft.com/devcontainers/base:debian",
4+
"features": {
5+
"dev-tunnels": {}
6+
}
7+
}
8+
}

test/dev-tunnels/test.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ source dev-container-features-test-lib
4343

4444
# NOTE: currently have to run the test using zsh as the devtunnel install script only adds the PATH to the first shell config it finds
4545
# and when running as root in the dev container base image used for testing, that is .zshrc
46-
check "Check devtunnel is installed" zsh --interactive -c "devtunnel --version" | grep 'Tunnel CLI'
46+
# check "Check devtunnel is installed" zsh --interactive -c "devtunnel --version" | grep 'Tunnel CLI'
47+
48+
devtunnel --version
49+
50+
check "Check devtunnel is installed" bash -c "devtunnel --version" | grep 'Tunnel CLI'
4751

4852
# Report result
4953
# If any of the checks above exited with a non-zero exit code, the test will fail.

0 commit comments

Comments
 (0)