aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPablo Ulloa <pablo.ulloac@usach.cl>2023-09-27 21:45:29 +0300
committerGitHub <noreply@github.com>2023-09-27 21:45:29 +0300
commite7f7d194d634e86b29ed2b74a35dd3c24fa1f7a5 (patch)
tree2c0596d76105b96fbe574407b651c487ca87d584 /test
parent9852ca8888b613daff741b3f26fd7d3b0387b42d (diff)
[common-utils] fix bug when user home is custom by base docker (#703)feature_common-utils_2.2.0
* [common-utils] fix bug when user home is custom by base docker * bumped minor version * reduced conditions to improve readability
Diffstat (limited to 'test')
-rw-r--r--test/common-utils/devcontainer-custom-home.sh13
-rw-r--r--test/common-utils/devcontainer-custom-home/Dockerfile4
-rw-r--r--test/common-utils/devcontainer-custom-user-default-home.sh13
-rw-r--r--test/common-utils/scenarios.json16
4 files changed, 46 insertions, 0 deletions
diff --git a/test/common-utils/devcontainer-custom-home.sh b/test/common-utils/devcontainer-custom-home.sh
new file mode 100644
index 0000000..9b64cc0
--- /dev/null
+++ b/test/common-utils/devcontainer-custom-home.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+set -e
+
+# Optional: Import test library
+source dev-container-features-test-lib
+
+# Definition specific tests
+check "user is customUser" grep customUser <(whoami)
+check "home is /customHome" grep "/customHome" <(getent passwd customUser | cut -d: -f6)
+
+# Report result
+reportResults
diff --git a/test/common-utils/devcontainer-custom-home/Dockerfile b/test/common-utils/devcontainer-custom-home/Dockerfile
new file mode 100644
index 0000000..a94af4b
--- /dev/null
+++ b/test/common-utils/devcontainer-custom-home/Dockerfile
@@ -0,0 +1,4 @@
+FROM ubuntu:focal
+
+RUN groupadd customUser -g 30000 && \
+ useradd customUser -u 30000 -g 30000 --create-home --home-dir /customHome
diff --git a/test/common-utils/devcontainer-custom-user-default-home.sh b/test/common-utils/devcontainer-custom-user-default-home.sh
new file mode 100644
index 0000000..f29bd7c
--- /dev/null
+++ b/test/common-utils/devcontainer-custom-user-default-home.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+set -e
+
+# Optional: Import test library
+source dev-container-features-test-lib
+
+# Definition specific tests
+check "user is customUser" grep customUser <(whoami)
+check "home is /home/customUser" grep "/home/customUser" <(getent passwd customUser | cut -d: -f6)
+
+# Report result
+reportResults
diff --git a/test/common-utils/scenarios.json b/test/common-utils/scenarios.json
index d7b296d..bb65874 100644
--- a/test/common-utils/scenarios.json
+++ b/test/common-utils/scenarios.json
@@ -183,5 +183,21 @@
"configureZshAsDefaultShell": true
}
}
+ },
+ "devcontainer-custom-home": {
+ "build": {
+ "dockerfile": "Dockerfile"
+ },
+ "remoteUser": "customUser",
+ "features": {
+ "common-utils": {}
+ }
+ },
+ "devcontainer-custom-user-default-home": {
+ "image": "mcr.microsoft.com/devcontainers/base:alpine",
+ "remoteUser": "customUser",
+ "features": {
+ "common-utils": {}
+ }
}
}