Fix test when GH Actions runs w/user w/UID != 1000
This commit is contained in:
Родитель
2b98c5148a
Коммит
0c81d55fe8
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -3,6 +3,10 @@ cd $(dirname "$0")
|
|||
|
||||
source test-utils.sh vscode
|
||||
|
||||
# Remote - Containers does not auto-sync UID/GID for Docker Compose,
|
||||
# so make sure test project prvs match the non-root user in the container.
|
||||
fixTestProjectFolderPrivs
|
||||
|
||||
# Run common tests
|
||||
checkCommon
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -135,10 +140,22 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Useful for scenarios where UID/GID is not automatically updated - happens in GitHub Actions w/Docker Compose
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -3,12 +3,13 @@ cd $(dirname "$0")
|
|||
|
||||
source test-utils.sh vscode
|
||||
|
||||
# Remote - Containers does not auto-sync UID/GID for Docker Compose,
|
||||
# so make sure test project prvs match the non-root user in the container.
|
||||
fixTestProjectFolderPrivs
|
||||
|
||||
# Run common tests
|
||||
checkCommon
|
||||
|
||||
# Run Docker init script
|
||||
/usr/local/share/docker-init.sh
|
||||
|
||||
# Definition specific tests
|
||||
checkExtension "ms-azuretools.vscode-docker"
|
||||
check "docker" docker ps -a
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -6,9 +6,6 @@ source test-utils.sh vscode
|
|||
# Run common tests
|
||||
checkCommon
|
||||
|
||||
# Run Docker init script
|
||||
/usr/local/share/docker-init.sh
|
||||
|
||||
# Definition specific tests
|
||||
checkExtension "ms-azuretools.vscode-docker"
|
||||
check "docker" docker ps -a
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -3,6 +3,10 @@ cd $(dirname "$0")
|
|||
|
||||
source test-utils.sh vscode
|
||||
|
||||
# Remote - Containers does not auto-sync UID/GID for Docker Compose,
|
||||
# so make sure test project prvs match the non-root user in the container.
|
||||
fixTestProjectFolderPrivs
|
||||
|
||||
# Run common tests
|
||||
checkCommon
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -3,6 +3,10 @@ cd $(dirname "$0")
|
|||
|
||||
source test-utils.sh vscode
|
||||
|
||||
# Remote - Containers does not auto-sync UID/GID for Docker Compose,
|
||||
# so make sure test project prvs match the non-root user in the container.
|
||||
fixTestProjectFolderPrivs
|
||||
|
||||
# Run common tests
|
||||
checkCommon
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -3,6 +3,10 @@ cd $(dirname "$0")
|
|||
|
||||
source test-utils.sh node
|
||||
|
||||
# Remote - Containers does not auto-sync UID/GID for Docker Compose,
|
||||
# so make sure test project prvs match the non-root user in the container.
|
||||
fixTestProjectFolderPrivs
|
||||
|
||||
# Run common tests
|
||||
checkCommon
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -3,6 +3,10 @@ cd $(dirname "$0")
|
|||
|
||||
source test-utils.sh node
|
||||
|
||||
# Remote - Containers does not auto-sync UID/GID for Docker Compose,
|
||||
# so make sure test project prvs match the non-root user in the container.
|
||||
fixTestProjectFolderPrivs
|
||||
|
||||
# Run common tests
|
||||
checkCommon
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -118,16 +123,27 @@ checkCommon()
|
|||
check "sudo" sudo echo "sudo works."
|
||||
check "zsh" zsh --version
|
||||
check "oh-my-zsh" [ -d "$HOME/.oh-my-zsh" ]
|
||||
#check "login-shell-path" [ -f "/etc/profile.d/00-restore-env.sh" ]
|
||||
check "login-shell-path" [ -f "/etc/profile.d/00-restore-env.sh" ]
|
||||
check "code" which code
|
||||
}
|
||||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -3,6 +3,10 @@ cd $(dirname "$0")
|
|||
|
||||
source test-utils.sh vscode
|
||||
|
||||
# Remote - Containers does not auto-sync UID/GID for Docker Compose,
|
||||
# so make sure test project prvs match the non-root user in the container.
|
||||
fixTestProjectFolderPrivs
|
||||
|
||||
# Run common tests
|
||||
checkCommon
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -96,10 +96,11 @@ If you prefer, you can add the following to your `Dockerfile` to cause global in
|
|||
ENV PIP_TARGET=/usr/local/pip-global
|
||||
ENV PYTHONPATH=${PIP_TARGET}:${PYTHONPATH}
|
||||
ENV PATH=${PIP_TARGET}/bin:${PATH}
|
||||
RUN mkdir -p ${PIP_TARGET} \
|
||||
&& chown vscode:root ${PIP_TARGET} \
|
||||
&& echo "if [ \"\$(stat -c '%U' ${PIP_TARGET})\" != \"vscode\" ]; then sudo chown -R vscode:root ${PIP_TARGET}; fi" \
|
||||
| tee -a /root/.bashrc /root/.zshrc /home/vscode/.bashrc >> /home/vscode/.zshrc \
|
||||
RUN if ! cat /etc/group | grep -e "^pip-global:" > /dev/null 2>&1; then groupadd -r pip-global; fi \
|
||||
&& usermod -a -G pip-global vscode \
|
||||
&& umask 0002 && mkdir -p ${PIP_TARGET} \
|
||||
&& chown :pip-global ${PIP_TARGET} \
|
||||
&& ( [ ! -f "/etc/profile.d/00-restore-env.sh" ] || sed -i -e "s/export PATH=/export PATH=\/usr\/local\/pip-global:/" /etc/profile.d/00-restore-env.sh )
|
||||
```
|
||||
|
||||
### Adding the definition to your project
|
||||
|
|
|
@ -113,11 +113,13 @@ If you prefer, you can add the following to your `Dockerfile` to cause global in
|
|||
|
||||
```Dockerfile
|
||||
ENV PIP_TARGET=/usr/local/pip-global
|
||||
ENV PYTHONPATH=${PIP_TARGET}:${PYTHONPATH} \
|
||||
PATH=${PIP_TARGET}/bin:${PATH}
|
||||
RUN mkdir -p ${PIP_TARGET} \
|
||||
&& chown vscode:root ${PIP_TARGET} \
|
||||
&& echo "if [ \"\$(stat -c '%U' ${PIP_TARGET})\" != \"vscode\" ]; then sudo chown -R vscode:root ${PIP_TARGET}; fi" | tee -a /etc/bash.bashrc >> /etc/zsh/zshrc
|
||||
ENV PYTHONPATH=${PIP_TARGET}:${PYTHONPATH}
|
||||
ENV PATH=${PIP_TARGET}/bin:${PATH}
|
||||
RUN if ! cat /etc/group | grep -e "^pip-global:" > /dev/null 2>&1; then groupadd -r pip-global; fi \
|
||||
&& usermod -a -G pip-global vscode \
|
||||
&& umask 0002 && mkdir -p ${PIP_TARGET} \
|
||||
&& chown :pip-global ${PIP_TARGET} \
|
||||
&& ( [ ! -f "/etc/profile.d/00-restore-env.sh" ] || sed -i -e "s/export PATH=/export PATH=\/usr\/local\/pip-global:/" /etc/profile.d/00-restore-env.sh )
|
||||
```
|
||||
|
||||
### Adding the definition to your folder
|
||||
|
|
|
@ -116,11 +116,13 @@ If you prefer, you can add the following to your `Dockerfile` to cause global in
|
|||
|
||||
```Dockerfile
|
||||
ENV PIP_TARGET=/usr/local/pip-global
|
||||
ENV PYTHONPATH=${PIP_TARGET}:${PYTHONPATH} \
|
||||
PATH=${PIP_TARGET}/bin:${PATH}
|
||||
RUN mkdir -p ${PIP_TARGET} \
|
||||
&& chown vscode:root ${PIP_TARGET} \
|
||||
&& echo "if [ \"\$(stat -c '%U' ${PIP_TARGET})\" != \"vscode\" ]; then sudo chown -R vscode:root ${PIP_TARGET}; fi" | tee -a /etc/bash.bashrc >> /etc/zsh/zshrc
|
||||
ENV PYTHONPATH=${PIP_TARGET}:${PYTHONPATH}
|
||||
ENV PATH=${PIP_TARGET}/bin:${PATH}
|
||||
RUN if ! cat /etc/group | grep -e "^pip-global:" > /dev/null 2>&1; then groupadd -r pip-global; fi \
|
||||
&& usermod -a -G pip-global vscode \
|
||||
&& umask 0002 && mkdir -p ${PIP_TARGET} \
|
||||
&& chown :pip-global ${PIP_TARGET} \
|
||||
&& ( [ ! -f "/etc/profile.d/00-restore-env.sh" ] || sed -i -e "s/export PATH=/export PATH=\/usr\/local\/pip-global:/" /etc/profile.d/00-restore-env.sh )
|
||||
```
|
||||
|
||||
#### [Optional] Installing multiple versions of Python in the same image
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
|
@ -8,6 +8,11 @@ fi
|
|||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
|
@ -16,7 +21,7 @@ check() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -36,7 +41,7 @@ checkMultiple() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -50,7 +55,7 @@ checkOSPackages() {
|
|||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -77,7 +82,7 @@ checkExtension() {
|
|||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
|
@ -124,10 +129,21 @@ checkCommon()
|
|||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
#!/bin/bash
|
||||
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
HOME="/root"
|
||||
fi
|
||||
|
||||
FAILED=()
|
||||
|
||||
echoStderr()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
echo -e "\n🧪 Testing $LABEL"
|
||||
if "$@"; then
|
||||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
checkMultiple() {
|
||||
PASSED=0
|
||||
LABEL="$1"
|
||||
echo -e "\n🧪 Testing $LABEL."
|
||||
shift; MINIMUMPASSED=$1
|
||||
shift; EXPRESSION="$1"
|
||||
while [ "$EXPRESSION" != "" ]; do
|
||||
if $EXPRESSION; then ((PASSED++)); fi
|
||||
shift; EXPRESSION=$1
|
||||
done
|
||||
if [ $PASSED -ge $MINIMUMPASSED ]; then
|
||||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
checkOSPackages() {
|
||||
LABEL=$1
|
||||
shift
|
||||
echo -e "\n🧪 Testing $LABEL"
|
||||
if dpkg-query --show -f='${Package}: ${Version}\n' "$@"; then
|
||||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echoStderr "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
checkExtension() {
|
||||
# Happens asynchronusly, so keep retrying 10 times with an increasing delay
|
||||
EXTN_ID="$1"
|
||||
TIMEOUT_SECONDS="${2:-10}"
|
||||
RETRY_COUNT=0
|
||||
echo -e -n "\n🧪 Looking for extension $1 for maximum of ${TIMEOUT_SECONDS}s"
|
||||
until [ "${RETRY_COUNT}" -eq "${TIMEOUT_SECONDS}" ] || \
|
||||
[ ! -e $HOME/.vscode-server/extensions/${EXTN_ID}* ] || \
|
||||
[ ! -e $HOME/.vscode-server-insiders/extensions/${EXTN_ID}* ] || \
|
||||
[ ! -e $HOME/.vscode-test-server/extensions/${EXTN_ID}* ] || \
|
||||
[ ! -e $HOME/.vscode-remote/extensions/${EXTN_ID}* ]
|
||||
do
|
||||
sleep 1s
|
||||
(( RETRY_COUNT++ ))
|
||||
echo -n "."
|
||||
done
|
||||
|
||||
if [ ${RETRY_COUNT} -lt ${TIMEOUT_SECONDS} ]; then
|
||||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echoStderr -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
checkCommon()
|
||||
{
|
||||
PACKAGE_LIST="apt-utils \
|
||||
git \
|
||||
openssh-client \
|
||||
less \
|
||||
iproute2 \
|
||||
procps \
|
||||
curl \
|
||||
wget \
|
||||
unzip \
|
||||
nano \
|
||||
jq \
|
||||
lsb-release \
|
||||
ca-certificates \
|
||||
apt-transport-https \
|
||||
dialog \
|
||||
gnupg2 \
|
||||
libc6 \
|
||||
libgcc1 \
|
||||
libgssapi-krb5-2 \
|
||||
liblttng-ust0 \
|
||||
libstdc++6 \
|
||||
zlib1g \
|
||||
locales \
|
||||
sudo"
|
||||
|
||||
# Actual tests
|
||||
checkOSPackages "common-os-packages" ${PACKAGE_LIST}
|
||||
checkMultiple "vscode-server" 1 "[ -d $HOME/.vscode-server/bin ]" "[ -d $HOME/.vscode-server-insiders/bin ]" "[ -d $HOME/.vscode-test-server/bin ]" "[ -d $HOME/.vscode-remote/bin ]" "[ -d $HOME/.vscode-remote/bin ]"
|
||||
check "non-root-user" id ${USERNAME}
|
||||
check "locale" [ $(locale -a | grep en_US.utf8) ]
|
||||
check "sudo" sudo echo "sudo works."
|
||||
check "zsh" zsh --version
|
||||
check "oh-my-zsh" [ -d "$HOME/.oh-my-zsh" ]
|
||||
check "login-shell-path" [ -f "/etc/profile.d/00-restore-env.sh" ]
|
||||
check "code" which code
|
||||
}
|
||||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fixTestProjectFolderPrivs() {
|
||||
if [ "${USERNAME}" != "root" ]; then
|
||||
TEST_PROJECT_FOLDER="${1:-$SCRIPT_FOLDER}"
|
||||
FOLDER_USER="$(stat -c '%U' "${TEST_PROJECT_FOLDER}")"
|
||||
if [ "${FOLDER_USER}" != "${USERNAME}" ]; then
|
||||
echoStderr "WARNING: Test project folder is owned by ${FOLDER_USER}. Updating to ${USERNAME}."
|
||||
chown -R ${USERNAME} "${TEST_PROJECT_FOLDER}"
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -1,55 +1,10 @@
|
|||
#!/bin/bash -i
|
||||
#!/bin/bash
|
||||
cd $(dirname "$0")
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
HOME="/root"
|
||||
fi
|
||||
source test-utils.sh vscode
|
||||
|
||||
FAILED=()
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
echo -e "\n🧪 Testing $LABEL: $@"
|
||||
if $@; then
|
||||
echo "🏆 Passed!"
|
||||
else
|
||||
echo "💥 $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
fi
|
||||
}
|
||||
|
||||
checkMultiple() {
|
||||
PASSED=0
|
||||
LABEL="$1"
|
||||
shift; MINIMUMPASSED=$1
|
||||
shift; EXPRESSION="$1"
|
||||
while [ "$EXPRESSION" != "" ]; do
|
||||
if $EXPRESSION; then ((PASSED++)); fi
|
||||
shift; EXPRESSION=$1
|
||||
done
|
||||
check "$LABEL" [ $PASSED -ge $MINIMUMPASSED ]
|
||||
}
|
||||
|
||||
checkExtension() {
|
||||
checkMultiple "$1" 1 "[ -d ""$HOME/.vscode-server/extensions/$1*"" ]" "[ -d ""$HOME/.vscode-server-insiders/extensions/$1*"" ]" "[ -d ""$HOME/.vscode-test-server/extensions/$1*"" ]" "[ -d ""$HOME/.vscode-remote/extensions/$1*"" ]"
|
||||
}
|
||||
|
||||
# Actual tests
|
||||
checkMultiple "vscode-server" 1 "[ -d ""$HOME/.vscode-server/bin"" ]" "[ -d ""$HOME/.vscode-server-insiders/bin"" ]" "[ -d ""$HOME/.vscode-test-server/bin"" ]" "[ -d ""$HOME/.vscode-remote/bin"" ]"
|
||||
check "non-root-user" "id vscode"
|
||||
check "/home/vscode" [ -d "/home/vscode" ]
|
||||
check "sudo" sudo echo "sudo works."
|
||||
check "git" git --version
|
||||
check "command-line-tools" which top ip lsb_release wget curl jq less nano unzip
|
||||
check "zsh" zsh --version
|
||||
check "oh-my-zsh" [ -d "$HOME/.oh-my-zsh" ]
|
||||
# Run common tests
|
||||
checkCommon
|
||||
|
||||
# Report result
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
reportResults
|
||||
|
|
Загрузка…
Ссылка в новой задаче