Updated WaitForProcessToFinish to look for DONE

This commit is contained in:
Darren Gehring 2021-03-30 12:45:09 -07:00
Родитель ab25725a28
Коммит 3707d50f1b
10 изменённых файлов: 52 добавлений и 35 удалений

Просмотреть файл

@ -425,7 +425,7 @@ namespace AmbrosiaTest
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server1_Restarted, byteSize, 5, false, testName, true);
// Also verify ImmCoord has the string to show it is primary
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord3, newPrimary, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord3, newPrimary, 5, false, testName, true,false);
// Stop things so file is freed up and can be opened in verify
MyUtils.KillProcess(serverProcessID2);

Просмотреть файл

@ -172,7 +172,7 @@ namespace AmbrosiaTest
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server1_Restarted, byteSize, 15, false, testName, true);
// Also verify ImmCoord has the string to show it is primary
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord3, newPrimary, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord3, newPrimary, 5, false, testName, true, false);
// Stop things so file is freed up and can be opened in verify
MyUtils.KillProcess(serverProcessID2);
@ -954,8 +954,8 @@ namespace AmbrosiaTest
MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_Server3);
// Also verify ImmCoord has the string to show it is primary for both server and client
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord3, newPrimary, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord6, newPrimary, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord3, newPrimary, 5, false, testName, true,false);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord6, newPrimary, 5, false, testName, true,false);
// Verify integrity of Ambrosia logs by replaying
MyUtils.VerifyAmbrosiaLogFile(testName, Convert.ToInt64(byteSize), true, true, AMB1.AMB_Version);
@ -1402,8 +1402,8 @@ namespace AmbrosiaTest
// Also verify ImmCoord has the string to show server3 was primary then server4 became primary
//*** Note - can't verify which one will be primary because both Server3 and Server4 are secondary
//** They both are trying to take over primary if it dies. No way of knowing which one is.
//pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord3, newPrimary, 1, false, testName, true);
//pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord4, newPrimary, 1, false, testName, true);
//pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord3, newPrimary, 1, false, testName, true,false);
//pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord4, newPrimary, 1, false, testName, true,false);
// Stop things so file is freed up and can be opened in verify
MyUtils.KillProcess(serverProcessID2);

Просмотреть файл

@ -569,7 +569,7 @@ namespace AmbrosiaTest
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server1_Restarted, byteSize, 15, false, testName, true);
// Also verify ImmCoord has the string to show it is primary
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord3, newPrimary, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord3, newPrimary, 5, false, testName, true,false);
// Stop things so file is freed up and can be opened in verify
MyUtils.KillProcess(serverProcessID2);
@ -845,8 +845,8 @@ namespace AmbrosiaTest
// really reliable. As long as they get through whole thing, that is what counts.
// Verify ImmCoord has the string to show it is primary for both server and client
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord2_Restarted, newPrimary, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord5_Restarted, newPrimary, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord2_Restarted, newPrimary, 5, false, testName, true,false);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord5_Restarted, newPrimary, 5, false, testName, true,false);
// Verify integrity of Ambrosia logs by replaying
MyUtils.VerifyAmbrosiaLogFile(testName, Convert.ToInt64(byteSize), true, true, AMB1.AMB_Version, "", true);

Просмотреть файл

