Skip to content

Commit ec3b541

Browse files
committed
add dotted environment variables test
1 parent c9b5d6d commit ec3b541

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class container {
2+
/**
3+
* Check if dotted env vars are supported.
4+
*/
5+
public static void main(String[] args) {
6+
// get value of variable.with.a.dot and print it out
7+
String value = System.getenv("variable.with.a.dot");
8+
System.out.println(value);
9+
System.exit(0);
10+
}
11+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a.dotted.value
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../run-java-in-container.sh

test/tests/run-java-in-container.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,9 @@ COPY --from=jdk /container /container
5151
WORKDIR /container
5252
EOD
5353

54-
docker run --rm "$newImage" java -cp . container
54+
# if testDir contains dotted-environment-variables we need to add an environment variable to the docker run command
55+
if [ $testDir == *"dotted-environment-variables"* ]; then
56+
docker run --rm -e "variable.with.a.dot=a.dotted.value" "$newImage" java -cp . container
57+
else
58+
docker run --rm "$newImage" java -cp . container
59+
fi

0 commit comments

Comments
 (0)