@@ -1691,28 +1691,32 @@ func TestWebLogsHeaderRotation(t *testing.T) {
16911691 consoleLogs , errJson := waitForMessageInLog (t , cli , id , "CWWKF0011I" )
16921692 if errJson != nil {
16931693 t .Errorf ("%v" , errJson )
1694- }
1695- //The below variable represents the first message in messages.log of web server, considered as the header message
1696- webLogheader := "product = WebSphere Application Server"
1697-
1698- if ! strings .Contains (consoleLogs , webLogheader ) {
1699- t .Errorf ("Console log is without web server header message\n \" %v\" " , consoleLogs )
1700- }
1701-
1702- // Stop the container cleanly
1703- stopContainer (t , cli , id )
1704- startContainer (t , cli , id )
1705- waitForReady (t , cli , id )
1694+ //If there is error jump to last step and stop the container, else continue
1695+ } else {
1696+ //The below variable represents the first message in messages.log of web server, considered as the header message
1697+ webLogheader := "product = WebSphere Application Server"
17061698
1707- consoleLogs2 , errJson := waitForMessageCountInLog (t , cli , id , "CWWKF0011I" , 2 )
1708- if errJson != nil {
1709- t .Errorf ("%v" , errJson )
1710- }
1711- t .Logf ("Total headers found is %v" , strings .Count (consoleLogs2 , webLogheader ))
1712- if strings .Count (consoleLogs2 , webLogheader ) != 2 {
1713- t .Errorf ("Console logs do not contain header message after restart \" %v\" " , consoleLogs2 )
1699+ if ! strings .Contains (consoleLogs , webLogheader ) {
1700+ t .Errorf ("Console log is without web server header message\n \" %v\" " , consoleLogs )
1701+ //If there is error jump to last step and stop the container, else continue
1702+ } else {
1703+ // Stop the container cleanly
1704+ stopContainer (t , cli , id )
1705+ startContainer (t , cli , id )
1706+ waitForReady (t , cli , id )
1707+
1708+ consoleLogs2 , errJson := waitForMessageCountInLog (t , cli , id , "CWWKF0011I" , 2 )
1709+ if errJson != nil {
1710+ t .Errorf ("%v" , errJson )
1711+ //If there is error jump to last step and stop the container, else continue
1712+ } else {
1713+ t .Logf ("Total headers found is %v" , strings .Count (consoleLogs2 , webLogheader ))
1714+ if strings .Count (consoleLogs2 , webLogheader ) != 2 {
1715+ t .Errorf ("Console logs do not contain header message after restart \" %v\" " , consoleLogs2 )
1716+ }
1717+ }
1718+ }
17141719 }
1715-
17161720 // Stop the container cleanly
17171721 stopContainer (t , cli , id )
17181722}
0 commit comments