public HystrixTimerTest(ITestOutputHelper output) { _ = HystrixTimer.GetInstance(); HystrixTimer.Reset(); HystrixPlugins.Reset(); this.output = output; }
public void TestReset() { HystrixTimer timer = HystrixTimer.GetInstance(); TestListener l1 = new TestListener(50, "A"); TimerReference tref = timer.AddTimerListener(l1); Task ex = tref._timerTask; Assert.False(ex.IsCanceled); Time.WaitUntil(() => { return(ex.Status == TaskStatus.Running); }, 200); // perform reset which should shut it down HystrixTimer.Reset(); Time.Wait(50); Assert.True(ex.IsCompleted); Assert.Null(tref._timerTask); // assert it starts up again on use TestListener l2 = new TestListener(50, "A"); TimerReference tref2 = timer.AddTimerListener(l2); Task ex2 = tref2._timerTask; Assert.False(ex2.IsCanceled); // reset again to shutdown what we just started HystrixTimer.Reset(); // try resetting again to make sure it's idempotent (ie. doesn't blow up on an NPE) HystrixTimer.Reset(); }
public static void Reset() { globalScopedCollapsers.Clear(); requestScopedCollapsers.Clear(); HystrixTimer.Reset(); }