mirror of
https://github.com/Maks1mS/devcontainers-features.git
synced 2025-10-13 16:01:30 +03:00
Initial commit
This commit is contained in:
17
test/hello/hello.sh
Normal file
17
test/hello/hello.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This test file will be executed against one of the scenarios devcontainer.json test that
|
||||
# includes the 'color' feature with "greeting": "hello" option.
|
||||
|
||||
set -e
|
||||
|
||||
# Optional: Import test library bundled with the devcontainer CLI
|
||||
source dev-container-features-test-lib
|
||||
|
||||
# Feature-specific tests
|
||||
# The 'check' command comes from the dev-container-features-test-lib.
|
||||
check "execute command" bash -c "hello | grep 'hello, $(whoami)!'"
|
||||
|
||||
# Report results
|
||||
# If any of the checks above exited with a non-zero exit code, the test will fail.
|
||||
reportResults
|
10
test/hello/scenarios.json
Normal file
10
test/hello/scenarios.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"hello": {
|
||||
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
|
||||
"features": {
|
||||
"hello": {
|
||||
"greeting": "hello"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
47
test/hello/test.sh
Normal file
47
test/hello/test.sh
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This test file will be executed against an auto-generated devcontainer.json that
|
||||
# includes the 'hello' Feature with no options.
|
||||
#
|
||||
# For more information, see: https://github.com/devcontainers/cli/blob/main/docs/features/test.md
|
||||
#
|
||||
# Eg:
|
||||
# {
|
||||
# "image": "<..some-base-image...>",
|
||||
# "features": {
|
||||
# "hello": {}
|
||||
# },
|
||||
# "remoteUser": "root"
|
||||
# }
|
||||
#
|
||||
# Thus, the value of all options will fall back to the default value in
|
||||
# the Feature's 'devcontainer-feature.json'.
|
||||
# For the 'hello' feature, that means the default favorite greeting is 'hey'.
|
||||
#
|
||||
# These scripts are run as 'root' by default. Although that can be changed
|
||||
# with the '--remote-user' flag.
|
||||
#
|
||||
# This test can be run with the following command:
|
||||
#
|
||||
# devcontainer features test \
|
||||
# --features hello \
|
||||
# --remote-user root \
|
||||
# --skip-scenarios \
|
||||
# --base-image mcr.microsoft.com/devcontainers/base:ubuntu \
|
||||
# /path/to/this/repo
|
||||
|
||||
set -e
|
||||
|
||||
# Optional: Import test library bundled with the devcontainer CLI
|
||||
# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib
|
||||
# Provides the 'check' and 'reportResults' commands.
|
||||
source dev-container-features-test-lib
|
||||
|
||||
# Feature-specific tests
|
||||
# The 'check' command comes from the dev-container-features-test-lib. Syntax is...
|
||||
# check <LABEL> <cmd> [args...]
|
||||
check "execute command" bash -c "hello | grep 'hey, $(whoami)!'"
|
||||
|
||||
# Report results
|
||||
# If any of the checks above exited with a non-zero exit code, the test will fail.
|
||||
reportResults
|
Reference in New Issue
Block a user