Bk-1949-fix (#393)

* fixing test failrues

* made changes

* corrected indentation

* incorporated review comments
This commit is contained in:
BHAVYA K R
2023-02-06 17:13:47 +05:30
committed by GitHub Enterprise
parent 26195d1bd9
commit 572e883841
2 changed files with 55 additions and 40 deletions

View File

@@ -964,6 +964,24 @@ func testLogFilePages(t *testing.T, cli *client.Client, id string, qmName string
}
}
//waitForMessageInLog will check for a particular message with wait
func waitForMessageInLog(t *testing.T, cli *client.Client, id string, expecteMessageId string) (string, error) {
var jsonLogs string
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
defer cancel()
for {
select {
case <-time.After(1 * time.Second):
jsonLogs = inspectLogs(t, cli, id)
if strings.Contains(jsonLogs, expecteMessageId) {
return jsonLogs, nil
}
case <-ctx.Done():
return "", fmt.Errorf("Expected message Id %s was not logged.", expecteMessageId)
}
}
}
// Returns fully qualified path
func tlsDirDN(t *testing.T, unixPath bool, certPath string) string {
return filepath.Join(getCwd(t, unixPath), certPath)