diff --git a/test/fish/alpine.sh b/test/fish/alpine.sh index 9b9ae0e..9d7a786 100755 --- a/test/fish/alpine.sh +++ b/test/fish/alpine.sh @@ -2,24 +2,11 @@ set -e -NON_ROOT_USER="" -POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") -for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do - if id -u ${CURRENT_USER} >/dev/null 2>&1; then - NON_ROOT_USER=${CURRENT_USER} - break - fi -done -if [ "${NON_ROOT_USER}" = "" ]; then - NON_ROOT_USER=root -fi - # Optional: Import test library bundled with the devcontainer CLI source dev-container-features-test-lib check "fish" fish -v -echo "Testing with user: ${NON_ROOT_USER}" -check "fisher" su "${NON_ROOT_USER}" -c 'fish -c "fisher -v"' +check fish -c "fisher -v" # Report result reportResults diff --git a/test/fish/test.sh b/test/fish/test.sh index cad42a5..82fc61b 100755 --- a/test/fish/test.sh +++ b/test/fish/test.sh @@ -4,58 +4,6 @@ set -e source /etc/os-release -cleanup() { - case "${ID}" in - debian|ubuntu) - rm -rf /var/lib/apt/lists/* - ;; - esac -} - -# Clean up -cleanup - -NON_ROOT_USER="" -POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") -for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do - if id -u ${CURRENT_USER} >/dev/null 2>&1; then - NON_ROOT_USER=${CURRENT_USER} - break - fi -done -if [ "${NON_ROOT_USER}" = "" ]; then - NON_ROOT_USER=root -fi - -apt_get_update() { - case "${ID}" in - debian|ubuntu) - if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then - echo "Running apt-get update..." - apt-get update -y - fi - ;; - esac -} - -# Checks if packages are installed and installs them if not -check_packages() { - case "${ID}" in - debian|ubuntu) - if ! dpkg -s "$@" >/dev/null 2>&1; then - apt_get_update - apt-get -y install --no-install-recommends "$@" - fi - ;; - alpine) - if ! apk -e info "$@" >/dev/null 2>&1; then - apk add --no-cache "$@" - fi - ;; - esac -} - -check_packages git LATEST_FISH_VERSION="$(git ls-remote --tags https://github.com/fish-shell/fish-shell | grep -oP "[0-9]+\\.[0-9]+\\.[0-9]+" | sort -V | tail -n 1)" # Optional: Import test library bundled with the devcontainer CLI @@ -70,8 +18,7 @@ case "${ID}" in check "fish" fish -v ;; esac -echo "Testing with user: ${NON_ROOT_USER}" -check "fisher" su "${NON_ROOT_USER}" -c 'fish -c "fisher -v"' +check "fisher" fish -c "fisher -v" # Report result reportResults diff --git a/test/homebrew/test.sh b/test/homebrew/test.sh index 1ee0d19..f08c39d 100644 --- a/test/homebrew/test.sh +++ b/test/homebrew/test.sh @@ -2,67 +2,11 @@ set -e -source /etc/os-release - -cleanup() { - case "${ID}" in - debian|ubuntu) - rm -rf /var/lib/apt/lists/* - ;; - esac -} - -# Clean up -cleanup - -NON_ROOT_USER="" -POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") -for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do - if id -u ${CURRENT_USER} >/dev/null 2>&1; then - NON_ROOT_USER=${CURRENT_USER} - break - fi -done -if [ "${NON_ROOT_USER}" = "" ]; then - NON_ROOT_USER=root -fi - -apt_get_update() { - case "${ID}" in - debian|ubuntu) - if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then - echo "Running apt-get update..." - apt-get update -y - fi - ;; - esac -} - -# Checks if packages are installed and installs them if not -check_packages() { - case "${ID}" in - debian|ubuntu) - if ! dpkg -s "$@" >/dev/null 2>&1; then - apt_get_update - apt-get -y install --no-install-recommends "$@" - fi - ;; - alpine) - if ! apk -e info "$@" >/dev/null 2>&1; then - apk add --no-cache "$@" - fi - ;; - esac -} - -check_packages git - # Optional: Import test library bundled with the devcontainer CLI source dev-container-features-test-lib # Feature-specific tests -echo "Testing with user: ${NON_ROOT_USER}" -check "homebrew" su "${NON_ROOT_USER}" -c 'brew --version' +check "homebrew" brew --version # Report result reportResults