Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit ab289c3

Browse files
committed
Test automation
1 parent 85dbfc4 commit ab289c3

File tree

12 files changed

+312
-562
lines changed

12 files changed

+312
-562
lines changed

containers/java-11/test-project/pom.xml

+11
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@
3939
<target>11</target>
4040
</configuration>
4141
</plugin>
42+
<plugin>
43+
<groupId>org.apache.maven.plugins</groupId>
44+
<artifactId>maven-jar-plugin</artifactId>
45+
<configuration>
46+
<archive>
47+
<manifest>
48+
<mainClass>com.mycompany.app.App</mainClass>
49+
</manifest>
50+
</archive>
51+
</configuration>
52+
</plugin>
4253
</plugins>
4354
</pluginManagement>
4455
</build>
+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/env bash
2+
cd $(dirname "$0")
3+
4+
if [ -z $HOME ]; then
5+
HOME="/root"
6+
fi
7+
8+
FAILED=()
9+
10+
check() {
11+
LABEL=$1
12+
shift
13+
echo -e "\n🧪 Testing $LABEL: $@"
14+
if $@; then
15+
echo "🏆 Passed!"
16+
else
17+
echo "💥 $LABEL check failed."
18+
FAILED+=("$LABEL")
19+
fi
20+
}
21+
22+
checkMultiple() {
23+
PASSED=0
24+
LABEL="$1"
25+
shift; MINIMUMPASSED=$1
26+
shift; EXPRESSION="$1"
27+
while [ "$EXPRESSION" != "" ]; do
28+
if $EXPRESSION; then ((PASSED++)); fi
29+
shift; EXPRESSION=$1
30+
done
31+
check "$LABEL" [ $PASSED -ge $MINIMUMPASSED ]
32+
}
33+
34+
checkExtension() {
35+
checkMultiple "$1" 1 "[ -d ""$HOME/.vscode-server/extensions/$1*"" ]" "[ -d ""$HOME/.vscode-server-insiders/extensions/$1*"" ]" "[ -d ""$HOME/.vscode-test-server/extensions/$1*"" ]"
36+
}
37+
38+
# Prep
39+
echo -e "\nGetting Maven wrapper..."
40+
curl -sSL https://github.com/takari/maven-wrapper/archive/maven-wrapper-0.5.5.tar.gz| tar -xzf -
41+
mv maven-wrapper-maven-wrapper-0.5.5/mvnw mvnw
42+
mv maven-wrapper-maven-wrapper-0.5.5/.mvn .mvn
43+
rm -rf mv maven-wrapper-maven-wrapper-0.5.5
44+
45+
# Actual tests
46+
checkMultiple "vscode-server" 1 "[ -d ""$HOME/.vscode-server/bin"" ]" "[ -d ""$HOME/.vscode-server-insiders/bin"" ]" "[ -d ""$HOME/.vscode-test-server/bin"" ]"
47+
checkExtension "vscjava.vscode-java-pack"
48+
check "non-root-user" "id vscode"
49+
check "/home/vscode" [ -d "/home/vscode" ]
50+
check "sudo" sudo -u vscode echo "sudo works."
51+
check "git" git --version
52+
check "command-line-tools" which top ip lsb_release curl
53+
check "java" java -version
54+
check "build-and-test-jar" ./mvnw package
55+
check "test-project" java -jar target/my-app-1.0-SNAPSHOT.jar
56+
57+
# Clean up
58+
rm -f mvnw
59+
rm -rf .mvn
60+
61+
# Report result
62+
if [ ${#FAILED[@]} -ne 0 ]; then
63+
echo -e "\n💥 Failed tests: ${FAILED[@]}"
64+
exit 1
65+
else
66+
echo -e "\n💯 All passed!"
67+
exit 0
68+
fi

containers/java-12/test-project/pom.xml

+15
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<properties>
1212
<maven.compiler.source>12</maven.compiler.source>
1313
<maven.compiler.target>12</maven.compiler.target>
14+
<argLine>--enable-preview</argLine>
1415
</properties>
1516

1617
<dependencies>
@@ -29,6 +30,9 @@
2930
<groupId>org.apache.maven.plugins</groupId>
3031
<artifactId>maven-surefire-plugin</artifactId>
3132
<version>3.0.0-M3</version>
33+
<configuration>
34+
<forkCount>2</forkCount>
35+
</configuration>
3236
</plugin>
3337
<plugin>
3438
<groupId>org.apache.maven.plugins</groupId>
@@ -40,6 +44,17 @@
4044
<compilerArgs>--enable-preview</compilerArgs>
4145
</configuration>
4246
</plugin>
47+
<plugin>
48+
<groupId>org.apache.maven.plugins</groupId>
49+
<artifactId>maven-jar-plugin</artifactId>
50+
<configuration>
51+
<archive>
52+
<manifest>
53+
<mainClass>com.mycompany.app.App</mainClass>
54+
</manifest>
55+
</archive>
56+
</configuration>
57+
</plugin>
4358
</plugins>
4459
</pluginManagement>
4560
</build>
+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/env bash
2+
cd $(dirname "$0")
3+
4+
if [ -z $HOME ]; then
5+
HOME="/root"
6+
fi
7+
8+
FAILED=()
9+
10+
check() {
11+
LABEL=$1
12+
shift
13+
echo -e "\n🧪 Testing $LABEL: $@"
14+
if $@; then
15+
echo "🏆 Passed!"
16+
else
17+
echo "💥 $LABEL check failed."
18+
FAILED+=("$LABEL")
19+
fi
20+
}
21+
22+
checkMultiple() {
23+
PASSED=0
24+
LABEL="$1"
25+
shift; MINIMUMPASSED=$1
26+
shift; EXPRESSION="$1"
27+
while [ "$EXPRESSION" != "" ]; do
28+
if $EXPRESSION; then ((PASSED++)); fi
29+
shift; EXPRESSION=$1
30+
done
31+
check "$LABEL" [ $PASSED -ge $MINIMUMPASSED ]
32+
}
33+
34+
checkExtension() {
35+
checkMultiple "$1" 1 "[ -d ""$HOME/.vscode-server/extensions/$1*"" ]" "[ -d ""$HOME/.vscode-server-insiders/extensions/$1*"" ]" "[ -d ""$HOME/.vscode-test-server/extensions/$1*"" ]"
36+
}
37+
38+
# Prep
39+
echo -e "\nGetting Maven wrapper..."
40+
curl -sSL https://github.com/takari/maven-wrapper/archive/maven-wrapper-0.5.5.tar.gz| tar -xzf -
41+
mv maven-wrapper-maven-wrapper-0.5.5/mvnw mvnw
42+
mv maven-wrapper-maven-wrapper-0.5.5/.mvn .mvn
43+
rm -rf mv maven-wrapper-maven-wrapper-0.5.5
44+
45+
# Actual tests
46+
checkMultiple "vscode-server" 1 "[ -d ""$HOME/.vscode-server/bin"" ]" "[ -d ""$HOME/.vscode-server-insiders/bin"" ]" "[ -d ""$HOME/.vscode-test-server/bin"" ]"
47+
checkExtension "vscjava.vscode-java-pack"
48+
check "non-root-user" "id vscode"
49+
check "/home/vscode" [ -d "/home/vscode" ]
50+
check "sudo" sudo -u vscode echo "sudo works."
51+
check "git" git --version
52+
check "command-line-tools" which top ip lsb_release curl
53+
check "java" java -version
54+
check "build-and-test-jar" ./mvnw package
55+
check "test-project" java -jar target/my-app-1.0-SNAPSHOT.jar
56+
57+
# Clean up
58+
rm -f mvnw
59+
rm -rf .mvn
60+
61+
# Report result
62+
if [ ${#FAILED[@]} -ne 0 ]; then
63+
echo -e "\n💥 Failed tests: ${FAILED[@]}"
64+
exit 1
65+
else
66+
echo -e "\n💯 All passed!"
67+
exit 0
68+
fi

containers/java-8-tomcat-8.5/test-project/.mvn/wrapper/MavenWrapperDownloader.java

-114
This file was deleted.
Binary file not shown.

containers/java-8-tomcat-8.5/test-project/.mvn/wrapper/maven-wrapper.properties

-1
This file was deleted.

0 commit comments

Comments
 (0)