public async Task ServiceTesterWhenServiceFailedToGracefullyShutdownShouldThrow() { _tester = AssemblyInitialize.ResolutionRoot.GetServiceTester <CalculatorServiceHost>(8555, shutdownWaitTime: TimeSpan.Zero); Action act = () => _tester.Dispose(); act.ShouldThrow <Exception>().Message.ShouldContain("service failed to shutdown gracefully"); }
public void AfterOrleansStartup_ShouldBeCalled() { var tester = new ServiceTester <TestHost>(); Assert.IsTrue(tester.Host.AfterOrleansCalled, "AfterOrleansStartup hasn't been called."); tester.Dispose(); }
public async Task InstanceReadyBeforeCallingMethod_Warmup() { ServiceTester <WarmupTestServiceHostWithSiloHostFake> tester = new ServiceTester <WarmupTestServiceHostWithSiloHostFake>(); var beforeGrainCreated = DateTime.Now; IWarmupTestServiceGrain grain = tester.GrainClient.GetGrain <IWarmupTestServiceGrain>(0); var dependencyCreateDate = await grain.DependencyCreateDate(); Assert.Greater(beforeGrainCreated, dependencyCreateDate, "dependencyCreateDate should create before grain is created"); tester.Dispose(); }
public async Task InstanceReadyBeforeCallingMethod_Warmup() { ServiceTester <CalculatorServiceHost> tester = AssemblyInitialize.ResolutionRoot.GetServiceTester <CalculatorServiceHost>(mainPort); IWarmupTestServiceGrain grain = tester.GetGrainClient <IWarmupTestServiceGrain>(0); int result = await grain.TestWarmedTimes(); result = await grain.TestWarmedTimes(); result = await grain.TestWarmedTimes(); Assert.AreEqual(result, 1); tester.Dispose(); }
public async Task ServiceTesterWhenServiceFailedToGracefullyShutdownShouldThrow() { // shutdownWaitTimeSec: 0 var serviceArguments = new ServiceArguments( ServiceStartupMode.CommandLineNonInteractive, ConsoleOutputMode.Disabled, SiloClusterMode.PrimaryNode, DisposablePort.GetPort().Port, onStopWaitTimeSec: 0); _tester = new ServiceTester <CalculatorServiceHost>(serviceArguments); Action act = () => _tester.Dispose(); act.ShouldThrow <Exception>().Message.ShouldContain("service failed to shutdown gracefully"); }
public void HostShouldStartAndStopMultipleTimes() { _counter++; Stopwatch sw = Stopwatch.StartNew(); Console.WriteLine($"-----------------------------Start run {_counter} time---------------"); try { var host = new ServiceTester <TestHost>(); host.GetServiceProxy <ICalculatorService>(); Console.WriteLine($"-----------------------------Silo Is running {_counter} time took, {sw.ElapsedMilliseconds}ms---------------"); host.Dispose(); } finally { Console.WriteLine( $"-----------------------------End run {_counter} time, took {sw.ElapsedMilliseconds}ms ---------------"); } }
public async Task HealthCheck_ServcieDrain_StatueShouldBe521() { int port = DisposablePort.GetPort().Port; //serviceDrainTimeSec: var serviceArguments = new ServiceArguments(ServiceStartupMode.CommandLineNonInteractive, ConsoleOutputMode.Disabled, SiloClusterMode.PrimaryNode, port, serviceDrainTimeSec: 1, instanceName: "test", initTimeOutSec: 10); var customServiceTester = new ServiceTester <CalculatorServiceHost>(serviceArguments); var dispose = Task.Run(() => customServiceTester.Dispose()); await Task.Delay(200); var httpResponseMessage = await new HttpClient().GetAsync(new Uri($"http://{CurrentApplicationInfo.HostName}:{port}/{nameof(IProgrammableHealth).Substring(1)}.status")); httpResponseMessage.StatusCode.ShouldBe((HttpStatusCode)521); await dispose; }
public void TestFixtureTearDown() { _serviceTester?.Dispose(); }
public void TearDown() { tester.Dispose(); }