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:
33
test/_global/color_and_hello.sh
Normal file
33
test/_global/color_and_hello.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
# The 'test/_global' folder is a special test folder that is not tied to a single feature.
|
||||
#
|
||||
# This test file is executed against a running container constructed
|
||||
# from the value of 'color_and_hello' in the tests/_global/scenarios.json file.
|
||||
#
|
||||
# The value of a scenarios element is any properties available in the 'devcontainer.json'.
|
||||
# Scenarios are useful for testing specific options in a feature, or to test a combination of features.
|
||||
#
|
||||
# This test can be run with the following command (from the root of this repo)
|
||||
# devcontainer features test --global-scenarios-only .
|
||||
|
||||
set -e
|
||||
|
||||
# Optional: Import test library bundled with the devcontainer CLI
|
||||
source dev-container-features-test-lib
|
||||
|
||||
echo -e "The result of the 'color' command will be:\n"
|
||||
color
|
||||
echo -e "The result of the 'hello' command will be:\n"
|
||||
hello
|
||||
echo -e "\n"
|
||||
|
||||
# Feature-specific tests
|
||||
# The 'check' command comes from the dev-container-features-test-lib.
|
||||
check "check purple is my favorite color" bash -c "color | grep 'my favorite color is purple'"
|
||||
check "check I am greeting with 'Greetings'" bash -c "hello | grep 'Greetings, $(whoami)'"
|
||||
|
||||
|
||||
# Report result
|
||||
# If any of the checks above exited with a non-zero exit code, the test will fail.
|
||||
reportResults
|
13
test/_global/scenarios.json
Normal file
13
test/_global/scenarios.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"color_and_hello": {
|
||||
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
|
||||
"features": {
|
||||
"color": {
|
||||
"favorite": "purple"
|
||||
},
|
||||
"hello": {
|
||||
"greeting": "Greetings"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user