public void TestExitEarlyFault1() { Variant foo = new Variant("foo"); Variant bar = new Variant("bar"); // FaultOnEarlyExit doesn't fault when stop message is sent Dictionary <string, Variant> args = new Dictionary <string, Variant>(); args["Command"] = new Variant("echo"); args["Arguments"] = new Variant("hello"); args["StartOnCall"] = foo; args["WaitForExitOnCall"] = bar; args["FaultOnEarlyExit"] = new Variant("true"); CrashWrangler w = new CrashWrangler(null, "name", args); w.SessionStarting(); w.IterationStarting(1, false); w.Message("Action.Call", foo); w.Message("Action.Call", bar); w.IterationFinished(); Assert.AreEqual(false, w.DetectedFault()); w.SessionFinished(); w.StopMonitor(); }
public void TestExitOnCallFault() { Variant foo = new Variant("foo"); Variant bar = new Variant("bar"); Dictionary <string, Variant> args = new Dictionary <string, Variant>(); args["Command"] = new Variant("nc"); args["Arguments"] = new Variant("-l 12345"); args["StartOnCall"] = foo; args["WaitForExitOnCall"] = bar; args["WaitForExitTimeout"] = new Variant("2000"); args["NoCpuKill"] = new Variant("true"); CrashWrangler w = new CrashWrangler(null, "name", args); w.Message("Action.Call", foo); w.Message("Action.Call", bar); w.IterationFinished(); Assert.AreEqual(true, w.DetectedFault()); Fault f = w.GetMonitorData(); Assert.NotNull(f); Assert.AreEqual("ProcessFailedToExit", f.folderName); w.SessionFinished(); w.StopMonitor(); }
public void TestExitOnCallNoFault() { Variant foo = new Variant("foo"); Variant bar = new Variant("bar"); Dictionary <string, Variant> args = new Dictionary <string, Variant>(); args["Command"] = new Variant("echo"); args["Arguments"] = new Variant("hello"); args["StartOnCall"] = foo; args["WaitForExitOnCall"] = bar; args["NoCpuKill"] = new Variant("true"); CrashWrangler w = new CrashWrangler(null, "name", args); w.Message("Action.Call", foo); w.Message("Action.Call", bar); w.IterationFinished(); Assert.AreEqual(false, w.DetectedFault()); w.SessionFinished(); w.StopMonitor(); }
public void TestStartOnCall() { Variant foo = new Variant("foo"); Dictionary <string, Variant> args = new Dictionary <string, Variant>(); args["Command"] = new Variant("nc"); args["Arguments"] = new Variant("-l 12345"); args["StartOnCall"] = foo; args["WaitForExitTimeout"] = new Variant("2000"); args["NoCpuKill"] = new Variant("true"); CrashWrangler w = new CrashWrangler(null, "name", args); w.Message("Action.Call", foo); Thread.Sleep(1000); var before = DateTime.Now; w.IterationFinished(); var after = DateTime.Now; var span = (after - before); Assert.AreEqual(false, w.DetectedFault()); w.SessionFinished(); w.StopMonitor(); Assert.GreaterOrEqual(span.TotalSeconds, 1.8); Assert.LessOrEqual(span.TotalSeconds, 2.2); }
public void TestExitEarlyFault3() { Variant foo = new Variant("foo"); // FaultOnEarlyExit doesn't fault when StartOnCall is used Dictionary <string, Variant> args = new Dictionary <string, Variant>(); args["Command"] = new Variant("nc"); args["Arguments"] = new Variant("-l 12345"); args["StartOnCall"] = foo; args["FaultOnEarlyExit"] = new Variant("true"); CrashWrangler w = new CrashWrangler(null, "name", args); w.SessionStarting(); w.IterationStarting(1, false); w.Message("Action.Call", foo); w.IterationFinished(); Assert.AreEqual(false, w.DetectedFault()); w.SessionFinished(); w.StopMonitor(); }
public void TestExitEarlyFault2() { Variant foo = new Variant("foo"); // FaultOnEarlyExit faults when StartOnCall is used and stop message is not sent Dictionary <string, Variant> args = new Dictionary <string, Variant>(); args["Command"] = new Variant("echo"); args["Arguments"] = new Variant("hello"); args["StartOnCall"] = foo; args["FaultOnEarlyExit"] = new Variant("true"); CrashWrangler w = new CrashWrangler(null, "name", args); w.SessionStarting(); w.IterationStarting(1, false); w.Message("Action.Call", foo); System.Threading.Thread.Sleep(1000); w.IterationFinished(); Assert.AreEqual(true, w.DetectedFault()); Fault f = w.GetMonitorData(); Assert.NotNull(f); Assert.AreEqual("ProcessExitedEarly", f.folderName); w.SessionFinished(); w.StopMonitor(); }