fix
This commit is contained in:
parent
a7337a26e1
commit
8efe13db42
@ -22,6 +22,8 @@ import org.springframework.stereotype.Component;
|
|||||||
@Component
|
@Component
|
||||||
public class UpgradeTaskRunner {
|
public class UpgradeTaskRunner {
|
||||||
|
|
||||||
|
private static final int DETACHED_RESTART_DELAY_SECONDS = 5;
|
||||||
|
|
||||||
private final UpgradeTaskRepository upgradeTaskRepository;
|
private final UpgradeTaskRepository upgradeTaskRepository;
|
||||||
private final FileRecordRepository fileRecordRepository;
|
private final FileRecordRepository fileRecordRepository;
|
||||||
private final DeviceSoftwareVersionRepository deviceSoftwareVersionRepository;
|
private final DeviceSoftwareVersionRepository deviceSoftwareVersionRepository;
|
||||||
@ -250,6 +252,7 @@ public class UpgradeTaskRunner {
|
|||||||
+ "APP_HOME=\"${APP_HOME:-/home/tms}\"; "
|
+ "APP_HOME=\"${APP_HOME:-/home/tms}\"; "
|
||||||
+ "RUN_DIR=\"${RUN_DIR:-${APP_HOME}/run}\"; "
|
+ "RUN_DIR=\"${RUN_DIR:-${APP_HOME}/run}\"; "
|
||||||
+ "PENDING_META=\"${RUN_DIR}/tms-upgrade.pending-jar\"; "
|
+ "PENDING_META=\"${RUN_DIR}/tms-upgrade.pending-jar\"; "
|
||||||
|
+ "sleep " + DETACHED_RESTART_DELAY_SECONDS + "; "
|
||||||
+ "\"${APP_HOME}/scripts/tms.sh\" stop; "
|
+ "\"${APP_HOME}/scripts/tms.sh\" stop; "
|
||||||
+ "if [ -s \"${PENDING_META}\" ]; then "
|
+ "if [ -s \"${PENDING_META}\" ]; then "
|
||||||
+ "PENDING_JAR=\"$(cat \"${PENDING_META}\")\"; "
|
+ "PENDING_JAR=\"$(cat \"${PENDING_META}\")\"; "
|
||||||
|
|||||||
@ -188,7 +188,9 @@ class UpgradeTaskRunnerTest {
|
|||||||
|
|
||||||
Assertions.assertTrue(command.contains("PENDING_META"));
|
Assertions.assertTrue(command.contains("PENDING_META"));
|
||||||
Assertions.assertTrue(command.contains("tms-upgrade.pending-jar"));
|
Assertions.assertTrue(command.contains("tms-upgrade.pending-jar"));
|
||||||
|
Assertions.assertTrue(command.contains("sleep 5"));
|
||||||
Assertions.assertTrue(command.contains("cp \"${PENDING_JAR}\" \"${APP_HOME}/tms-framework.jar\""));
|
Assertions.assertTrue(command.contains("cp \"${PENDING_JAR}\" \"${APP_HOME}/tms-framework.jar\""));
|
||||||
|
Assertions.assertTrue(command.indexOf("sleep 5") < command.indexOf("\"${APP_HOME}/scripts/tms.sh\" stop"));
|
||||||
Assertions.assertTrue(command.indexOf("\"${APP_HOME}/scripts/tms.sh\" stop") < command.indexOf("cp \"${PENDING_JAR}\""));
|
Assertions.assertTrue(command.indexOf("\"${APP_HOME}/scripts/tms.sh\" stop") < command.indexOf("cp \"${PENDING_JAR}\""));
|
||||||
Assertions.assertTrue(command.indexOf("cp \"${PENDING_JAR}\"") < command.indexOf("\"${APP_HOME}/scripts/tms.sh\" start"));
|
Assertions.assertTrue(command.indexOf("cp \"${PENDING_JAR}\"") < command.indexOf("\"${APP_HOME}/scripts/tms.sh\" start"));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user