add dotted environment variables test

This commit is contained in:
George Adams 2023-11-06 12:40:37 +00:00
parent c9b5d6decd
commit ec3b541939
No known key found for this signature in database
GPG Key ID: 7B8D7E4421A0916D
4 changed files with 19 additions and 1 deletions

View File

@ -0,0 +1,11 @@
public class container {
/**
* Check if dotted env vars are supported.
*/
public static void main(String[] args) {
// get value of variable.with.a.dot and print it out
String value = System.getenv("variable.with.a.dot");
System.out.println(value);
System.exit(0);
}
}

View File

@ -0,0 +1 @@
a.dotted.value

View File

@ -0,0 +1 @@
../run-java-in-container.sh

View File

@ -51,4 +51,9 @@ COPY --from=jdk /container /container
WORKDIR /container
EOD
docker run --rm "$newImage" java -cp . container
# if testDir contains dotted-environment-variables we need to add an environment variable to the docker run command
if [ $testDir == *"dotted-environment-variables"* ]; then
docker run --rm -e "variable.with.a.dot=a.dotted.value" "$newImage" java -cp . container
else
docker run --rm "$newImage" java -cp . container
fi