From 64111ddcc24ccaab072fc76bfde0d4650559ef2e Mon Sep 17 00:00:00 2001 From: serg Date: Tue, 19 Mar 2024 13:34:35 +0000 Subject: [PATCH] chore(tests): add --- src/git-subtree/devcontainer-feature.json | 2 +- .../{color_and_hello.sh => git-subtree.sh} | 8 ++-- test/_global/scenarios.json | 7 +-- test/color/green.sh | 17 ------- test/color/my_favorite_color_is_green.sh | 31 ------------ test/color/scenarios.json | 33 ------------- test/{hello => git-subtree}/scenarios.json | 8 ++-- .../successfully-installed.sh} | 2 +- test/{color => git-subtree}/test.sh | 6 +-- test/hello/hello.sh | 17 ------- test/hello/test.sh | 47 ------------------- 11 files changed, 12 insertions(+), 166 deletions(-) rename test/_global/{color_and_hello.sh => git-subtree.sh} (79%) delete mode 100644 test/color/green.sh delete mode 100644 test/color/my_favorite_color_is_green.sh delete mode 100644 test/color/scenarios.json rename test/{hello => git-subtree}/scenarios.json (53%) rename test/{color/gold.sh => git-subtree/successfully-installed.sh} (84%) rename test/{color => git-subtree}/test.sh (90%) delete mode 100644 test/hello/hello.sh delete mode 100644 test/hello/test.sh diff --git a/src/git-subtree/devcontainer-feature.json b/src/git-subtree/devcontainer-feature.json index 071778b..a711480 100644 --- a/src/git-subtree/devcontainer-feature.json +++ b/src/git-subtree/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "git subtree (for Debian/Ubuntu)", "documentationURL": "https://manpages.debian.org/testing/git-man/git-subtree.1.en.html", - "id": "git subtree", + "id": "git-subtree", "version": "0.0.1", "description": "Installs 'git subtree' on Ubuntu" } diff --git a/test/_global/color_and_hello.sh b/test/_global/git-subtree.sh similarity index 79% rename from test/_global/color_and_hello.sh rename to test/_global/git-subtree.sh index 9a08758..be2bdb1 100644 --- a/test/_global/color_and_hello.sh +++ b/test/_global/git-subtree.sh @@ -17,15 +17,13 @@ set -e 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 +git-subtree 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)'" +# 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 diff --git a/test/_global/scenarios.json b/test/_global/scenarios.json index b046998..b111c97 100644 --- a/test/_global/scenarios.json +++ b/test/_global/scenarios.json @@ -2,12 +2,7 @@ "color_and_hello": { "image": "mcr.microsoft.com/devcontainers/base:ubuntu", "features": { - "color": { - "favorite": "purple" - }, - "hello": { - "greeting": "Greetings" - } + "git-subtree": {} } } } \ No newline at end of file diff --git a/test/color/green.sh b/test/color/green.sh deleted file mode 100644 index 5b55388..0000000 --- a/test/color/green.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# This test file will be executed against one of the scenarios devcontainer.json test that -# includes the 'color' feature with "favorite": "green" 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 "color | grep 'my favorite color is green'" - -# Report result -# If any of the checks above exited with a non-zero exit code, the test will fail. -reportResults diff --git a/test/color/my_favorite_color_is_green.sh b/test/color/my_favorite_color_is_green.sh deleted file mode 100644 index 94e6295..0000000 --- a/test/color/my_favorite_color_is_green.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -# This test file will be executed against after building a container with the -# 'my_favorite_color_is_green' scenario in 'test/test/color/scenarios.json'. -# -# For more information, see: https://github.com/devcontainers/cli/blob/main/docs/features/test.md -# -# This scenario first uses the 'common-utils' Features to add a new user 'octocat'. -# It then installs the 'color' Feature with the FAVORITE option set to 'green' (the default FAVORITE value if none provided is 'red'). -# -# -# This test (as well as any of the other scenarios in 'scenarios.json') can be run with the following command: -# -# devcontainer features test \ -# --features color \ -# --skip-autogenerated \ -# /path/to/this/repo - -set -e - -# Optional: Import test library bundled with the devcontainer CLI -# 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. -check "validate favorite color" color | grep 'my favorite color is green' - -# Report result -# If any of the checks above exited with a non-zero exit code, the test will fail. -reportResults diff --git a/test/color/scenarios.json b/test/color/scenarios.json deleted file mode 100644 index bfd7952..0000000 --- a/test/color/scenarios.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "my_favorite_color_is_green": { - "image": "mcr.microsoft.com/devcontainers/base:focal", - "features": { - "ghcr.io/devcontainers/features/common-utils:1": { - "installZsh": false, - "installOhMyZsh": false, - "upgradePackages": false, - "username": "octocat" - }, - "color": { - "favorite": "green" - } - }, - "remoteUser": "octocat" - }, - "gold": { - "image": "mcr.microsoft.com/devcontainers/base:ubuntu", - "features": { - "color": { - "favorite": "gold" - } - } - }, - "green": { - "image": "mcr.microsoft.com/devcontainers/base:ubuntu", - "features": { - "color": { - "favorite": "green" - } - } - } -} diff --git a/test/hello/scenarios.json b/test/git-subtree/scenarios.json similarity index 53% rename from test/hello/scenarios.json rename to test/git-subtree/scenarios.json index 3ebe7a1..b172d51 100644 --- a/test/hello/scenarios.json +++ b/test/git-subtree/scenarios.json @@ -1,10 +1,8 @@ { - "hello": { + "successfully-installed": { "image": "mcr.microsoft.com/devcontainers/base:ubuntu", "features": { - "hello": { - "greeting": "hello" - } + "git-subtree": {} } } -} +} \ No newline at end of file diff --git a/test/color/gold.sh b/test/git-subtree/successfully-installed.sh similarity index 84% rename from test/color/gold.sh rename to test/git-subtree/successfully-installed.sh index 1aaa9aa..e7bfe57 100644 --- a/test/color/gold.sh +++ b/test/git-subtree/successfully-installed.sh @@ -10,7 +10,7 @@ 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 "color | grep 'my favorite color is gold'" +check "execute command" bash -c "git subtree add --help | grep 'usage: git subtree add'" # Report result # If any of the checks above exited with a non-zero exit code, the test will fail. diff --git a/test/color/test.sh b/test/git-subtree/test.sh similarity index 90% rename from test/color/test.sh rename to test/git-subtree/test.sh index bab0fa3..671ed11 100644 --- a/test/color/test.sh +++ b/test/git-subtree/test.sh @@ -1,7 +1,7 @@ #!/bin/bash # This test file will be executed against an auto-generated devcontainer.json that -# includes the 'color' Feature with no options. +# includes the 'git-subtree' Feature with no options. # # For more information, see: https://github.com/devcontainers/cli/blob/main/docs/features/test.md # @@ -9,7 +9,7 @@ # { # "image": "<..some-base-image...>", # "features": { -# "color": {} +# "git-subtree": {} # }, # "remoteUser": "root" # } @@ -40,7 +40,7 @@ source dev-container-features-test-lib # Feature-specific tests # The 'check' command comes from the dev-container-features-test-lib. Syntax is... # check