Make 'qmgr' logs as default (#401)

* Required updates

* Update docker_api_test.go
This commit is contained in:
Avinash Ganesh
2023-02-08 16:34:10 +05:30
committed by GitHub Enterprise
parent 167ec03f04
commit b47ad7fde2
3 changed files with 11 additions and 11 deletions

View File

@@ -371,7 +371,7 @@ func getMQLogConsoleSource() string {
func isLogConsoleSourceValid() bool {
mqLogSource := getMQLogConsoleSource()
retValue := false
//If nothing is set, we will mirror all, so valid
//If nothing is set, we will mirror qmgr, so valid
if mqLogSource == "" {
return true
}
@@ -396,9 +396,14 @@ func isLogConsoleSourceValid() bool {
func checkLogSourceForMirroring(source string) bool {
logsrcs := getMQLogConsoleSource()
//Nothing set, this is when we mirror all
//Nothing set, this is when we mirror qmgr
if logsrcs == "" {
return true
if source == "qmgr" {
return true
} else {
return false
}
}
//Split the csv environment value so that we get an accurate comparison instead of a contains() check

View File

@@ -67,7 +67,7 @@ var mqLogSourcesTests = []struct {
{2, "qmgr", true, true, false},
{3, "web,qmgr", true, true, true},
{4, "web", true, false, true},
{5, " ", true, true, true},
{5, " ", true, true, false},
{6, "QMGR,WEB", true, true, true},
{7, "qmgr, ", true, true, false},
{8, "qmgr , web", true, true, true},
@@ -77,7 +77,7 @@ var mqLogSourcesTests = []struct {
{12, "fake,dummy,web", false, false, true},
{13, "true", false, false, false},
{14, "false", false, false, false},
{15, "", true, true, true},
{15, "", true, true, false},
}
func TestLoggingConsoleSourceInputs(t *testing.T) {

View File

@@ -1520,11 +1520,6 @@ func TestLoggingConsoleSource(t *testing.T) {
t.Errorf("%v", errJson)
}
jsonLogs, errJson = waitForMessageInLog(t, cli, id, "CWWKF0011I")
if errJson != nil {
t.Errorf("%v", errJson)
}
isMessageFound := scanForExcludedEntries(jsonLogs)
if isMessageFound == true {
@@ -1669,7 +1664,7 @@ func TestLoggingWithQmgrAndExcludeId(t *testing.T) {
t.Fatalf("Expected all log lines to be valid JSON. But got error %v ", err)
}
if strings.Contains(jsonLogs, "AMQ7230I") || strings.Contains(jsonLogs, "CWWKF0011I") {
if strings.Contains(jsonLogs, "AMQ7230I") || strings.Contains(jsonLogs, "CWWKF0011I") {
t.Errorf("Expected to exclude messageId by default; but messageId \"%v\" is present", jsonLogs)
}