public void AMB_Async_ActiveActive_BasicTest() { string testName = "asyncactiveactivebasic"; string clientJobName = testName + "clientjob"; string serverName = testName + "server"; string ambrosiaLogDir = ConfigurationManager.AppSettings["AmbrosiaLogDirectory"] + "\\"; string byteSize = "2147483648"; string newPrimary = "NOW I'm Primary"; Utilities MyUtils = new Utilities(); //AMB1 - primary string logOutputFileName_AMB1 = testName + "_AMB1.log"; AMB_Settings AMB1 = new AMB_Settings { AMB_ServiceName = serverName, AMB_PortAppReceives = "1000", AMB_PortAMBSends = "1001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "Y", AMB_Version = "0" }; MyUtils.CallAMB(AMB1, logOutputFileName_AMB1, AMB_ModeConsts.RegisterInstance); //AMB2 - check pointer string logOutputFileName_AMB2 = testName + "_AMB2.log"; AMB_Settings AMB2 = new AMB_Settings { AMB_ReplicaNumber = "1", AMB_ServiceName = serverName, AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "Y", AMB_Version = "0" }; MyUtils.CallAMB(AMB2, logOutputFileName_AMB2, AMB_ModeConsts.AddReplica); //AMB3 - active secondary string logOutputFileName_AMB3 = testName + "_AMB3.log"; AMB_Settings AMB3 = new AMB_Settings { AMB_ReplicaNumber = "2", AMB_ServiceName = serverName, AMB_PortAppReceives = "3000", AMB_PortAMBSends = "3001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "Y", AMB_Version = "0" }; MyUtils.CallAMB(AMB3, logOutputFileName_AMB3, AMB_ModeConsts.AddReplica); //AMB4 - Job string logOutputFileName_AMB4 = testName + "_AMB4.log"; AMB_Settings AMB4 = new AMB_Settings { AMB_ServiceName = clientJobName, AMB_PortAppReceives = "4000", AMB_PortAMBSends = "4001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB4, logOutputFileName_AMB4, AMB_ModeConsts.RegisterInstance); //ImmCoord1 string logOutputFileName_ImmCoord1 = testName + "_ImmCoord1.log"; int ImmCoordProcessID1 = MyUtils.StartImmCoord(serverName, 1500, logOutputFileName_ImmCoord1, true, 0); //ImmCoord2 string logOutputFileName_ImmCoord2 = testName + "_ImmCoord2.log"; int ImmCoordProcessID2 = MyUtils.StartImmCoord(serverName, 2500, logOutputFileName_ImmCoord2, true, 1); //ImmCoord3 string logOutputFileName_ImmCoord3 = testName + "_ImmCoord3.log"; int ImmCoordProcessID3 = MyUtils.StartImmCoord(serverName, 3500, logOutputFileName_ImmCoord3, true, 2); //ImmCoord4 string logOutputFileName_ImmCoord4 = testName + "_ImmCoord4.log"; int ImmCoordProcessID4 = MyUtils.StartImmCoord(clientJobName, 4500, logOutputFileName_ImmCoord4); //Server Call - primary string logOutputFileName_Server1 = testName + "_Server1.log"; int serverProcessID1 = MyUtils.StartAsyncPerfServer("1001", "1000", serverName, logOutputFileName_Server1); Thread.Sleep(1000); // give a second to make it a primary //Server Call - checkpointer string logOutputFileName_Server2 = testName + "_Server2.log"; int serverProcessID2 = MyUtils.StartAsyncPerfServer("2001", "2000", serverName, logOutputFileName_Server2); Thread.Sleep(1000); // give a second //Server Call - active secondary string logOutputFileName_Server3 = testName + "_Server3.log"; int serverProcessID3 = MyUtils.StartAsyncPerfServer("3001", "3000", serverName, logOutputFileName_Server3); //start Client Job string logOutputFileName_ClientJob = testName + "_ClientJob.log"; int clientJobProcessID = MyUtils.StartAsyncPerfClientJob("4001", "4000", clientJobName, serverName, "2", logOutputFileName_ClientJob); // Give it 10 seconds to do something before killing it Thread.Sleep(10000); Application.DoEvents(); // if don't do this ... system sees thread as blocked thread and throws message. //Kill Primary Server (server1) at this point as well as ImmCoord1 MyUtils.KillProcess(serverProcessID1); MyUtils.KillProcess(ImmCoordProcessID1); // at this point, server3 (active secondary) becomes primary Thread.Sleep(1000); //Restart server1 (ImmCoord1 and server) ... this will become active secondary now string logOutputFileName_ImmCoord1_Restarted = testName + "_ImmCoord1_Restarted.log"; int ImmCoordProcessID1_Restarted = MyUtils.StartImmCoord(serverName, 1500, logOutputFileName_ImmCoord1_Restarted, true, 0); string logOutputFileName_Server1_Restarted = testName + "_Server1_Restarted.log"; int serverProcessID_Restarted1 = MyUtils.StartAsyncPerfServer("1001", "1000", serverName, logOutputFileName_Server1_Restarted); //Delay until finished ... looking at the most recent primary (server3) but also verify others hit done too bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server3, byteSize, 55, false, testName, true); // Total Bytes received needs to be accurate pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, byteSize, 15, false, testName, true); pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server2, byteSize, 15, false, testName, true); 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); // Stop things so file is freed up and can be opened in verify MyUtils.KillProcess(serverProcessID2); MyUtils.KillProcess(serverProcessID_Restarted1); MyUtils.KillProcess(serverProcessID3); // primary MyUtils.KillProcess(clientJobProcessID); MyUtils.KillProcess(ImmCoordProcessID2); MyUtils.KillProcess(ImmCoordProcessID3); MyUtils.KillProcess(ImmCoordProcessID1_Restarted); MyUtils.KillProcess(ImmCoordProcessID4); // Verify cmp files for client and 3 servers MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_ClientJob); MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_Server1); MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_Server1_Restarted); MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_Server2); MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_Server3); // Verify integrity of Ambrosia logs by replaying MyUtils.VerifyAmbrosiaLogFile(testName, Convert.ToInt64(byteSize), true, true, AMB1.AMB_Version, "", true); }
public void AMB_Async_ActiveActive_KillAllTest() { string testName = "asyncactiveactivekillall"; string clientJobName = testName + "clientjob"; string serverName = testName + "server"; string ambrosiaLogDir = ConfigurationManager.AppSettings["AmbrosiaLogDirectory"] + "\\"; string byteSize = "1073741824"; string newPrimary = "NOW I'm Primary"; // If failures in queue, set a flag to not run tests or clean up - helps debug tests that failed by keeping in proper state Utilities MyUtils = new Utilities(); //AMB1 - primary server string logOutputFileName_AMB1 = testName + "_AMB1.log"; AMB_Settings AMB1 = new AMB_Settings { AMB_ServiceName = serverName, AMB_PortAppReceives = "1000", AMB_PortAMBSends = "1001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "Y", AMB_Version = "0" }; MyUtils.CallAMB(AMB1, logOutputFileName_AMB1, AMB_ModeConsts.RegisterInstance); //AMB2 - check pointer server string logOutputFileName_AMB2 = testName + "_AMB2.log"; AMB_Settings AMB2 = new AMB_Settings { AMB_ServiceName = serverName, AMB_ReplicaNumber = "1", AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "Y", AMB_Version = "0" }; MyUtils.CallAMB(AMB2, logOutputFileName_AMB2, AMB_ModeConsts.AddReplica); //AMB3 - active secondary server string logOutputFileName_AMB3 = testName + "_AMB3.log"; AMB_Settings AMB3 = new AMB_Settings { AMB_ServiceName = serverName, AMB_ReplicaNumber = "2", AMB_PortAppReceives = "3000", AMB_PortAMBSends = "3001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "Y", AMB_Version = "0" }; MyUtils.CallAMB(AMB3, logOutputFileName_AMB3, AMB_ModeConsts.AddReplica); //AMB4 - Job primary string logOutputFileName_AMB4 = testName + "_AMB4.log"; AMB_Settings AMB4 = new AMB_Settings { AMB_ServiceName = clientJobName, AMB_PortAppReceives = "4000", AMB_PortAMBSends = "4001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "Y", AMB_Version = "0" }; MyUtils.CallAMB(AMB4, logOutputFileName_AMB4, AMB_ModeConsts.RegisterInstance); //AMB5 - Job checkpoint string logOutputFileName_AMB5 = testName + "_AMB5.log"; AMB_Settings AMB5 = new AMB_Settings { AMB_ServiceName = clientJobName, AMB_ReplicaNumber = "1", AMB_PortAppReceives = "5000", AMB_PortAMBSends = "5001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "Y", AMB_Version = "0" }; MyUtils.CallAMB(AMB5, logOutputFileName_AMB5, AMB_ModeConsts.AddReplica); //AMB6 - Job secondary string logOutputFileName_AMB6 = testName + "_AMB6.log"; AMB_Settings AMB6 = new AMB_Settings { AMB_ServiceName = clientJobName, AMB_ReplicaNumber = "2", AMB_PortAppReceives = "6000", AMB_PortAMBSends = "6001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "Y", AMB_Version = "0" }; MyUtils.CallAMB(AMB6, logOutputFileName_AMB6, AMB_ModeConsts.AddReplica); //Server 1 string logOutputFileName_ImmCoord1 = testName + "_ImmCoord1.log"; int ImmCoordProcessID1 = MyUtils.StartImmCoord(serverName, 1500, logOutputFileName_ImmCoord1, true, 0); Thread.Sleep(1000); string logOutputFileName_Server1 = testName + "_Server1.log"; int serverProcessID1 = MyUtils.StartAsyncPerfServer("1001", "1000", serverName, logOutputFileName_Server1); //Server 2 string logOutputFileName_ImmCoord2 = testName + "_ImmCoord2.log"; int ImmCoordProcessID2 = MyUtils.StartImmCoord(serverName, 2500, logOutputFileName_ImmCoord2, true, 1); Thread.Sleep(1000); // give a second string logOutputFileName_Server2 = testName + "_Server2.log"; int serverProcessID2 = MyUtils.StartAsyncPerfServer("2001", "2000", serverName, logOutputFileName_Server2); //Server 3 string logOutputFileName_ImmCoord3 = testName + "_ImmCoord3.log"; int ImmCoordProcessID3 = MyUtils.StartImmCoord(serverName, 3500, logOutputFileName_ImmCoord3, true, 2); string logOutputFileName_Server3 = testName + "_Server3.log"; int serverProcessID3 = MyUtils.StartAsyncPerfServer("3001", "3000", serverName, logOutputFileName_Server3); //Client 1 string logOutputFileName_ImmCoord4 = testName + "_ImmCoord4.log"; int ImmCoordProcessID4 = MyUtils.StartImmCoord(clientJobName, 4500, logOutputFileName_ImmCoord4, true, 0); Thread.Sleep(1000); // give a second string logOutputFileName_ClientJob1 = testName + "_ClientJob1.log"; int clientJobProcessID1 = MyUtils.StartAsyncPerfClientJob("4001", "4000", clientJobName, serverName, "1", logOutputFileName_ClientJob1); //Client 2 string logOutputFileName_ImmCoord5 = testName + "_ImmCoord5.log"; int ImmCoordProcessID5 = MyUtils.StartImmCoord(clientJobName, 5500, logOutputFileName_ImmCoord5, true, 1); Thread.Sleep(1000); // give a second string logOutputFileName_ClientJob2 = testName + "_ClientJob2.log"; int clientJobProcessID2 = MyUtils.StartAsyncPerfClientJob("5001", "5000", clientJobName, serverName, "1", logOutputFileName_ClientJob2); //Client 3 string logOutputFileName_ImmCoord6 = testName + "_ImmCoord6.log"; int ImmCoordProcessID6 = MyUtils.StartImmCoord(clientJobName, 6500, logOutputFileName_ImmCoord6, true, 2); Thread.Sleep(1000); // give a second string logOutputFileName_ClientJob3 = testName + "_ClientJob3.log"; int clientJobProcessID3 = MyUtils.StartAsyncPerfClientJob("6001", "6000", clientJobName, serverName, "1", logOutputFileName_ClientJob3); // Give it 10 seconds to do something before killing it Thread.Sleep(10000); Application.DoEvents(); // if don't do this ... system sees thread as blocked thread and throws message. //Kill all aspects - kill primary of each last MyUtils.KillProcess(serverProcessID2); MyUtils.KillProcess(ImmCoordProcessID2); MyUtils.KillProcess(serverProcessID3); MyUtils.KillProcess(ImmCoordProcessID3); MyUtils.KillProcess(serverProcessID1); MyUtils.KillProcess(ImmCoordProcessID1); MyUtils.KillProcess(clientJobProcessID2); MyUtils.KillProcess(ImmCoordProcessID5); MyUtils.KillProcess(clientJobProcessID3); MyUtils.KillProcess(ImmCoordProcessID6); MyUtils.KillProcess(clientJobProcessID1); MyUtils.KillProcess(ImmCoordProcessID4); // at this point, the system is dead - restart Thread.Sleep(5000); //Restart servers string logOutputFileName_ImmCoord1_Restarted = testName + "_ImmCoord1_Restarted.log"; int ImmCoordProcessID1_Restarted = MyUtils.StartImmCoord(serverName, 1500, logOutputFileName_ImmCoord1_Restarted, true, 0); string logOutputFileName_Server1_Restarted = testName + "_Server1_Restarted.log"; int serverProcessID_Restarted1 = MyUtils.StartAsyncPerfServer("1001", "1000", serverName, logOutputFileName_Server1_Restarted); string logOutputFileName_ImmCoord2_Restarted = testName + "_ImmCoord2_Restarted.log"; int ImmCoordProcessID2_Restarted = MyUtils.StartImmCoord(serverName, 2500, logOutputFileName_ImmCoord2_Restarted, true, 1); string logOutputFileName_Server2_Restarted = testName + "_Server2_Restarted.log"; int serverProcessID_Restarted2 = MyUtils.StartAsyncPerfServer("2001", "2000", serverName, logOutputFileName_Server2_Restarted); string logOutputFileName_ImmCoord3_Restarted = testName + "_ImmCoord3_Restarted.log"; int ImmCoordProcessID3_Restarted = MyUtils.StartImmCoord(serverName, 3500, logOutputFileName_ImmCoord3_Restarted, true, 2); string logOutputFileName_Server3_Restarted = testName + "_Server3_Restarted.log"; int serverProcessID_Restarted3 = MyUtils.StartAsyncPerfServer("3001", "3000", serverName, logOutputFileName_Server3_Restarted); //Restart clients string logOutputFileName_ImmCoord4_Restarted = testName + "_ImmCoord4_Restarted.log"; int ImmCoordProcessID4_Restarted = MyUtils.StartImmCoord(clientJobName, 4500, logOutputFileName_ImmCoord4_Restarted, true, 0); string logOutputFileName_ClientJob1_Restarted = testName + "_ClientJob1_Restarted.log"; int clientJobProcessID_Restarted1 = MyUtils.StartAsyncPerfClientJob("4001", "4000", clientJobName, serverName, "1", logOutputFileName_ClientJob1_Restarted); string logOutputFileName_ImmCoord5_Restarted = testName + "_ImmCoord5_Restarted.log"; int ImmCoordProcessID5_Restarted = MyUtils.StartImmCoord(clientJobName, 5500, logOutputFileName_ImmCoord5_Restarted, true, 1); string logOutputFileName_ClientJob2_Restarted = testName + "_ClientJob2_Restarted.log"; int clientJobProcessID_Restarted2 = MyUtils.StartAsyncPerfClientJob("5001", "5000", clientJobName, serverName, "1", logOutputFileName_ClientJob2_Restarted); string logOutputFileName_ImmCoord6_Restarted = testName + "_ImmCoord6_Restarted.log"; int ImmCoordProcessID6_Restarted = MyUtils.StartImmCoord(clientJobName, 6500, logOutputFileName_ImmCoord6_Restarted, true, 2); string logOutputFileName_ClientJob3_Restarted = testName + "_ClientJob3_Restarted.log"; int clientJobProcessID_Restarted3 = MyUtils.StartAsyncPerfClientJob("6001", "6000", clientJobName, serverName, "1", logOutputFileName_ClientJob3_Restarted); //Delay until finished ... looking at the primary (server1) but also verify others hit done too bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server1_Restarted, byteSize, 45, false, testName, true); // Total Bytes received needs to be accurate pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server2_Restarted, byteSize, 15, false, testName, true); pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server3_Restarted, byteSize, 15, false, testName, true); pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob1_Restarted, byteSize, 15, false, testName, true); pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob2_Restarted, byteSize, 15, false, testName, true); pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob3_Restarted, byteSize, 15, false, testName, true); // Stop things so file is freed up and can be opened in verify MyUtils.KillProcess(serverProcessID_Restarted1); MyUtils.KillProcess(serverProcessID_Restarted2); MyUtils.KillProcess(serverProcessID_Restarted3); MyUtils.KillProcess(clientJobProcessID_Restarted1); MyUtils.KillProcess(clientJobProcessID_Restarted2); MyUtils.KillProcess(clientJobProcessID_Restarted3); MyUtils.KillProcess(ImmCoordProcessID1_Restarted); MyUtils.KillProcess(ImmCoordProcessID2_Restarted); MyUtils.KillProcess(ImmCoordProcessID3_Restarted); MyUtils.KillProcess(ImmCoordProcessID4_Restarted); MyUtils.KillProcess(ImmCoordProcessID5_Restarted); MyUtils.KillProcess(ImmCoordProcessID6_Restarted); // Verify cmp files for client and 3 servers // the timing is a bit off when have so many processes so cmp files not // 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); // Verify integrity of Ambrosia logs by replaying MyUtils.VerifyAmbrosiaLogFile(testName, Convert.ToInt64(byteSize), true, true, AMB1.AMB_Version, "", true); }
public void AMB_Async_Basic_Test() { //NOTE - the Cleanup has this hard coded so if this changes, update Cleanup section too string testName = "asyncbasic"; string clientJobName = testName + "clientjob"; string serverName = testName + "server"; string ambrosiaLogDir = ConfigurationManager.AppSettings["AmbrosiaLogDirectory"] + "\\"; string byteSize = "2147483648"; Utilities MyUtils = new Utilities(); //AMB1 - Job string logOutputFileName_AMB1 = testName + "_AMB1.log"; AMB_Settings AMB1 = new AMB_Settings { AMB_ServiceName = clientJobName, AMB_PortAppReceives = "1000", AMB_PortAMBSends = "1001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB1, logOutputFileName_AMB1, AMB_ModeConsts.RegisterInstance); //AMB2 string logOutputFileName_AMB2 = testName + "_AMB2.log"; AMB_Settings AMB2 = new AMB_Settings { AMB_ServiceName = serverName, AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB2, logOutputFileName_AMB2, AMB_ModeConsts.RegisterInstance); //ImmCoord1 string logOutputFileName_ImmCoord1 = testName + "_ImmCoord1.log"; int ImmCoordProcessID1 = MyUtils.StartImmCoord(clientJobName, 1500, logOutputFileName_ImmCoord1); //ImmCoord2 string logOutputFileName_ImmCoord2 = testName + "_ImmCoord2.log"; int ImmCoordProcessID2 = MyUtils.StartImmCoord(serverName, 2500, logOutputFileName_ImmCoord2); //Client Job Call string logOutputFileName_ClientJob = testName + "_ClientJob.log"; int clientJobProcessID = MyUtils.StartAsyncPerfClientJob("1001", "1000", clientJobName, serverName, "2", logOutputFileName_ClientJob); //Server Call string logOutputFileName_Server = testName + "_Server.log"; int serverProcessID = MyUtils.StartAsyncPerfServer("2001", "2000", serverName, logOutputFileName_Server); //Delay until client is done - also check Server just to make sure bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, byteSize, 45, false, testName, true); // number of bytes processed pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server, byteSize, 10, false, testName, true); // Stop things so file is freed up and can be opened in verify MyUtils.KillProcess(clientJobProcessID); MyUtils.KillProcess(serverProcessID); MyUtils.KillProcess(ImmCoordProcessID1); MyUtils.KillProcess(ImmCoordProcessID2); //Verify AMB MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_AMB1); MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_AMB2); // Verify Client MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_ClientJob); // Verify Server MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_Server); // Verify integrity of Ambrosia logs by replaying MyUtils.VerifyAmbrosiaLogFile(testName, Convert.ToInt64(byteSize), true, true, AMB1.AMB_Version, "", true); }
public void AMB_Async_KillServer_Test() { //NOTE - the Cleanup has test name hard coded so if this changes, update Cleanup section too string testName = "asynckillservertest"; string clientJobName = testName + "clientjob"; string serverName = testName + "server"; string ambrosiaLogDir = ConfigurationManager.AppSettings["AmbrosiaLogDirectory"] + "\\"; string byteSize = "2147483648"; Utilities MyUtils = new Utilities(); //AMB1 - Job string logOutputFileName_AMB1 = testName + "_AMB1.log"; AMB_Settings AMB1 = new AMB_Settings { AMB_ServiceName = clientJobName, AMB_PortAppReceives = "1000", AMB_PortAMBSends = "1001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB1, logOutputFileName_AMB1, AMB_ModeConsts.RegisterInstance); //AMB2 string logOutputFileName_AMB2 = testName + "_AMB2.log"; AMB_Settings AMB2 = new AMB_Settings { AMB_ServiceName = serverName, AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", // NOTE: if put this to "Y" then when kill it, it will become a checkpointer which never becomes primary AMB_Version = "0" }; MyUtils.CallAMB(AMB2, logOutputFileName_AMB2, AMB_ModeConsts.RegisterInstance); //ImmCoord1 string logOutputFileName_ImmCoord1 = testName + "_ImmCoord1.log"; int ImmCoordProcessID1 = MyUtils.StartImmCoord(clientJobName, 1500, logOutputFileName_ImmCoord1); //ImmCoord2 string logOutputFileName_ImmCoord2 = testName + "_ImmCoord2.log"; int ImmCoordProcessID2 = MyUtils.StartImmCoord(serverName, 2500, logOutputFileName_ImmCoord2); //Client Job Call string logOutputFileName_ClientJob = testName + "_ClientJob.log"; int clientJobProcessID = MyUtils.StartAsyncPerfClientJob("1001", "1000", clientJobName, serverName, "2", logOutputFileName_ClientJob); //Server Call string logOutputFileName_Server = testName + "_Server.log"; int serverProcessID = MyUtils.StartAsyncPerfServer("2001", "2000", serverName, logOutputFileName_Server); // Give it 10 seconds to do something before killing it Thread.Sleep(10000); Application.DoEvents(); // if don't do this ... system sees thread as blocked thread and throws message. //Kill Server at this point as well as ImmCoord2 MyUtils.KillProcess(serverProcessID); MyUtils.KillProcess(ImmCoordProcessID2); //Restart ImmCoord2 string logOutputFileName_ImmCoord2_Restarted = testName + "_ImmCoord2_Restarted.log"; int ImmCoordProcessID2_Restarted = MyUtils.StartImmCoord(serverName, 2500, logOutputFileName_ImmCoord2_Restarted); // Restart Server Process string logOutputFileName_Server_Restarted = testName + "_Server_Restarted.log"; int serverProcessID_Restarted = MyUtils.StartAsyncPerfServer("2001", "2000", serverName, logOutputFileName_Server_Restarted); //Delay until client is done - also check Server just to make sure bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server_Restarted, byteSize, 35, false, testName, true); // Total Bytes received needs to be accurate pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, byteSize, 15, false, testName, true); // Stop things so file is freed up and can be opened in verify MyUtils.KillProcess(clientJobProcessID); MyUtils.KillProcess(serverProcessID_Restarted); MyUtils.KillProcess(ImmCoordProcessID1); MyUtils.KillProcess(ImmCoordProcessID2_Restarted); // Verify Server (before and after restart) MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_Server); MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_Server_Restarted); // Verify Client MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_ClientJob); // Verify integrity of Ambrosia logs by replaying MyUtils.VerifyAmbrosiaLogFile(testName, Convert.ToInt64(byteSize), true, true, AMB1.AMB_Version, "", true); }
public void AMB_InProc_TCP_UpgradeServer_Test() { Utilities MyUtils = new Utilities(); //NOTE - the Cleanup has this hard coded so if this changes, update Cleanup section too string testName = "inproctcpupgradeserver"; string clientJobName = testName + "clientjob"; string serverName = testName + "server"; string ambrosiaLogDir = MyUtils.baseAmbrosiaPath + ConfigurationManager.AppSettings["AmbrosiaLogDirectory"] + "\\"; string byteSize = "13958643712"; //AMB1 - Job string logOutputFileName_AMB1 = testName + "_AMB1.log"; AMB_Settings AMB1 = new AMB_Settings { AMB_ServiceName = clientJobName, AMB_PortAppReceives = "1000", AMB_PortAMBSends = "1001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" // Client is always 0 }; MyUtils.CallAMB(AMB1, logOutputFileName_AMB1, AMB_ModeConsts.RegisterInstance); //AMB2 string logOutputFileName_AMB2 = testName + "_AMB2.log"; AMB_Settings AMB2 = new AMB_Settings { AMB_ServiceName = serverName, AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "10" }; MyUtils.CallAMB(AMB2, logOutputFileName_AMB2, AMB_ModeConsts.RegisterInstance); //Client Job Call string logOutputFileName_ClientJob = testName + "_ClientJob.log"; int clientJobProcessID = MyUtils.StartPerfClientJob("1001", "1000", clientJobName, serverName, "65536", "13", logOutputFileName_ClientJob, MyUtils.deployModeInProcManual, "1500"); //Server Call string logOutputFileName_Server = testName + "_Server.log"; int serverProcessID = MyUtils.StartPerfServer("2001", "2000", clientJobName, serverName, logOutputFileName_Server, 1, false, 0, MyUtils.deployModeInProcManual, "2500"); // Give it 5 seconds to do something before killing it MyUtils.TestDelay(5000); // kill Server MyUtils.KillProcess(serverProcessID); // Run AMB again with new version # upped by 1 (11) string logOutputFileName_AMB2_Upgraded = testName + "_AMB2_Upgraded.log"; AMB_Settings AMB2_Upgraded = new AMB_Settings { AMB_ServiceName = serverName, AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "10", AMB_UpgradeToVersion = "11" }; MyUtils.CallAMB(AMB2_Upgraded, logOutputFileName_AMB2_Upgraded, AMB_ModeConsts.RegisterInstance); // start server again but with Upgrade = true string logOutputFileName_Server_upgraded = testName + "_Server_upgraded.log"; int serverProcessID_upgraded = MyUtils.StartPerfServer("2001", "2000", clientJobName, serverName, logOutputFileName_Server_upgraded, 1, true, 0, MyUtils.deployModeInProcManual, "2500"); //Delay until client is done - also check Server just to make sure bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, byteSize, 25, false, testName, true); // number of bytes processed pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server_upgraded, byteSize, 15, false, testName, true); // do not check cmp files as they change too much from machine to machine // Verify integrity of Ambrosia logs by replaying // Do not verify log file through replay / ttd - doesn't work when log files span different versions // MyUtils.VerifyAmbrosiaLogFile(testName, Convert.ToInt64(byteSize), true, true, AMB2.AMB_Version); }
public void AMB_InProc_TCP_MigrateClient_Test() { Utilities MyUtils = new Utilities(); //NOTE - the Cleanup has this hard coded so if this changes, update Cleanup section too string testName = "inproctcpmigrateclient"; string clientJobName = testName + "clientjob"; string serverName = testName + "server"; string ambrosiaLogDir = MyUtils.baseAmbrosiaPath + ConfigurationManager.AppSettings["AmbrosiaLogDirectory"] + "\\"; string byteSize = "13958643712"; //string killJobMessage = "Migrating or upgrading. Must commit suicide since I'm the primary"; //AMB1 - Job string logOutputFileName_AMB1 = testName + "_AMB1.log"; AMB_Settings AMB1 = new AMB_Settings { AMB_ServiceName = clientJobName, AMB_PortAppReceives = "1000", AMB_PortAMBSends = "1001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB1, logOutputFileName_AMB1, AMB_ModeConsts.RegisterInstance); //AMB2 string logOutputFileName_AMB2 = testName + "_AMB2.log"; AMB_Settings AMB2 = new AMB_Settings { AMB_ServiceName = serverName, AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB2, logOutputFileName_AMB2, AMB_ModeConsts.RegisterInstance); //Client Job Call string logOutputFileName_ClientJob = testName + "_ClientJob.log"; int clientJobProcessID = MyUtils.StartPerfClientJob("1001", "1000", clientJobName, serverName, "65536", "13", logOutputFileName_ClientJob, MyUtils.deployModeInProcManual, "1500"); //Server Call string logOutputFileName_Server = testName + "_Server.log"; int serverProcessID = MyUtils.StartPerfServer("2001", "2000", clientJobName, serverName, logOutputFileName_Server, 1, false, 0, MyUtils.deployModeInProcManual, "2500"); // Give it 3 seconds to do something before killing it MyUtils.TestDelay(3000); // DO NOT Kill both Job and Server // This is main part of test - get it to have Job and Server take over and run // Orig Job and Server stop then // MyUtils.KillProcess(clientJobProcessID); // MyUtils.KillProcess(serverProcessID); // Restart Job string logOutputFileName_ClientJob_Restarted = testName + "_ClientJob_Restarted.log"; int clientJobProcessID_Restarted = MyUtils.StartPerfClientJob("1001", "1000", clientJobName, serverName, "65536", "13", logOutputFileName_ClientJob_Restarted, MyUtils.deployModeInProcManual, "3500"); // just give a rest MyUtils.TestDelay(2000); // Restart Server string logOutputFileName_Server_Restarted = testName + "_Server_Restarted.log"; int serverProcessID_Restarted = MyUtils.StartPerfServer("2001", "2000", clientJobName, serverName, logOutputFileName_Server_Restarted, 1, false, 0, MyUtils.deployModeInProcManual, "4500"); //Delay until client is done - also check Server just to make sure bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob_Restarted, byteSize, 20, false, testName, true); // Total bytes received 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,false); // Stop things so file is freed up and can be opened in verify MyUtils.KillProcess(clientJobProcessID_Restarted); MyUtils.KillProcess(serverProcessID_Restarted); // do not check cmp files since changes too much from machine to machine on restarted job or server // Verify integrity of Ambrosia logs by replaying MyUtils.VerifyAmbrosiaLogFile(testName, Convert.ToInt64(byteSize), true, true, AMB1.AMB_Version); }
public void AMB_InProc_TCP_ClientOnly_Test() { Utilities MyUtils = new Utilities(); //NOTE - the Cleanup has this hard coded so if this changes, update Cleanup section too string testName = "inproctcpclientonly"; string clientJobName = testName + "clientjob"; string serverName = testName + "server"; string ambrosiaLogDir = MyUtils.baseAmbrosiaPath + ConfigurationManager.AppSettings["AmbrosiaLogDirectory"] + "\\"; string byteSize = "1073741824"; //AMB1 - Job string logOutputFileName_AMB1 = testName + "_AMB1.log"; AMB_Settings AMB1 = new AMB_Settings { AMB_ServiceName = clientJobName, AMB_PortAppReceives = "1000", AMB_PortAMBSends = "1001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB1, logOutputFileName_AMB1, AMB_ModeConsts.RegisterInstance); //AMB2 string logOutputFileName_AMB2 = testName + "_AMB2.log"; AMB_Settings AMB2 = new AMB_Settings { AMB_ServiceName = serverName, AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB2, logOutputFileName_AMB2, AMB_ModeConsts.RegisterInstance); //ImmCoord2 string logOutputFileName_ImmCoord2 = testName + "_ImmCoord2.log"; int ImmCoordProcessID2 = MyUtils.StartImmCoord(serverName, 2500, logOutputFileName_ImmCoord2); //Client Job Call string logOutputFileName_ClientJob = testName + "_ClientJob.log"; int clientJobProcessID = MyUtils.StartPerfClientJob("1001", "1000", clientJobName, serverName, "1024", "1", logOutputFileName_ClientJob, MyUtils.deployModeInProcManual, "1500"); // Give it a few seconds to start MyUtils.TestDelay(2000); //Server Call string logOutputFileName_Server = testName + "_Server.log"; int serverProcessID = MyUtils.StartPerfServer("2001", "2000", clientJobName, serverName, logOutputFileName_Server, 1, false); //Delay until client is done - also check Server just to make sure bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, byteSize, 5, false, testName, true); // number of bytes processed pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server, byteSize, 5, false, testName, true); // Stop things so file is freed up and can be opened in verify MyUtils.KillProcess(clientJobProcessID); MyUtils.KillProcess(serverProcessID); MyUtils.KillProcess(ImmCoordProcessID2); // .netcore has slightly different cmp file - not crucial to try to have separate files if (MyUtils.NetFrameworkTestRun) { // Verify Client - .net core with TCP causes extra message in output of core, so don't cmp to others MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_ClientJob); } // Verify Server MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_Server); // Verify integrity of Ambrosia logs by replaying // Unable to verify when client files in different location than server log - TO DO: modify method to do this // MyUtils.VerifyAmbrosiaLogFile(testName, Convert.ToInt64(byteSize), true, true, AMB1.AMB_Version); }
public void AMB_InProc_ClientPipe_ServerTCP_Test() { //NOTE - the Cleanup has this hard coded so if this changes, update Cleanup section too string testName = "inprocclientpipeservertcp"; string clientJobName = testName + "clientjob"; string serverName = testName + "server"; string ambrosiaLogDir = ConfigurationManager.AppSettings["AmbrosiaLogDirectory"] + "\\"; string byteSize = "1073741824"; Utilities MyUtils = new Utilities(); //AMB1 - Job string logOutputFileName_AMB1 = testName + "_AMB1.log"; AMB_Settings AMB1 = new AMB_Settings { AMB_ServiceName = clientJobName, AMB_PortAppReceives = "1000", AMB_PortAMBSends = "1001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB1, logOutputFileName_AMB1, AMB_ModeConsts.RegisterInstance); //AMB2 string logOutputFileName_AMB2 = testName + "_AMB2.log"; AMB_Settings AMB2 = new AMB_Settings { AMB_ServiceName = serverName, AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB2, logOutputFileName_AMB2, AMB_ModeConsts.RegisterInstance); //Client Job Call string logOutputFileName_ClientJob = testName + "_ClientJob.log"; int clientJobProcessID = MyUtils.StartPerfClientJob("1001", "1000", clientJobName, serverName, "1024", "1", logOutputFileName_ClientJob, MyUtils.deployModeInProc, "1500"); // Give it a few seconds to start Thread.Sleep(2000); //Server Call string logOutputFileName_Server = testName + "_Server.log"; int serverProcessID = MyUtils.StartPerfServer("2001", "2000", clientJobName, serverName, logOutputFileName_Server, 1, false, 0, MyUtils.deployModeInProcManual, "2500"); //Delay until client is done - also check Server just to make sure bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, byteSize, 5, false, testName, true); // number of bytes processed pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server, byteSize, 5, false, testName, true); // Stop things so file is freed up and can be opened in verify MyUtils.KillProcess(clientJobProcessID); MyUtils.KillProcess(serverProcessID); // Verify Client - .net core with TCP causes extra message in output of core, so don't cmp to others if (MyUtils.NetFrameworkTestRun) { MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_ClientJob); } // Verify Server MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_Server); // Verify integrity of Ambrosia logs by replaying MyUtils.VerifyAmbrosiaLogFile(testName, Convert.ToInt64(byteSize), true, true, AMB1.AMB_Version); }
public void UnitTest_BasicEndtoEnd_Test() { //NOTE - the Cleanup has this hard coded so if this changes, update Cleanup section too string testName = "unitendtoendtest"; string clientJobName = testName + "clientjob"; string serverName = testName + "server"; string ambrosiaLogDir = ConfigurationManager.AppSettings["AmbrosiaLogDirectory"] + "\\"; string byteSize = "1073741824"; Utilities MyUtils = new Utilities(); //AMB1 - Job string logOutputFileName_AMB1 = testName + "_AMB1.log"; AMB_Settings AMB1 = new AMB_Settings { AMB_ServiceName = clientJobName, AMB_PortAppReceives = "1000", AMB_PortAMBSends = "1001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB1, logOutputFileName_AMB1, AMB_ModeConsts.RegisterInstance); //AMB2 string logOutputFileName_AMB2 = testName + "_AMB2.log"; AMB_Settings AMB2 = new AMB_Settings { AMB_ServiceName = serverName, AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB2, logOutputFileName_AMB2, AMB_ModeConsts.RegisterInstance); //ImmCoord1 string logOutputFileName_ImmCoord1 = testName + "_ImmCoord1.log"; int ImmCoordProcessID1 = MyUtils.StartImmCoord(clientJobName, 1500, logOutputFileName_ImmCoord1); //ImmCoord2 string logOutputFileName_ImmCoord2 = testName + "_ImmCoord2.log"; int ImmCoordProcessID2 = MyUtils.StartImmCoord(serverName, 2500, logOutputFileName_ImmCoord2); //Client Job Call string logOutputFileName_ClientJob = testName + "_ClientJob.log"; int clientJobProcessID = MyUtils.StartPerfClientJob("1001", "1000", clientJobName, serverName, "1024", "1", logOutputFileName_ClientJob, MyUtils.deployModeSecondProc); // Give it a few seconds to start Thread.Sleep(2000); //Server Call string logOutputFileName_Server = testName + "_Server.log"; int serverProcessID = MyUtils.StartPerfServer("2001", "2000", clientJobName, serverName, logOutputFileName_Server, 1, false); //Delay until client is done - also check Server just to make sure bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, byteSize, 5, false, testName, true); // number of bytes processed pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server, byteSize, 5, false, testName, true); // Stop things so file is freed up and can be opened in verify MyUtils.KillProcess(clientJobProcessID); MyUtils.KillProcess(serverProcessID); MyUtils.KillProcess(ImmCoordProcessID1); MyUtils.KillProcess(ImmCoordProcessID2); // .netcore has slightly different cmp file - not crucial to try to have separate files if (MyUtils.NetFrameworkTestRun) { //Verify AMB MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_AMB1); MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_AMB2); } // Verify Client MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_ClientJob); // Verify Server MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_Server); // Verify integrity of Ambrosia logs by replaying MyUtils.VerifyAmbrosiaLogFile(testName, Convert.ToInt64(byteSize), true, true, AMB1.AMB_Version); }
public void AMB_InProc_TCP_KillJob_Test() { Utilities MyUtils = new Utilities(); //NOTE - the Cleanup has test name hard coded so if this changes, update Cleanup section too string testName = "inproctcpkilljobtest"; string clientJobName = testName + "clientjob"; string serverName = testName + "server"; string ambrosiaLogDir = MyUtils.baseAmbrosiaPath + ConfigurationManager.AppSettings["AmbrosiaLogDirectory"] + "\\"; string byteSize = "13958643712"; //AMB1 - Job string logOutputFileName_AMB1 = testName + "_AMB1.log"; AMB_Settings AMB1 = new AMB_Settings { AMB_ServiceName = clientJobName, AMB_PortAppReceives = "1000", AMB_PortAMBSends = "1001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB1, logOutputFileName_AMB1, AMB_ModeConsts.RegisterInstance); //AMB2 string logOutputFileName_AMB2 = testName + "_AMB2.log"; AMB_Settings AMB2 = new AMB_Settings { AMB_ServiceName = serverName, AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB2, logOutputFileName_AMB2, AMB_ModeConsts.RegisterInstance); //Server Call string logOutputFileName_Server = testName + "_Server.log"; int serverProcessID = MyUtils.StartPerfServer("2001", "2000", clientJobName, serverName, logOutputFileName_Server, 1, false, 0, MyUtils.deployModeInProcManual, "2500"); //Client Job Call string logOutputFileName_ClientJob = testName + "_ClientJob.log"; int clientJobProcessID = MyUtils.StartPerfClientJob("1001", "1000", clientJobName, serverName, "65536", "13", logOutputFileName_ClientJob, MyUtils.deployModeInProcManual, "1500"); // Give it 5seconds to do something before killing it MyUtils.TestDelay(5000); //Kill job at this point MyUtils.KillProcess(clientJobProcessID); // Restart Job Process string logOutputFileName_ClientJob_Restarted = testName + "_ClientJob_Restarted.log"; int clientJobProcessID_Restarted = MyUtils.StartPerfClientJob("1001", "1000", clientJobName, serverName, "65536", "13", logOutputFileName_ClientJob_Restarted, MyUtils.deployModeInProcManual, "1500"); // Give it 5 seconds to do something before killing it again MyUtils.TestDelay(5000); //Kill job at this point MyUtils.KillProcess(clientJobProcessID_Restarted); // Restart Job Process Again string logOutputFileName_ClientJob_Restarted_Again = testName + "_ClientJob_Restarted_Again.log"; int clientJobProcessID_Restarted_Again = MyUtils.StartPerfClientJob("1001", "1000", clientJobName, serverName, "65536", "13", logOutputFileName_ClientJob_Restarted_Again, MyUtils.deployModeInProcManual, "1500"); //Delay until client is done - also check Server just to make sure bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob_Restarted_Again, byteSize, 15, false, testName, true); // Total bytes received pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server, byteSize, 15, false, testName, true); // Stop things so file is freed up and can be opened in verify MyUtils.KillProcess(clientJobProcessID_Restarted_Again); MyUtils.KillProcess(serverProcessID); // don't do cmp files for client as it changes from machine to machine and a bit on netcore // Verify Server MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_Server); // Verify integrity of Ambrosia logs by replaying MyUtils.VerifyAmbrosiaLogFile(testName, Convert.ToInt64(byteSize), true, true, AMB1.AMB_Version); }
public void JS_PTI_HostingModeSeparate_TwoProc_Test() { Utilities MyUtils = new Utilities(); JS_Utilities JSUtils = new JS_Utilities(); int numRounds = 2; long totalBytes = 8192; long totalEchoBytes = 8192; int bytesPerRound = 4096; int maxMessageSize = 256; int batchSizeCutoff = 256; int messagesSent = 48; bool bidi = false; string testName = "jsptihostmodeseparatetesttwoproc"; string clientInstanceName = testName + "client"; string serverInstanceName = testName + "server"; string logOutputClientFileName_TestApp = testName + "Client_TestApp.log"; string logOutputServerFileName_TestApp = testName + "Server_TestApp.log"; string ambrosiaLogDir = MyUtils.baseAmbrosiaPath + ConfigurationManager.AppSettings["AmbrosiaLogDirectory"] + "\\"; string logOutputFileName_ImmCoord1 = testName + "_ImmCoord1.log"; // Set name and ports to match IC call for client and server JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_instanceName, clientInstanceName, JSUtils.JSPTI_ClientInstanceRole); JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_icCraPort, "1500", JSUtils.JSPTI_ClientInstanceRole); JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_icReceivePort, "1000", JSUtils.JSPTI_ClientInstanceRole); JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_icSendPort, "1001", JSUtils.JSPTI_ClientInstanceRole); JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_instanceName, serverInstanceName, JSUtils.JSPTI_ServerInstanceRole); JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_icCraPort, "2500", JSUtils.JSPTI_ServerInstanceRole); JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_icReceivePort, "2000", JSUtils.JSPTI_ServerInstanceRole); JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_icSendPort, "2001", JSUtils.JSPTI_ServerInstanceRole); // Manually register the instance string logOutputFileName_AMB1 = testName + "_AMB1.log"; AMB_Settings AMB1 = new AMB_Settings { AMB_ServiceName = clientInstanceName, AMB_PortAppReceives = "1000", AMB_PortAMBSends = "1001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB1, logOutputFileName_AMB1, AMB_ModeConsts.RegisterInstance); //AMB2 string logOutputFileName_AMB2 = testName + "_AMB2.log"; AMB_Settings AMB2 = new AMB_Settings { AMB_ServiceName = serverInstanceName, AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB2, logOutputFileName_AMB2, AMB_ModeConsts.RegisterInstance); // manually start the IC int ImmCoordProcessID1 = MyUtils.StartImmCoord(clientInstanceName, 1500, logOutputFileName_ImmCoord1); //ImmCoord2 string logOutputFileName_ImmCoord2 = testName + "_ImmCoord2.log"; int ImmCoordProcessID2 = MyUtils.StartImmCoord(serverInstanceName, 2500, logOutputFileName_ImmCoord2); // Start JS client and server JSUtils.StartJSPTI(numRounds, totalBytes, totalEchoBytes, bytesPerRound, maxMessageSize, batchSizeCutoff, bidi, logOutputServerFileName_TestApp, 0, false, JSUtils.JSPTI_ServerInstanceRole); JSUtils.StartJSPTI(numRounds, totalBytes, totalEchoBytes, bytesPerRound, maxMessageSize, batchSizeCutoff, bidi, logOutputClientFileName_TestApp, 0, false, JSUtils.JSPTI_ClientInstanceRole, serverInstanceName); // Verify the data in the restarted output file bool pass = MyUtils.WaitForProcessToFinish(logOutputServerFileName_TestApp, "Bytes received: " + totalBytes.ToString(), 5, false, testName, true); pass = MyUtils.WaitForProcessToFinish(logOutputServerFileName_TestApp, "SUCCESS: The expected number of bytes (" + totalBytes.ToString() + ") have been received", 1, false, testName, true); // Verify that echo is NOT part of the output - won't pop assert on fail so check return value pass = MyUtils.WaitForProcessToFinish(logOutputClientFileName_TestApp, "SUCCESS: The expected number of echoed bytes (" + totalEchoBytes.ToString() + ") have been received", 0, true, testName, false, false); if (pass == true) { Assert.Fail("<JS_PTI_HostingModeSeparate_TwoProc_Test> Echoed string should NOT have been found in the output but it was."); } pass = MyUtils.WaitForProcessToFinish(logOutputClientFileName_TestApp, "All rounds complete (" + messagesSent.ToString() + " messages sent)", 1, false, testName, true, false); pass = MyUtils.WaitForProcessToFinish(logOutputClientFileName_TestApp, "[IC]", 0, true, testName, false, false); // shouldn't be any IC comments if (pass == true) { Assert.Fail("<JS_PTI_HostingModeSeparate_TwoProc_Test> There shouldn't be any Imm Coord messages in output since separate process"); } // Do not verify logs as the setting 'debugStartCheckpoint' is not allowed for Separate host mode //JSUtils.JS_VerifyTimeTravelDebugging(testName, numRounds, totalBytes, totalEchoBytes, bytesPerRound, maxMessageSize, batchSizeCutoff, bidi, true); }
public void JS_PTI_HostingModeSeparateStartPTIFirst_BiDi_Test() { Utilities MyUtils = new Utilities(); JS_Utilities JSUtils = new JS_Utilities(); int numRounds = 2; long totalBytes = 8192; long totalEchoBytes = 8192; int bytesPerRound = 4096; int maxMessageSize = 256; int batchSizeCutoff = 256; int messagesSent = 48; bool bidi = true; string testName = "jsptihostmodesepptifirsttest"; string logOutputFileName_TestApp = testName + "_TestApp.log"; string ambrosiaLogDir = MyUtils.baseAmbrosiaPath + ConfigurationManager.AppSettings["AmbrosiaLogDirectory"] + "\\"; string logOutputFileName_ImmCoord1 = testName + "_ImmCoord1.log"; JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_instanceName, testName); JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_icCraPort, "1500"); JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_icReceivePort, "1000"); JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_icSendPort, "1001"); // Manually register the instance string logOutputFileName_AMB1 = testName + "_AMB1.log"; AMB_Settings AMB1 = new AMB_Settings { AMB_ServiceName = testName, AMB_PortAppReceives = "1000", AMB_PortAMBSends = "1001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB1, logOutputFileName_AMB1, AMB_ModeConsts.RegisterInstance); // Start JS app JSUtils.StartJSPTI(numRounds, totalBytes, totalEchoBytes, bytesPerRound, maxMessageSize, batchSizeCutoff, bidi, logOutputFileName_TestApp); // manually start the IC after the PTI was started int ImmCoordProcessID1 = MyUtils.StartImmCoord(testName, 1500, logOutputFileName_ImmCoord1); // Verify the data in the output file - too many changing rows in output to do a cmp file so verify some of the key lines bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_TestApp, "Bytes received: " + totalBytes.ToString(), 5, false, testName, true); // number of bytes processed pass = MyUtils.WaitForProcessToFinish(logOutputFileName_TestApp, "SUCCESS: The expected number of bytes (" + totalBytes.ToString() + ") have been received", 1, false, testName, true); pass = MyUtils.WaitForProcessToFinish(logOutputFileName_TestApp, "SUCCESS: The expected number of echoed bytes (" + totalEchoBytes.ToString() + ") have been received", 1, false, testName, true); pass = MyUtils.WaitForProcessToFinish(logOutputFileName_TestApp, "All rounds complete (" + messagesSent.ToString() + " messages sent)", 1, false, testName, true); pass = MyUtils.WaitForProcessToFinish(logOutputFileName_TestApp, "round #" + numRounds.ToString(), 1, false, testName, true); pass = MyUtils.WaitForProcessToFinish(logOutputFileName_TestApp, "[IC]", 0, true, testName, false, false); // shouldn't be any IC comments if (pass == true) { Assert.Fail("<JS_PTI_HostingModeSeparateStartPTIFirst_Test> There shouldn't be any Imm Coord messages in output since separate process"); } }
public void AMB_InProc_TCP_UpgradeServer_Test() { //NOTE - the Cleanup has this hard coded so if this changes, update Cleanup section too string testName = "inproctcpupgradeserver"; string clientJobName = testName + "clientjob"; string serverName = testName + "server"; string ambrosiaLogDir = ConfigurationManager.AppSettings["AmbrosiaLogDirectory"] + "\\"; string byteSize = "13958643712"; Utilities MyUtils = new Utilities(); //AMB1 - Job string logOutputFileName_AMB1 = testName + "_AMB1.log"; AMB_Settings AMB1 = new AMB_Settings { AMB_ServiceName = clientJobName, AMB_PortAppReceives = "1000", AMB_PortAMBSends = "1001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "10" }; MyUtils.CallAMB(AMB1, logOutputFileName_AMB1, AMB_ModeConsts.RegisterInstance); //AMB2 string logOutputFileName_AMB2 = testName + "_AMB2.log"; AMB_Settings AMB2 = new AMB_Settings { AMB_ServiceName = serverName, AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "10" }; MyUtils.CallAMB(AMB2, logOutputFileName_AMB2, AMB_ModeConsts.RegisterInstance); //Client Job Call string logOutputFileName_ClientJob = testName + "_ClientJob.log"; int clientJobProcessID = MyUtils.StartPerfClientJob("1001", "1000", clientJobName, serverName, "65536", "13", logOutputFileName_ClientJob, MyUtils.deployModeInProcManual, "1500"); //Server Call string logOutputFileName_Server = testName + "_Server.log"; int serverProcessID = MyUtils.StartPerfServer("2001", "2000", clientJobName, serverName, logOutputFileName_Server, 1, false, 0, MyUtils.deployModeInProcManual, "2500"); // Give it 5 seconds to do something before killing it Thread.Sleep(5000); Application.DoEvents(); // if don't do this ... system sees thread as blocked thread and throws message. // kill Server MyUtils.KillProcess(serverProcessID); // Run AMB again with new version # upped by 1 (11) string logOutputFileName_AMB2_Upgraded = testName + "_AMB2_Upgraded.log"; AMB_Settings AMB2_Upgraded = new AMB_Settings { AMB_ServiceName = serverName, AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "10", AMB_UpgradeToVersion = "11" }; MyUtils.CallAMB(AMB2_Upgraded, logOutputFileName_AMB2_Upgraded, AMB_ModeConsts.RegisterInstance); // start server again but with Upgrade = true string logOutputFileName_Server_upgraded = testName + "_Server_upgraded.log"; int serverProcessID_upgraded = MyUtils.StartPerfServer("2001", "2000", clientJobName, serverName, logOutputFileName_Server_upgraded, 1, true, 0, MyUtils.deployModeInProcManual, "2500"); //Delay until client is done - also check Server just to make sure bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, byteSize, 25, false, testName, true); // number of bytes processed pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server_upgraded, byteSize, 15, false, testName, true); // Stop things so file is freed up and can be opened in verify MyUtils.KillProcess(clientJobProcessID); MyUtils.KillProcess(serverProcessID_upgraded); // Verify Client - .net core with TCP causes extra message in output of core, so don't cmp to others if (MyUtils.NetFrameworkTestRun) { MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_ClientJob); } // Verify Server MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_Server_upgraded); }
public void AMB_MTF_NoKill_Test() { //NOTE - the Cleanup has this hard coded so if this changes, update Cleanup section too string testName = "mtfnokill"; string clientJobName = testName + "clientjob"; string serverName = testName + "server"; string ambrosiaLogDir = ConfigurationManager.AppSettings["AmbrosiaLogDirectory"] + "\\"; //****************** MTF Settings *************** //int numRounds = 5; long totalNumBytesReceived = 5368709120; int maxMminsToWaitToFinish = 5; int numRounds = 25; long totalNumBytesReceived = 26843545600; int maxMminsToWaitToFinish = 30; //int numRounds = 100; long totalNumBytesReceived = 107374182400; int maxMminsToWaitToFinish = 80; // 15 mins //int numRounds = 500; long totalNumBytesReceived = 536870912000; int maxMminsToWaitToFinish = 160; // about 1.5 hrs //int numRounds = 1000; long totalNumBytesReceived = 1073741824000; int maxMminsToWaitToFinish = 320; // 3 hrs or so //************************ Utilities MyUtils = new Utilities(); //AMB1 - Job string logOutputFileName_AMB1 = testName + "_AMB1.log"; AMB_Settings AMB1 = new AMB_Settings { AMB_ServiceName = clientJobName, AMB_PortAppReceives = "1000", AMB_PortAMBSends = "1001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "N", //*** Don't log as this would be large file AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB1, logOutputFileName_AMB1, AMB_ModeConsts.RegisterInstance); //AMB2 string logOutputFileName_AMB2 = testName + "_AMB2.log"; AMB_Settings AMB2 = new AMB_Settings { AMB_ServiceName = serverName, AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "N", //*** Don't log as this would be large file AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "Y", AMB_Version = "0" }; MyUtils.CallAMB(AMB2, logOutputFileName_AMB2, AMB_ModeConsts.RegisterInstance); //ImmCoord1 string logOutputFileName_ImmCoord1 = testName + "_ImmCoord1.log"; int ImmCoordProcessID1 = MyUtils.StartImmCoord(clientJobName, 1500, logOutputFileName_ImmCoord1); //ImmCoord2 string logOutputFileName_ImmCoord2 = testName + "_ImmCoord2.log"; int ImmCoordProcessID2 = MyUtils.StartImmCoord(serverName, 2500, logOutputFileName_ImmCoord2); //Client Job Call string logOutputFileName_ClientJob = testName + "_ClientJob.log"; int clientJobProcessID = MyUtils.StartPerfClientJob("1001", "1000", clientJobName, serverName, "65536", numRounds.ToString(), logOutputFileName_ClientJob); //Server Call string logOutputFileName_Server = testName + "_Server.log"; int serverProcessID = MyUtils.StartPerfServer("2001", "2000", clientJobName, serverName, logOutputFileName_Server, 1, false); // Can't really delay until it is done so have to put a delay in here for ever bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, "DONE", maxMminsToWaitToFinish, false, testName, true); // Wait for Done pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server, "DONE", maxMminsToWaitToFinish, false, testName, true); // Wait for Done // Now do check to make sure total bytes is correct - log should be done so no need to do more than a minute for max wait 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 //** TO DO: Need to do health checks while it is waiting // Stop things so file is freed up and can be opened in verify MyUtils.KillProcess(clientJobProcessID); MyUtils.KillProcess(serverProcessID); MyUtils.KillProcess(ImmCoordProcessID1); MyUtils.KillProcess(ImmCoordProcessID2); }
public void AMB_InProc_TCP_KillServer_Test() { Utilities MyUtils = new Utilities(); //NOTE - the Cleanup has test name hard coded so if this changes, update Cleanup section too string testName = "inproctcpkillservertest"; string clientJobName = testName + "clientjob"; string serverName = testName + "server"; string ambrosiaLogDir = MyUtils.baseAmbrosiaPath + ConfigurationManager.AppSettings["AmbrosiaLogDirectory"] + "\\"; string byteSize = "13958643712"; //AMB1 - Job string logOutputFileName_AMB1 = testName + "_AMB1.log"; AMB_Settings AMB1 = new AMB_Settings { AMB_ServiceName = clientJobName, AMB_PortAppReceives = "1000", AMB_PortAMBSends = "1001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB1, logOutputFileName_AMB1, AMB_ModeConsts.RegisterInstance); //AMB2 string logOutputFileName_AMB2 = testName + "_AMB2.log"; AMB_Settings AMB2 = new AMB_Settings { AMB_ServiceName = serverName, AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", // NOTE: if put this to "Y" then when kill it, it will become a checkpointer which never becomes primary AMB_Version = "0" }; MyUtils.CallAMB(AMB2, logOutputFileName_AMB2, AMB_ModeConsts.RegisterInstance); //Client Job Call string logOutputFileName_ClientJob = testName + "_ClientJob.log"; int clientJobProcessID = MyUtils.StartPerfClientJob("1001", "1000", clientJobName, serverName, "65536", "13", logOutputFileName_ClientJob, MyUtils.deployModeInProcManual, "1500"); //Server Call string logOutputFileName_Server = testName + "_Server.log"; int serverProcessID = MyUtils.StartPerfServer("2001", "2000", clientJobName, serverName, logOutputFileName_Server, 1, false, 0, MyUtils.deployModeInProcManual, "2500"); // Give it 10 seconds to do something before killing it MyUtils.TestDelay(10000); //Kill Server at this point as well as ImmCoord2 MyUtils.KillProcess(serverProcessID); // Restart Server Process string logOutputFileName_Server_Restarted = testName + "_Server_Restarted.log"; int serverProcessID_Restarted = MyUtils.StartPerfServer("2001", "2000", clientJobName, serverName, logOutputFileName_Server_Restarted, 1, false, 0, MyUtils.deployModeInProcManual, "2500"); //Delay until client is done - also check Server just to make sure bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server_Restarted, byteSize, 25, false, testName, true); // Total Bytes received needs to be accurate pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, byteSize, 15, false, testName, true); // Stop things so file is freed up and can be opened in verify MyUtils.KillProcess(clientJobProcessID); MyUtils.KillProcess(serverProcessID_Restarted); // don't do cmp for server as changes from machine to machine // .netcore has slightly different cmp file - not crucial to try to have separate files if (MyUtils.NetFrameworkTestRun) { // Verify Client - .net core with TCP causes extra message in output of core, so don't cmp to others MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_ClientJob); } // Verify integrity of Ambrosia logs by replaying MyUtils.VerifyAmbrosiaLogFile(testName, Convert.ToInt64(byteSize), true, true, AMB1.AMB_Version); }
public void AMB_MTF_KILL_PERSIST_Test() { string testName = "mtfkillpersist"; string clientJobName = testName + "clientjob"; string serverName = testName + "server"; string ambrosiaLogDir = ConfigurationManager.AppSettings["AmbrosiaLogDirectory"] + "\\"; Random rnd = new Random(); bool pass = false; int minsBetweenKills = 2; //****************** MTF Settings *************** // ** Total bytes received can vary a bit so can't use the totalNumBytesReceived int numRounds = 5; long totalNumBytesReceived = 5368709120; //int numRounds = 25; long totalNumBytesReceived = 26843545600; //int numRounds = 100; long totalNumBytesReceived = 107374182400; //int numRounds = 500; long totalNumBytesReceived = 536870912000; //int numRounds = 1000; long totalNumBytesReceived = 1073741824000; //************************ Utilities MyUtils = new Utilities(); //AMB1 - Job string logOutputFileName_AMB1 = testName + "_AMB1.log"; AMB_Settings AMB1 = new AMB_Settings { AMB_ServiceName = clientJobName, AMB_PortAppReceives = "1000", AMB_PortAMBSends = "1001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB1, logOutputFileName_AMB1, AMB_ModeConsts.RegisterInstance); //AMB2 string logOutputFileName_AMB2 = testName + "_AMB2.log"; AMB_Settings AMB2 = new AMB_Settings { AMB_ServiceName = serverName, AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB2, logOutputFileName_AMB2, AMB_ModeConsts.RegisterInstance); //ImmCoord1 string logOutputFileName_ImmCoord1 = testName + "_ImmCoord1.log"; int ImmCoordProcessID1 = MyUtils.StartImmCoord(clientJobName, 1500, logOutputFileName_ImmCoord1); //ImmCoord2 string logOutputFileName_ImmCoord2 = testName + "_ImmCoord2.log"; int ImmCoordProcessID2 = MyUtils.StartImmCoord(serverName, 2500, logOutputFileName_ImmCoord2); //Client Job Call string logOutputFileName_ClientJob = testName + "_ClientJob.log"; int clientJobProcessID = MyUtils.StartPerfClientJob("1001", "1000", clientJobName, serverName, "65536", numRounds.ToString(), logOutputFileName_ClientJob); //Server Call string logOutputFileName_Server = testName + "_Server.log"; int serverProcessID = MyUtils.StartPerfServer("2001", "2000", clientJobName, serverName, logOutputFileName_Server, 1, false); //Loop here of kill and restart server / client while (pass == false) { // Check for it to be done - just return value and don't pop exception // Do this check here instead of at the end to give the delay before killing processes pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, "DONE", minsBetweenKills, true, testName, false); // if passes we don't want to restart things and lose the logs if (pass == false) { // set the random seed so it is reproducible // randomly decide between killing job, server or both int target = rnd.Next(1, 4); string logInfo = "<DEBUG> Random kill (1=C, 2=S, 3=B) " + target.ToString(); MyUtils.LogDebugInfo(logInfo); switch (target) { case 1: // Kill client and restart it MyUtils.KillProcess(clientJobProcessID); MyUtils.KillProcess(ImmCoordProcessID1); Thread.Sleep(2000); // restart ImmCoord and job.exe ImmCoordProcessID1 = MyUtils.StartImmCoord(clientJobName, 1500, logOutputFileName_ImmCoord1); //Client Job Call logOutputFileName_ClientJob = testName + "_ClientJob.log"; clientJobProcessID = MyUtils.StartPerfClientJob("1001", "1000", clientJobName, serverName, "65536", numRounds.ToString(), logOutputFileName_ClientJob); break; case 2: // Kill Server and restart it MyUtils.KillProcess(serverProcessID); MyUtils.KillProcess(ImmCoordProcessID2); Thread.Sleep(2000); // Restart ImmCoord and server ImmCoordProcessID2 = MyUtils.StartImmCoord(serverName, 2500, logOutputFileName_ImmCoord2); serverProcessID = MyUtils.StartPerfServer("2001", "2000", clientJobName, serverName, logOutputFileName_Server, 1, false); break; case 3: // Kill client and server and restart them MyUtils.KillProcess(clientJobProcessID); MyUtils.KillProcess(serverProcessID); MyUtils.KillProcess(ImmCoordProcessID1); MyUtils.KillProcess(ImmCoordProcessID2); Thread.Sleep(2000); ImmCoordProcessID1 = MyUtils.StartImmCoord(clientJobName, 1500, logOutputFileName_ImmCoord1); clientJobProcessID = MyUtils.StartPerfClientJob("1001", "1000", clientJobName, serverName, "65536", numRounds.ToString(), logOutputFileName_ClientJob); ImmCoordProcessID2 = MyUtils.StartImmCoord(serverName, 2500, logOutputFileName_ImmCoord2); serverProcessID = MyUtils.StartPerfServer("2001", "2000", clientJobName, serverName, logOutputFileName_Server, 1, false); break; } } //*#*#*#* TO DO ... put some kind of check here that if it gets stuck, then kick out maybe compare start time to current time } // Stop things MyUtils.KillProcess(clientJobProcessID); MyUtils.KillProcess(serverProcessID); MyUtils.KillProcess(ImmCoordProcessID1); MyUtils.KillProcess(ImmCoordProcessID2); // Now that we got out of the loop do a check of server and check total bytes - will pop exception if values not correct pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server, "DONE", 1, true, testName, true); // Wait for Done // 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 // 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); }
public void UnitTest_BasicInProcTCPEndtoEnd_Test() { Utilities MyUtils = new Utilities(); //NOTE - the Cleanup has this hard coded so if this changes, update Cleanup section too string originaltestName = "unittestinproctcp"; // use original name so can use cmp files properly string testName = originaltestName + uniqueTestNameID; // this is the version to make it unqiue so other CI tests don't affect it string clientJobName = testName + "clientjob"; string serverName = testName + "server"; string ambrosiaLogDir = MyUtils.baseAmbrosiaPath + ConfigurationManager.AppSettings["AmbrosiaLogDirectory"] + "\\"; string byteSize = "1073741824"; //AMB1 - Job string logOutputFileName_AMB1 = testName + "_AMB1.log"; AMB_Settings AMB1 = new AMB_Settings { AMB_ServiceName = clientJobName, AMB_PortAppReceives = "1000", AMB_PortAMBSends = "1001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB1, logOutputFileName_AMB1, AMB_ModeConsts.RegisterInstance); //AMB2 string logOutputFileName_AMB2 = testName + "_AMB2.log"; AMB_Settings AMB2 = new AMB_Settings { AMB_ServiceName = serverName, AMB_PortAppReceives = "2000", AMB_PortAMBSends = "2001", AMB_ServiceLogPath = ambrosiaLogDir, AMB_CreateService = "A", AMB_PauseAtStart = "N", AMB_PersistLogs = "Y", AMB_NewLogTriggerSize = "1000", AMB_ActiveActive = "N", AMB_Version = "0" }; MyUtils.CallAMB(AMB2, logOutputFileName_AMB2, AMB_ModeConsts.RegisterInstance); //Client Job Call string logOutputFileName_ClientJob = testName + "_ClientJob.log"; int clientJobProcessID = MyUtils.StartPerfClientJob("1001", "1000", clientJobName, serverName, "1024", "1", logOutputFileName_ClientJob, MyUtils.deployModeInProcManual, "1500"); // Give it a few seconds to start MyUtils.TestDelay(2000); //Server Call string logOutputFileName_Server = testName + "_Server.log"; int serverProcessID = MyUtils.StartPerfServer("2001", "2000", clientJobName, serverName, logOutputFileName_Server, 1, false, 0, MyUtils.deployModeInProcManual, "2500"); //Delay until client is done - also check Server just to make sure bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_ClientJob, byteSize, 5, false, testName, true); // number of bytes processed pass = MyUtils.WaitForProcessToFinish(logOutputFileName_Server, byteSize, 5, false, testName, true); // Stop things so file is freed up and can be opened in verify MyUtils.KillProcess(clientJobProcessID); MyUtils.KillProcess(serverProcessID); // .netcore has slightly different cmp file - not crucial to try to have separate files if (MyUtils.NetFrameworkTestRun) { //Verify AMB MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_AMB1, false, false, originaltestName); MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_AMB2, false, false, originaltestName); // Verify Client - NetCore CLR bug causes extra info in the output for this so do not check for core run MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_ClientJob, false, false, originaltestName); } // Verify Server MyUtils.VerifyTestOutputFileToCmpFile(logOutputFileName_Server, false, false, originaltestName); // Verify integrity of Ambrosia logs by replaying MyUtils.VerifyAmbrosiaLogFile(testName, Convert.ToInt64(byteSize), true, true, AMB1.AMB_Version, "", false, true, "", originaltestName); }