Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
84ff2335
Commit
84ff2335
authored
Aug 03, 2020
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Test the launch script when executed directly"
See gh-21388
parent
02a6a844
Changes
51
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
51 changed files
with
165 additions
and
154 deletions
+165
-154
AbstractLaunchScriptIT.java
...ngframework/boot/launchscript/AbstractLaunchScriptIT.java
+18
-10
JarLaunchScriptIT.java
.../springframework/boot/launchscript/JarLaunchScriptIT.java
+38
-11
SysVinitLaunchScriptIT.java
...ngframework/boot/launchscript/SysVinitLaunchScriptIT.java
+37
-32
Dockerfile
...ts/src/test/resources/conf/CentOS/6.9-a23bced6/Dockerfile
+0
-4
Dockerfile
...src/test/resources/conf/Ubuntu/trusty-20160914/Dockerfile
+0
-4
Dockerfile
...src/test/resources/conf/Ubuntu/xenial-20160914/Dockerfile
+0
-4
basic-launch.sh
...t-tests/src/test/resources/scripts/init.d/basic-launch.sh
+0
-1
force-stop-when-stopped.sh
.../test/resources/scripts/init.d/force-stop-when-stopped.sh
+0
-1
launch-with-double-link-single-java-opt.sh
...scripts/init.d/launch-with-double-link-single-java-opt.sh
+0
-1
launch-with-missing-log-folder.sh
...esources/scripts/init.d/launch-with-missing-log-folder.sh
+0
-1
launch-with-missing-pid-folder.sh
...esources/scripts/init.d/launch-with-missing-pid-folder.sh
+0
-1
launch-with-multiple-command-line-arguments.sh
...pts/init.d/launch-with-multiple-command-line-arguments.sh
+0
-1
launch-with-multiple-java-opts.sh
...esources/scripts/init.d/launch-with-multiple-java-opts.sh
+0
-1
launch-with-multiple-run-args.sh
...resources/scripts/init.d/launch-with-multiple-run-args.sh
+0
-1
launch-with-relative-log-folder.sh
...sources/scripts/init.d/launch-with-relative-log-folder.sh
+0
-1
launch-with-relative-pid-folder.sh
...sources/scripts/init.d/launch-with-relative-pid-folder.sh
+0
-1
launch-with-run-as-invalid-user.sh
...sources/scripts/init.d/launch-with-run-as-invalid-user.sh
+0
-1
launch-with-run-as-user-preferred-to-jar-owner.sh
.../init.d/launch-with-run-as-user-preferred-to-jar-owner.sh
+0
-1
launch-with-run-as-user-root-required.sh
...s/scripts/init.d/launch-with-run-as-user-root-required.sh
+0
-1
launch-with-run-as-user.sh
.../test/resources/scripts/init.d/launch-with-run-as-user.sh
+0
-1
launch-with-single-command-line-argument.sh
...cripts/init.d/launch-with-single-command-line-argument.sh
+0
-1
launch-with-single-java-opt.sh
...t/resources/scripts/init.d/launch-with-single-java-opt.sh
+0
-1
launch-with-single-run-arg.sh
...st/resources/scripts/init.d/launch-with-single-run-arg.sh
+0
-1
launch-with-use-of-start-stop-daemon-disabled.sh
...s/init.d/launch-with-use-of-start-stop-daemon-disabled.sh
+0
-1
log-file-ownership-is-changed-when-created.sh
...ipts/init.d/log-file-ownership-is-changed-when-created.sh
+0
-1
log-file-ownership-is-unchanged-when-exists.sh
...pts/init.d/log-file-ownership-is-unchanged-when-exists.sh
+0
-1
log-file-ownership.sh
...s/src/test/resources/scripts/init.d/log-file-ownership.sh
+0
-1
pid-file-ownership.sh
...s/src/test/resources/scripts/init.d/pid-file-ownership.sh
+0
-1
pid-folder-ownership.sh
...src/test/resources/scripts/init.d/pid-folder-ownership.sh
+0
-1
restart-when-started.sh
...src/test/resources/scripts/init.d/restart-when-started.sh
+0
-1
restart-when-stopped.sh
...src/test/resources/scripts/init.d/restart-when-stopped.sh
+0
-1
start-when-started.sh
...s/src/test/resources/scripts/init.d/start-when-started.sh
+0
-1
start-when-stopped.sh
...s/src/test/resources/scripts/init.d/start-when-stopped.sh
+0
-1
status-when-killed.sh
...s/src/test/resources/scripts/init.d/status-when-killed.sh
+0
-1
status-when-started.sh
.../src/test/resources/scripts/init.d/status-when-started.sh
+0
-1
status-when-stopped.sh
.../src/test/resources/scripts/init.d/status-when-stopped.sh
+0
-1
stop-when-stopped.sh
...ts/src/test/resources/scripts/init.d/stop-when-stopped.sh
+0
-1
test-functions.sh
...tests/src/test/resources/scripts/init.d/test-functions.sh
+18
-1
basic-launch.sh
...ript-tests/src/test/resources/scripts/jar/basic-launch.sh
+2
-2
launch-in-init.d-dir.sh
...ts/src/test/resources/scripts/jar/launch-in-init.d-dir.sh
+0
-5
launch-with-app-name.sh
...ts/src/test/resources/scripts/jar/launch-with-app-name.sh
+0
-27
launch-with-debug.sh
...tests/src/test/resources/scripts/jar/launch-with-debug.sh
+2
-2
launch-with-jarfile.sh
...sts/src/test/resources/scripts/jar/launch-with-jarfile.sh
+2
-2
launch-with-multiple-command-line-arguments.sh
...cripts/jar/launch-with-multiple-command-line-arguments.sh
+4
-0
launch-with-multiple-java-opts.sh
...t/resources/scripts/jar/launch-with-multiple-java-opts.sh
+5
-0
launch-with-multiple-run-args.sh
...st/resources/scripts/jar/launch-with-multiple-run-args.sh
+5
-0
launch-with-single-command-line-argument.sh
...s/scripts/jar/launch-with-single-command-line-argument.sh
+4
-0
launch-with-single-java-opt.sh
...test/resources/scripts/jar/launch-with-single-java-opt.sh
+5
-0
launch-with-single-run-arg.sh
.../test/resources/scripts/jar/launch-with-single-run-arg.sh
+5
-0
test-functions.sh
...pt-tests/src/test/resources/scripts/jar/test-functions.sh
+20
-1
test-functions.sh
...script-tests/src/test/resources/scripts/test-functions.sh
+0
-18
No files found.
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/AbstractLaunchScriptIT.java
View file @
84ff2335
...
...
@@ -35,12 +35,20 @@ import static org.hamcrest.Matchers.containsString;
/**
* Abstract base class for testing the launch script.
*
* @author Andy Wilkinson
* @author Ali Shahbour
* @author Alexey Vinogradov
*/
abstract
class
AbstractLaunchScriptIT
{
protected
static
final
char
ESC
=
27
;
private
final
String
scriptsDir
;
protected
AbstractLaunchScriptIT
(
String
scriptsDir
)
{
this
.
scriptsDir
=
scriptsDir
;
}
static
List
<
Object
[]>
parameters
()
{
List
<
Object
[]>
parameters
=
new
ArrayList
<>();
for
(
File
os
:
new
File
(
"src/test/resources/conf"
).
listFiles
())
{
...
...
@@ -69,7 +77,8 @@ abstract class AbstractLaunchScriptIT {
protected
String
doTest
(
String
os
,
String
version
,
String
script
)
throws
Exception
{
ToStringConsumer
consumer
=
new
ToStringConsumer
().
withRemoveAnsiCodes
(
false
);
try
(
LaunchScriptTestContainer
container
=
new
LaunchScriptTestContainer
(
os
,
version
,
script
))
{
try
(
LaunchScriptTestContainer
container
=
new
LaunchScriptTestContainer
(
os
,
version
,
this
.
scriptsDir
,
script
))
{
container
.
withLogConsumer
(
consumer
);
container
.
start
();
while
(
container
.
isRunning
())
{
...
...
@@ -81,17 +90,16 @@ abstract class AbstractLaunchScriptIT {
private
static
final
class
LaunchScriptTestContainer
extends
GenericContainer
<
LaunchScriptTestContainer
>
{
private
LaunchScriptTestContainer
(
String
os
,
String
version
,
String
testScript
)
{
private
LaunchScriptTestContainer
(
String
os
,
String
version
,
String
scriptsDir
,
String
testScript
)
{
super
(
new
ImageFromDockerfile
(
"spring-boot-launch-script/"
+
os
.
toLowerCase
()
+
"-"
+
version
)
.
withFileFromFile
(
"Dockerfile"
,
new
File
(
"src/test/resources/conf/"
+
os
+
"/"
+
version
+
"/Dockerfile"
))
.
withFileFromFile
(
"spring-boot-launch-script-tests.jar"
,
findApplication
())
.
withFileFromFile
(
"test-functions.sh"
,
new
File
(
"src/test/resources/scripts/test-functions.sh"
))
.
withFileFromFile
(
"jar/test-functions.sh"
,
new
File
(
"src/test/resources/scripts/jar/test-functions.sh"
))
.
withFileFromFile
(
"init.d/test-functions.sh"
,
new
File
(
"src/test/resources/scripts/init.d/test-functions.sh"
)));
withCopyFileToContainer
(
MountableFile
.
forHostPath
(
"src/test/resources/scripts/"
+
testScript
),
new
File
(
"src/test/resources/conf/"
+
os
+
"/"
+
version
+
"/Dockerfile"
)));
withCopyFileToContainer
(
MountableFile
.
forHostPath
(
findApplication
().
getAbsolutePath
()),
"/spring-boot-launch-script-tests.jar"
);
withCopyFileToContainer
(
MountableFile
.
forHostPath
(
"src/test/resources/scripts/"
+
scriptsDir
+
"test-functions.sh"
),
"/test-functions.sh"
);
withCopyFileToContainer
(
MountableFile
.
forHostPath
(
"src/test/resources/scripts/"
+
scriptsDir
+
testScript
),
"/"
+
testScript
);
withCommand
(
"/bin/bash"
,
"-c"
,
"chmod +x "
+
testScript
+
" && ./"
+
testScript
);
withStartupTimeout
(
Duration
.
ofMinutes
(
10
));
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/
Shell
LaunchScriptIT.java
→
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/
Jar
LaunchScriptIT.java
View file @
84ff2335
...
...
@@ -22,45 +22,72 @@ import org.junit.jupiter.params.provider.MethodSource;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
/**
* Integration tests of Spring Boot's launch script w
ith launching via shell
.
* Integration tests of Spring Boot's launch script w
hen executing the jar directly
.
*
* @author Alexey Vinogradov
* @author Andy Wilkinson
*/
class
ShellLaunchScriptIT
extends
AbstractLaunchScriptIT
{
class
JarLaunchScriptIT
extends
AbstractLaunchScriptIT
{
JarLaunchScriptIT
()
{
super
(
"jar/"
);
}
@ParameterizedTest
(
name
=
"{0} {1}"
)
@MethodSource
(
"parameters"
)
void
basicLaunch
(
String
os
,
String
version
)
throws
Exception
{
doLaunch
(
os
,
version
,
"
jar/
basic-launch.sh"
);
doLaunch
(
os
,
version
,
"basic-launch.sh"
);
}
@ParameterizedTest
(
name
=
"{0} {1}"
)
@MethodSource
(
"parameters"
)
void
launchWithDebugEnv
(
String
os
,
String
version
)
throws
Exception
{
final
String
output
=
doTest
(
os
,
version
,
"
jar/
launch-with-debug.sh"
);
final
String
output
=
doTest
(
os
,
version
,
"launch-with-debug.sh"
);
assertThat
(
output
).
contains
(
"++ pwd"
);
}
@ParameterizedTest
(
name
=
"{0} {1}"
)
@MethodSource
(
"parameters"
)
void
launchWithDifferentJarFileEnv
(
String
os
,
String
version
)
throws
Exception
{
final
String
output
=
doTest
(
os
,
version
,
"
jar/
launch-with-jarfile.sh"
);
final
String
output
=
doTest
(
os
,
version
,
"launch-with-jarfile.sh"
);
assertThat
(
output
).
contains
(
"app-another.jar"
);
assertThat
(
output
).
doesNotContain
(
"spring-boot-launch-script-tests.jar"
);
}
@ParameterizedTest
(
name
=
"{0} {1}"
)
@MethodSource
(
"parameters"
)
void
launchWithDifferentAppName
(
String
os
,
String
version
)
throws
Exception
{
final
String
output
=
doTest
(
os
,
version
,
"jar/launch-with-app-name.sh"
);
assertThat
(
output
).
contains
(
"All tests are passed."
);
void
launchWithSingleCommandLineArgument
(
String
os
,
String
version
)
throws
Exception
{
doLaunch
(
os
,
version
,
"launch-with-single-command-line-argument.sh"
);
}
@ParameterizedTest
(
name
=
"{0} {1}"
)
@MethodSource
(
"parameters"
)
void
launchWithMultipleCommandLineArguments
(
String
os
,
String
version
)
throws
Exception
{
doLaunch
(
os
,
version
,
"launch-with-multiple-command-line-arguments.sh"
);
}
@ParameterizedTest
(
name
=
"{0} {1}"
)
@MethodSource
(
"parameters"
)
void
launchWithSingleRunArg
(
String
os
,
String
version
)
throws
Exception
{
doLaunch
(
os
,
version
,
"launch-with-single-run-arg.sh"
);
}
@ParameterizedTest
(
name
=
"{0} {1}"
)
@MethodSource
(
"parameters"
)
void
launchWithMultipleRunArgs
(
String
os
,
String
version
)
throws
Exception
{
doLaunch
(
os
,
version
,
"launch-with-multiple-run-args.sh"
);
}
@ParameterizedTest
(
name
=
"{0} {1}"
)
@MethodSource
(
"parameters"
)
void
launchWithSingleJavaOpt
(
String
os
,
String
version
)
throws
Exception
{
doLaunch
(
os
,
version
,
"launch-with-single-java-opt.sh"
);
}
@ParameterizedTest
(
name
=
"{0} {1}"
)
@MethodSource
(
"parameters"
)
void
launchInInitdDir
(
String
os
,
String
version
)
throws
Exception
{
final
String
output
=
doTest
(
os
,
version
,
"jar/launch-in-init.d-dir.sh"
);
assertThat
(
output
).
contains
(
"Usage: ./some_app {start|stop|force-stop|restart|force-reload|status|run}"
);
void
launchWithMultipleJavaOpts
(
String
os
,
String
version
)
throws
Exception
{
doLaunch
(
os
,
version
,
"launch-with-multiple-java-opts.sh"
);
}
}
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java
View file @
84ff2335
This diff is collapsed.
Click to expand it.
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/conf/CentOS/6.9-a23bced6/Dockerfile
View file @
84ff2335
...
...
@@ -7,7 +7,3 @@ RUN yum install -y wget && \
https://cdn.azul.com/zulu/bin/zulu8.21.0.1-jdk8.0.131-linux.x86_64.rpm
&&
\
yum
--nogpg
localinstall
-y
jdk.rpm
&&
\
rm
-f
jdk.rpm
ADD
spring-boot-launch-script-tests.jar /spring-boot-launch-script-tests.jar
ADD
test-functions.sh /test-functions.sh
ADD
init.d/test-functions.sh /init.d/test-functions.sh
ADD
jar/test-functions.sh /jar/test-functions.sh
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/conf/Ubuntu/trusty-20160914/Dockerfile
View file @
84ff2335
...
...
@@ -6,7 +6,3 @@ RUN apt-get update && \
curl
-L
https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u202-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u202b08.tar.gz |
tar
zx
--strip-components
=
1
ENV
JAVA_HOME /opt/openjdk
ENV
PATH $JAVA_HOME/bin:$PATH
ADD
spring-boot-launch-script-tests.jar /spring-boot-launch-script-tests.jar
ADD
test-functions.sh /test-functions.sh
ADD
init.d/test-functions.sh /init.d/test-functions.sh
ADD
jar/test-functions.sh /jar/test-functions.sh
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/conf/Ubuntu/xenial-20160914/Dockerfile
View file @
84ff2335
...
...
@@ -6,7 +6,3 @@ RUN apt-get update && \
curl
-L
https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u202-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u202b08.tar.gz |
tar
zx
--strip-components
=
1
ENV
JAVA_HOME /opt/openjdk
ENV
PATH $JAVA_HOME/bin:$PATH
ADD
spring-boot-launch-script-tests.jar /spring-boot-launch-script-tests.jar
ADD
test-functions.sh /test-functions.sh
ADD
init.d/test-functions.sh /init.d/test-functions.sh
ADD
jar/test-functions.sh /jar/test-functions.sh
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/basic-launch.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
start_service
await_app
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/force-stop-when-stopped.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
force_stop_service
echo
"Status:
$?
"
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/launch-with-double-link-single-java-opt.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_double_link_service
echo
'JAVA_OPTS=-Dserver.port=8081'
>
/test-service/spring-boot-app.conf
start_service
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/launch-with-missing-log-folder.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
echo
'LOG_FOLDER=/does/not/exist'
>
/test-service/spring-boot-app.conf
start_service
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/launch-with-missing-pid-folder.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
echo
'PID_FOLDER=/does/not/exist'
>
/test-service/spring-boot-app.conf
start_service
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/launch-with-multiple-command-line-arguments.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
start_service
--server
.port
=
8081
--server
.servlet.context-path
=
/test
await_app http://127.0.0.1:8081/test/
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/launch-with-multiple-java-opts.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
echo
'JAVA_OPTS="-Dserver.port=8081 -Dserver.servlet.context-path=/test"'
>
/test-service/spring-boot-app.conf
start_service
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/launch-with-multiple-run-args.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
echo
'RUN_ARGS="--server.port=8081 --server.servlet.context-path=/test"'
>
/test-service/spring-boot-app.conf
start_service
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/launch-with-relative-log-folder.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
mkdir
./pid
install_service
echo
'LOG_FOLDER=log'
>
/test-service/spring-boot-app.conf
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/launch-with-relative-pid-folder.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
mkdir
/test-service/pid
echo
'PID_FOLDER=pid'
>
/test-service/spring-boot-app.conf
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/launch-with-run-as-invalid-user.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
echo
'RUN_AS_USER=johndoe'
>
/test-service/spring-boot-app.conf
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/launch-with-run-as-user-preferred-to-jar-owner.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
useradd wagner
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/launch-with-run-as-user-root-required.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
useradd wagner
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/launch-with-run-as-user.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
useradd wagner
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/launch-with-single-command-line-argument.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
start_service
--server
.port
=
8081
await_app http://127.0.0.1:8081/
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/launch-with-single-java-opt.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
echo
'JAVA_OPTS=-Dserver.port=8081'
>
/test-service/spring-boot-app.conf
start_service
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/launch-with-single-run-arg.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
echo
'RUN_ARGS=--server.port=8081'
>
/test-service/spring-boot-app.conf
start_service
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/launch-with-use-of-start-stop-daemon-disabled.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
chmod
-x
$(
type
-p
start-stop-daemon
)
install_service
echo
'USE_START_STOP_DAEMON=false'
>
/test-service/spring-boot-app.conf
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/log-file-ownership-is-changed-when-created.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
echo
'LOG_FOLDER=log'
>
/test-service/spring-boot-app.conf
mkdir
-p
/test-service/log
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/log-file-ownership-is-unchanged-when-exists.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
echo
'LOG_FOLDER=log'
>
/test-service/spring-boot-app.conf
mkdir
-p
/test-service/log
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/log-file-ownership.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
chmod
o+w /var/log
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/pid-file-ownership.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
useradd phil
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/pid-folder-ownership.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
chmod
o+w /var/run
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/restart-when-started.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
start_service
echo
"PID1:
$(
cat
/var/run/spring-boot-app/spring-boot-app.pid
)
"
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/restart-when-stopped.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
restart_service
echo
"Status:
$?
"
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/start-when-started.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
start_service
echo
"PID:
$(
cat
/var/run/spring-boot-app/spring-boot-app.pid
)
"
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/start-when-stopped.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
start_service
echo
"Status:
$?
"
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/status-when-killed.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
start_service
pid
=
$(
cat
/var/run/spring-boot-app/spring-boot-app.pid
)
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/status-when-started.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
start_service
status_service
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/status-when-stopped.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
status_service
echo
"Status:
$?
"
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/stop-when-stopped.sh
View file @
84ff2335
source
./test-functions.sh
source
./init.d/test-functions.sh
install_service
stop_service
echo
"Status:
$?
"
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/init.d/test-functions.sh
View file @
84ff2335
source
../test-functions.sh
await_app
()
{
if
[
-z
$1
]
then
url
=
http://127.0.0.1:8080
else
url
=
$1
fi
end
=
$(
date
+%s
)
let
"end+=30"
until
curl
-s
$url
>
/dev/null
do
now
=
$(
date
+%s
)
if
[[
$now
-ge
$end
]]
;
then
break
fi
sleep
1
done
}
install_service
()
{
mkdir
/test-service
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/jar/basic-launch.sh
View file @
84ff2335
source
./test-functions.sh
source
./jar/test-functions.sh
launch_jar &
await_app
launch_jar
await_app
curl
-s
http://127.0.0.1:8080/
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/jar/launch-in-init.d-dir.sh
deleted
100644 → 0
View file @
02a6a844
source
./test-functions.sh
source
./jar/test-functions.sh
cd
"init.d"
||
exit
1
ln
-s
../spring-boot-launch-script-tests.jar some_app
./some_app
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/jar/launch-with-app-name.sh
deleted
100644 → 0
View file @
02a6a844
source
./test-functions.sh
source
./jar/test-functions.sh
export
APP_NAME
=
"my-new-app"
export
MODE
=
service
./spring-boot-launch-script-tests.jar start
TEST_LOG_FILE
=
"/var/log/
$APP_NAME
.log"
if
[[
(!
(
-e
"
$TEST_LOG_FILE
"
))
||
(!
(
-f
"
$TEST_LOG_FILE
"
))
]]
;
then
echo
Log file
"
$TEST_LOG_FILE
"
doesn
\'
t exists.
exit
2
else
echo
Test
for
a log file is passed.
fi
TEST_PID_FOLDER
=
"/var/run/
$APP_NAME
"
if
[[
(!
(
-e
"
$TEST_PID_FOLDER
"
))
||
(!
(
-d
"
$TEST_PID_FOLDER
"
))
]]
;
then
echo
PID folder
"
$TEST_PID_FOLDER
"
doesn
\'
t exists.
exit
2
else
echo
Test
for
a PID folder is passed.
fi
TEST_PID_FILE
=
"
$TEST_PID_FOLDER
/
$APP_NAME
.pid"
if
[[
(!
(
-e
"
$TEST_PID_FILE
"
))
||
(!
(
-f
"
$TEST_PID_FILE
"
))]]
;
then
echo
PID file
"
$TEST_PID_FILE
"
doesn
\'
t exists.
exit
2
else
echo
Test
for
a PID file is passed.
fi
echo
All tests are passed.
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/jar/launch-with-debug.sh
View file @
84ff2335
export
DEBUG
=
true
source
./test-functions.sh
source
./jar/test-functions.sh
launch_jar &
await_app
launch_jar
await_app
curl
-s
http://127.0.0.1:8080/
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/jar/launch-with-jarfile.sh
View file @
84ff2335
source
./test-functions.sh
source
./jar/test-functions.sh
cp
spring-boot-launch-script-tests.jar app-another.jar
export
JARFILE
=
app-another.jar
launch_jar & await_app
launch_jar
await_app
curl
-s
http://127.0.0.1:8080/
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/jar/launch-with-multiple-command-line-arguments.sh
0 → 100755
View file @
84ff2335
source
./test-functions.sh
launch_jar
--server
.port
=
8081
--server
.servlet.context-path
=
/test
await_app http://127.0.0.1:8081/test/
curl
-s
http://127.0.0.1:8081/test/
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/jar/launch-with-multiple-java-opts.sh
0 → 100755
View file @
84ff2335
source
./test-functions.sh
echo
'JAVA_OPTS="-Dserver.port=8081 -Dserver.servlet.context-path=/test"'
>
spring-boot-launch-script-tests.conf
launch_jar
await_app http://127.0.0.1:8081/test/
curl
-s
http://127.0.0.1:8081/test/
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/jar/launch-with-multiple-run-args.sh
0 → 100755
View file @
84ff2335
source
./test-functions.sh
echo
'RUN_ARGS="--server.port=8081 --server.servlet.context-path=/test"'
>
spring-boot-launch-script-tests.conf
launch_jar
await_app http://127.0.0.1:8081/test/
curl
-s
http://127.0.0.1:8081/test/
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/jar/launch-with-single-command-line-argument.sh
0 → 100755
View file @
84ff2335
source
./test-functions.sh
launch_jar
--server
.port
=
8081
await_app http://127.0.0.1:8081/
curl
-s
http://127.0.0.1:8081/
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/jar/launch-with-single-java-opt.sh
0 → 100755
View file @
84ff2335
source
./test-functions.sh
echo
'JAVA_OPTS=-Dserver.port=8081'
>
spring-boot-launch-script-tests.conf
launch_jar
await_app http://127.0.0.1:8081/
curl
-s
http://127.0.0.1:8081/
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/jar/launch-with-single-run-arg.sh
0 → 100755
View file @
84ff2335
source
./test-functions.sh
echo
'RUN_ARGS=--server.port=8081'
>
/spring-boot-launch-script-tests.conf
launch_jar
await_app http://127.0.0.1:8081/
curl
-s
http://127.0.0.1:8081/
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/jar/test-functions.sh
View file @
84ff2335
await_app
()
{
if
[
-z
$1
]
then
url
=
http://127.0.0.1:8080
else
url
=
$1
fi
end
=
$(
date
+%s
)
let
"end+=30"
until
curl
-s
$url
>
/dev/null
do
now
=
$(
date
+%s
)
if
[[
$now
-ge
$end
]]
;
then
break
fi
sleep
1
done
}
launch_jar
()
{
./spring-boot-launch-script-tests.jar
./spring-boot-launch-script-tests.jar
$@
&
}
spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/test-functions.sh
deleted
100644 → 0
View file @
02a6a844
await_app
()
{
if
[
-z
$1
]
then
url
=
http://127.0.0.1:8080
else
url
=
$1
fi
end
=
$(
date
+%s
)
let
"end+=30"
until
curl
-s
$url
>
/dev/null
do
now
=
$(
date
+%s
)
if
[[
$now
-ge
$end
]]
;
then
break
fi
sleep
1
done
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment