Added endMQM options and tests
This commit is contained in:
committed by
Stephen D Marshall
parent
176a023a99
commit
88bcaaecc3
@@ -99,6 +99,7 @@ RUN chmod ug+x /usr/local/bin/runmqserver \
|
|||||||
&& chmod 0660 /run/termination-log
|
&& chmod 0660 /run/termination-log
|
||||||
# Always use port 1414 for MQ & 9157 for the metrics
|
# Always use port 1414 for MQ & 9157 for the metrics
|
||||||
EXPOSE 1414 9157 9443
|
EXPOSE 1414 9157 9443
|
||||||
|
ENV QMGRACEPERIOD=30
|
||||||
ENV LANG=en_US.UTF-8 AMQ_DIAGNOSTIC_MSG_SEVERITY=1 AMQ_ADDITIONAL_JSON_LOG=1 LOG_FORMAT=basic
|
ENV LANG=en_US.UTF-8 AMQ_DIAGNOSTIC_MSG_SEVERITY=1 AMQ_ADDITIONAL_JSON_LOG=1 LOG_FORMAT=basic
|
||||||
USER $MQM_UID
|
USER $MQM_UID
|
||||||
ENTRYPOINT ["runmqserver"]
|
ENTRYPOINT ["runmqserver"]
|
||||||
|
|||||||
@@ -173,17 +173,18 @@ func configureQueueManager() error {
|
|||||||
|
|
||||||
func stopQueueManager(name string) error {
|
func stopQueueManager(name string) error {
|
||||||
log.Println("Stopping queue manager")
|
log.Println("Stopping queue manager")
|
||||||
|
qmGracePeriod := os.Getenv("QMGRACEPERIOD")
|
||||||
isStandby, err := ready.IsRunningAsStandbyQM(name)
|
isStandby, err := ready.IsRunningAsStandbyQM(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error getting status for queue manager %v: %v", name, err.Error())
|
log.Printf("Error getting status for queue manager %v: %v", name, err.Error())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
args := []string{"-w", "-r", name}
|
args := []string{"-w", "-r", "-tp", qmGracePeriod, name}
|
||||||
if os.Getenv("MQ_MULTI_INSTANCE") == "true" {
|
if os.Getenv("MQ_MULTI_INSTANCE") == "true" {
|
||||||
if isStandby {
|
if isStandby {
|
||||||
args = []string{"-x", name}
|
args = []string{"-x", name}
|
||||||
} else {
|
} else {
|
||||||
args = []string{"-s", "-w", "-r", name}
|
args = []string{"-s", "-w", "-r", "-tp", qmGracePeriod, name}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out, rc, err := command.Run("endmqm", args...)
|
out, rc, err := command.Run("endmqm", args...)
|
||||||
|
|||||||
@@ -75,6 +75,29 @@ func TestLicenseView(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Start a container with qm grace set to x seconds
|
||||||
|
//Check that when the container is stopped that the command endmqm has option -tp and x
|
||||||
|
func TestEndMQMOpts(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
cli, err := client.NewEnvClient()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
containerConfig := container.Config{
|
||||||
|
Env: []string{"LICENSE=accept", "QMGRACEPERIOD=27"},
|
||||||
|
}
|
||||||
|
|
||||||
|
id := runContainer(t, cli, &containerConfig)
|
||||||
|
defer cleanContainer(t, cli, id)
|
||||||
|
waitForReady(t, cli, id)
|
||||||
|
killContainer(t, cli, id, "SIGTERM")
|
||||||
|
_, out := execContainer(t, cli, id, "mqm", []string{"bash", "-c", "ps -ef | grep 'endmqm -w -r -tp 27'"})
|
||||||
|
t.Log(out)
|
||||||
|
if !strings.Contains(out, "endmqm -w -r -tp 27") {
|
||||||
|
t.Errorf("Expected endmqm options endmqm -w -r -tp 27; got \"%v\"", out)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TestGoldenPath starts a queue manager successfully when metrics are enabled
|
// TestGoldenPath starts a queue manager successfully when metrics are enabled
|
||||||
func TestGoldenPathWithMetrics(t *testing.T) {
|
func TestGoldenPathWithMetrics(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|||||||
Reference in New Issue
Block a user