Changes to make PAP container crash with non zero exitCode 36/111036/5
authora.sreekumar <ajith.sreekumar@bell.ca>
Fri, 7 Aug 2020 14:24:10 +0000 (15:24 +0100)
committera.sreekumar <ajith.sreekumar@bell.ca>
Mon, 10 Aug 2020 12:47:13 +0000 (13:47 +0100)
commit894c752c877291f1520d53e0e69b30fc4928fff6
treeb515d174ba38774ecd68a74342b672e345237f7e
parente32cb0265d6950c10a7512868846feeee95f9434
Changes to make PAP container crash with non zero exitCode

Make the application to return exitCode as 1 when the main process
terminates due to issues such as:
1) Any basic issue in the startup config file causing error and
terminates the main process, for e.g. a wrong name in parameterGroup.
2) Wrong info specified for database connectivity, say wrong username.
This doesn't impact a case where database isn't ready yet and PAP
container comes up first, such waiting is already handled by
initContainer in the oom chart. PAP pod waits for policy-mariadb pod to
be ready first, then only the main process is started and comes to this
point.
3) An invalid port number is specified and the rest server is not able
to start.

These are the some of the scenarios which already makes the main process
of PAP to terminate, and in these cases, an exception is thrown now which
returns the exitCode as 1.

Change-Id: Ie48726bcb36d7304eb60807fbaabbee8245e9c70
Issue-ID: POLICY-2754
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
main/src/main/java/org/onap/policy/pap/main/startstop/Main.java
main/src/test/java/org/onap/policy/pap/main/startstop/TestMain.java