@ -1189,14 +1189,14 @@ namespace AmbrosiaTest
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server1_upgraded, byteSize, 5, false, testName, true);
// Also verify ImmCoord has the string to show it is it killed itself and others killed off too
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord1, upgradingImmCoordPrimary, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord1_Upgraded, newPrimary, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord2, immCoordKilledMessage, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord3, immCoordKilledMessage, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server1, serverKilledMessage, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server1, serverKilledMessage, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server2, serverKilledMessage, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server1_upgraded, serverUpgradePrimary, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord1, upgradingImmCoordPrimary, 5, false, testName, true,false);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord1_Upgraded, newPrimary, 5, false, testName, true,false);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord2, immCoordKilledMessage, 5, false, testName, true,false);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord3, immCoordKilledMessage, 5, false, testName, true,false);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server1, serverKilledMessage, 5, false, testName, true,false);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server1, serverKilledMessage, 5, false, testName, true,false);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server2, serverKilledMessage, 5, false, testName, true,false);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server1_upgraded, serverUpgradePrimary, 5, false, testName, true,false);
// Stop things so file is freed up and can be opened in verify
MyUtils.KillProcess(serverProcessID_upgraded);
@ -1570,7 +1570,7 @@ namespace AmbrosiaTest
MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_Server);
// verify ImmCoord has the string to show it failed because of bad IP ...
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord_Bad, overrideIPAddress, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord_Bad, overrideIPAddress, 5, false, testName, true,false);
// Verify integrity of Ambrosia logs by replaying
MyUtils.VerifyAmbrosiaLogFile(testName, Convert.ToInt64(byteSize), true, true, AMB1.AMB_Version);
@ -1673,7 +1673,7 @@ namespace AmbrosiaTest
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server_Restarted, byteSize, 20, false, testName, true);
// verify actually killed first one
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord1, killJobMessage, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ImmCoord1, killJobMessage, 5, false, testName, true,false);
// Stop things so file is freed up and can be opened in verify
MyUtils.KillProcess(clientJobProcessID_Restarted);

Просмотреть файл

@ -381,7 +381,7 @@ namespace AmbrosiaTest
MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_Server_Restarted);
// check message - comes from Imm Coord so won't show in Job for InProc
//pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, killJobMessage, 5, false, testName, true);
//pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, killJobMessage, 5, false, testName, true,false);
// Verify integrity of Ambrosia logs by replaying
MyUtils.VerifyAmbrosiaLogFile(testName, Convert.ToInt64(byteSize), true, true, AMB1.AMB_Version);
@ -1159,7 +1159,7 @@ namespace AmbrosiaTest
MyUtils.KillProcess(serverProcessID_upgraded);
// Also verify upgraded server showing new upgraded primary
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server_upgraded, newUpgradedPrimary, 5, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server_upgraded, newUpgradedPrimary, 5, false, testName, true,false);
// Verify Client
MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_ClientJob);

Просмотреть файл

@ -759,7 +759,7 @@ namespace AmbrosiaTest
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server_Restarted, byteSize, 20, false, testName, true);
// verify actually killed first one - this output was from Imm Coord but not showing any more
//pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, killJobMessage, 5, false, testName, true);
//pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, killJobMessage, 5, false, testName, true,false);
// Stop things so file is freed up and can be opened in verify
MyUtils.KillProcess(clientJobProcessID_Restarted);

Просмотреть файл

@ -54,8 +54,8 @@ namespace AmbrosiaTest
int JSTestAppID = JSUtils.StartJSNodeUnitTests(logOutputFileName_TestApp);
// Wait until summary at the end and if not there, then know not finished
bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_TestApp, finishedString, 2, false, testName, true);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_TestApp, successString, 1, false, testName, true);
bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_TestApp, finishedString, 2, false, testName, true,false);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_TestApp, successString, 1, false, testName, true,false);
}
}

Просмотреть файл

@ -54,14 +54,14 @@ namespace AmbrosiaTest
// Verify things differently if it is a negative test
if (NegTest)
{
pass = MyUtils.WaitForProcessToFinish(testOutputLogFile, CodeGenFailMessage, 1, false, TestFile, true);
pass = MyUtils.WaitForProcessToFinish(testOutputLogFile, CodeGenFailMessage, 1, false, TestFile, true,false);
}
else
{
// Wait to see if success comes shows up in log file for total and for consumer and publisher
pass = MyUtils.WaitForProcessToFinish(testOutputLogFile, CodeGenSuccessMessage, 1, false, TestFile, true);
pass = MyUtils.WaitForProcessToFinish(testOutputLogFile, ConSuccessString, 1, false, TestFile, true);
pass = MyUtils.WaitForProcessToFinish(testOutputLogFile, PubSuccessString, 1, false, TestFile, true);
pass = MyUtils.WaitForProcessToFinish(testOutputLogFile, CodeGenSuccessMessage, 1, false, TestFile, true,false);
pass = MyUtils.WaitForProcessToFinish(testOutputLogFile, ConSuccessString, 1, false, TestFile, true,false);
pass = MyUtils.WaitForProcessToFinish(testOutputLogFile, PubSuccessString, 1, false, TestFile, true,false);
// Verify the generated files with cmp files
string GenConsumerFile = TestName + "_GeneratedConsumerInterface.g.ts";
@ -73,11 +73,11 @@ namespace AmbrosiaTest
// Can use these to verify extra messages in the log file
if (ExtraConErrorMessage != "")
{
pass = MyUtils.WaitForProcessToFinish(testOutputLogFile, ExtraConErrorMessage, 1, false, TestFile, true);
pass = MyUtils.WaitForProcessToFinish(testOutputLogFile, ExtraConErrorMessage, 1, false, TestFile, true,false);
}
if (ExtraPubErrorMessage != "")
{
pass = MyUtils.WaitForProcessToFinish(testOutputLogFile, ExtraPubErrorMessage, 1, false, TestFile, true);
pass = MyUtils.WaitForProcessToFinish(testOutputLogFile, ExtraPubErrorMessage, 1, false, TestFile, true,false);
}
}

