Added enable trace option to strmqm, Temporarily removing dist tag as not supported by power build (#57)
* Added enable trace option to strmqm * Temporarily removing dist tag as not supported by power build
This commit is contained in:
committed by
GitHub Enterprise
parent
f94d1b8af5
commit
4cab3e8d3b
@@ -12,7 +12,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
dist: xenial
|
# Temporarily removing dist tag as not supported by power build
|
||||||
|
# dist: xenial
|
||||||
|
|
||||||
sudo: required
|
sudo: required
|
||||||
language: go
|
language: go
|
||||||
|
|||||||
@@ -176,11 +176,29 @@ func doMain() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enableTraceStrmqm := os.Getenv("MQ_ENABLE_TRACE_STRMQM")
|
||||||
|
if enableTraceStrmqm == "true" || enableTraceStrmqm == "1" {
|
||||||
|
err = startMQTrace()
|
||||||
|
if err != nil {
|
||||||
|
logTermination(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err = startQueueManager(name)
|
err = startQueueManager(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logTermination(err)
|
logTermination(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if enableTraceStrmqm == "true" || enableTraceStrmqm == "1" {
|
||||||
|
err = endMQTrace()
|
||||||
|
if err != nil {
|
||||||
|
logTermination(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if standby, _ := ready.IsRunningAsStandbyQM(name); !standby {
|
if standby, _ := ready.IsRunningAsStandbyQM(name); !standby {
|
||||||
err = configureQueueManager()
|
err = configureQueueManager()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -199,6 +199,28 @@ func stopQueueManager(name string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func startMQTrace() error {
|
||||||
|
log.Println("Starting MQ trace")
|
||||||
|
out, rc, err := command.Run("strmqtrc")
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error %v starting trace: %v", rc, string(out))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
log.Println("Started MQ trace")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func endMQTrace() error {
|
||||||
|
log.Println("Ending MQ Trace")
|
||||||
|
out, rc, err := command.Run("endmqtrc")
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error %v ending trace: %v", rc, string(out))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
log.Println("Ended MQ trace")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func formatMQSCOutput(out string) string {
|
func formatMQSCOutput(out string) string {
|
||||||
// redact sensitive information
|
// redact sensitive information
|
||||||
out, _ = mqscredact.Redact(out)
|
out, _ = mqscredact.Redact(out)
|
||||||
|
|||||||
@@ -1366,3 +1366,27 @@ func TestVersioning(t *testing.T) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestTraceStrmqm(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
cli, err := client.NewEnvClient()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
containerConfig := container.Config{
|
||||||
|
Env: []string{
|
||||||
|
"LICENSE=accept",
|
||||||
|
"MQ_ENABLE_TRACE_STRMQM=1",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
id := runContainer(t, cli, &containerConfig)
|
||||||
|
defer cleanContainer(t, cli, id)
|
||||||
|
waitForReady(t, cli, id)
|
||||||
|
|
||||||
|
rc, _ := execContainer(t, cli, id, "mqm", []string{"bash", "-c", "ls -A /var/mqm/trace | grep .TRC"})
|
||||||
|
if rc != 0 {
|
||||||
|
t.Fatalf("No trace files found in trace directory /var/mqm/trace. RC=%d.", rc)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user