-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Hey all,
first of all: thanks for this awesome project. Really enjoyed using testcontainers. But i am facing a problem, when running my junit tests on a gitlab shell runner. What am i trying to do:
I want to test an oauth2 authentication flow based on keycloak. Therefor i setup a keycloak container with "testcontainers". On my local machine everything works pretty well. But on gitlab, i see a strange behaviour.
Here my Container-Setup:
private GenericContainer keycloak =
new GenericContainer("jboss/keycloak:4.6.0.Final")
.withExposedPorts(8080)
.withEnv("KEYCLOAK_USER", "admin")
.withEnv("KEYCLOAK_PASSWORD", "admin")
.withEnv("KEYCLOAK_IMPORT", "/tmp/realm.json")
.withClasspathResourceMapping("realm-export.json", "/tmp/realm.json", BindMode.READ_ONLY)
.withClasspathResourceMapping("create-keycloak-user.sh", "/opt/jboss/create-user.sh", BindMode.READ_WRITE)
.waitingFor(Wait.forHttp("/auth"));I use withClassPathResourceMapping to copy a realm export and a little script to create some test-users. On gitlab i see, that the permissions are set weird:
drwxr-xr-x 1 jboss jboss 4096 Dec 2 20:03 .
drwxr-xr-x 1 root root 4096 Nov 2 11:13 ..
-rw-r--r-- 1 jboss jboss 18 Apr 11 2018 .bash_logout
-rw-r--r-- 1 jboss jboss 193 Apr 11 2018 .bash_profile
-rw-r--r-- 1 jboss jboss 231 Apr 11 2018 .bashrc
-rw-rw-r-- 1 999 ssh_keys 1370 Nov 30 15:52 create-user.sh
drwxrwxr-x 1 jboss root 4096 Nov 14 20:51 keycloak
-rw------- 1 jboss jboss 1024 Dec 2 20:03 .rnd
drwxr-xr-x 4 root root 4096 Nov 14 22:47 toolsFirst, the create-user.sh is set without execution permission. Second a user 999 from group ssh:keys owns the file. Due to the wrong permissions i get the following error on my gitlab shell runner:
ℹ︎ Checking the system...
✔ Docker version should be at least 1.6.0
✔ Docker environment should have more than 2GB free disk space
OCI runtime exec failed: exec failed: container_linux.go:296: starting container process caused "exec: \"/opt/jboss/create-user.sh\": permission denied": unknownOn my local machine is see the following permissions_
drwxr-xr-x 1 jboss jboss 4096 Dec 2 20:12 .
drwxr-xr-x 1 root root 4096 Nov 2 11:13 ..
-rw-r--r-- 1 jboss jboss 18 Apr 11 2018 .bash_logout
-rw-r--r-- 1 jboss jboss 193 Apr 11 2018 .bash_profile
-rw-r--r-- 1 jboss jboss 231 Apr 11 2018 .bashrc
-rwxrwxr-x 1 jboss jboss 1370 Dec 2 20:12 create-user.sh
drwxrwxr-x 1 jboss root 4096 Nov 14 20:51 keycloak
-rw------- 1 jboss jboss 1024 Dec 2 20:12 .rnd
drwxr-xr-x 4 root root 4096 Nov 14 22:47 tools