Просмотреть файл

@ -173,8 +173,8 @@ namespace AmbrosiaTest
// Verify client / server have proper bytes
MyUtils.VerifyBytesRecievedInTwoLogFiles(logOutputFileName_ClientJob, logOutputFileName_Server);
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, totalNumBytesReceived.ToString(), 1, false, testName, true); // Total bytes received
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server, totalNumBytesReceived.ToString(), 1, false, testName, true); // Total bytes received
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, totalNumBytesReceived.ToString(), 1, false, testName, true,false); // Total bytes received
pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server, totalNumBytesReceived.ToString(), 1, false, testName, true,false); // Total bytes received
// Verify integrity of Ambrosia logs by replaying - do NOT check cmp files because MTF can change run to run
MyUtils.VerifyAmbrosiaLogFile(testName, totalNumBytesReceived, false, false, AMB1.AMB_Version);

Просмотреть файл

@ -162,7 +162,7 @@ namespace AmbrosiaTest
// is hit or until maxDelay (mins) is hit
// After the doneString is found it also determines if the extraStringToFind is part of it as well.
// ASSUMPTION: done string is always after the extra string - so if extra string is not found by time it hits DONE, then know it isn't in output
public bool WaitForProcessToFinish(string logFile, string extraStringToFind, int maxDelay, bool truncateAmbrosiaLogs, string testName, bool assertOnFalseReturn)
public bool WaitForProcessToFinish(string logFile, string extraStringToFind, int maxDelay, bool truncateAmbrosiaLogs, string testName, bool assertOnFalseReturn, bool checkForDoneString = true)
{
int timeCheckInterval = 10000; // 10 seconds
int maxTimeLoops = (maxDelay * 60000) / timeCheckInterval;
@ -182,8 +182,18 @@ namespace AmbrosiaTest
{
string line = logFileReader.ReadLine();
if (line.Contains(extraStringToFind))
{
foundExtraString = true;
// since not looking for done, need to close things down here
if (checkForDoneString == false)
{
logFileReader.Close();
logFileStream.Close();
return true;
}
}
if (line.Contains(doneString))
{
logFileReader.Close();
@ -215,8 +225,15 @@ namespace AmbrosiaTest
FailureSupport(testName);
// If times out without string hit - then pop exception
Assert.Fail("<WaitForProcessToFinish> Failure! Looking for '"+ doneString + "' string AND the extra string:" + extraStringToFind + " in log file:" + logFile + " but did not find one or both after waiting:" + maxDelay.ToString() + " minutes.");
if (checkForDoneString)
{
Assert.Fail("<WaitForProcessToFinish> Failure! Looking for '" + doneString + "' string AND the extra string:" + extraStringToFind + " in log file:" + logFile + " but did not find one or both after waiting:" + maxDelay.ToString() + " minutes.");
}
else
{
Assert.Fail("<WaitForProcessToFinish> Failure! Looking for string:" + extraStringToFind + " in log file:" + logFile + " but did not find it after waiting:" + maxDelay.ToString() + " minutes.");
}
}
return false; // made it this far, we know it is a false