private async Task MergeGrainResolverTestsImpl <T>(Type defaultPlacementStrategy, bool restartClient, Func <IGrain, Task> func, params Type[] blackListedTypes) where T : IGrainWithIntegerKey { SetupAndDeployCluster(defaultPlacementStrategy, blackListedTypes); var delayTimeout = RefreshInterval.Add(RefreshInterval); // Should fail var exception = Assert.Throws <ArgumentException>(() => this.cluster.GrainFactory.GetGrain <T>(0)); Assert.Contains("Could not find an implementation for interface", exception.Message); // Start a new silo with TestGrain await cluster.StartAdditionalSiloAsync(); await Task.Delay(delayTimeout); if (restartClient) { // Disconnect/Reconnect the client await cluster.StopClusterClientAsync(); await cluster.InitializeClientAsync(); } else { await Task.Delay(ClientRefreshDelay.Multiply(3)); } for (var i = 0; i < 5; i++) { // Success var g = this.cluster.GrainFactory.GetGrain <T>(i); await func(g); } // Stop the latest silos await cluster.StopSecondarySilosAsync(); await Task.Delay(delayTimeout); if (restartClient) { // Disconnect/Reconnect the client await cluster.StopClusterClientAsync(); await cluster.InitializeClientAsync(); } else { await Task.Delay(ClientRefreshDelay.Multiply(3)); } // Should fail exception = Assert.Throws <ArgumentException>(() => this.cluster.GrainFactory.GetGrain <T>(0)); Assert.Contains("Could not find an implementation for interface", exception.Message); }
public async Task StreamProducerOnDroppedClientTest(string streamProviderName, string streamNamespace) { const int eventsProduced = 10; Guid streamGuid = Guid.NewGuid(); await ProduceEventsFromClient(streamProviderName, streamGuid, streamNamespace, eventsProduced); // Hard kill client await testHost.KillClientAsync(); // make sure dead client has had time to drop await Task.Delay(Constants.DEFAULT_CLIENT_DROP_TIMEOUT + TimeSpan.FromSeconds(5)); // initialize new client await testHost.InitializeClientAsync(); // run test again. await ProduceEventsFromClient(streamProviderName, streamGuid, streamNamespace, eventsProduced); }