public void EnsureOrleansHostInitialized() { var fixtureType = this.GetType().AssemblyQualifiedName; var runningCluster = TestingSiloHost.Instance; if (runningCluster != null && previousFixtureType != null && previousFixtureType == fixtureType && runningCluster == previousHostedCluster) { runningCluster.StopAdditionalSilos(); this.HostedCluster = runningCluster; return; } previousHostedCluster = null; previousFixtureType = null; TestingSiloHost.StopAllSilosIfRunning(); var siloHostFactory = IsolatedHostedTestClusterUtils.FindTestingSiloHostFactory(this); this.HostedCluster = siloHostFactory.Invoke(); previousHostedCluster = this.HostedCluster; previousFixtureType = fixtureType; }
public StreamProvidersTests_ProviderConfigNotLoaded(ITestOutputHelper output, Fixture fixture) { this.output = output; HostedCluster = fixture.HostedCluster; SiloOptions = Fixture.SiloOptions; ServiceId = Fixture.ServiceId; }
public void InitializeOrleansHost() { TestingSiloHost.StopAllSilosIfRunning(); var siloHostFactory = IsolatedHostedTestClusterUtils.FindTestingSiloHostFactory(this); this.HostedCluster = siloHostFactory.Invoke(); }
public static void AssemblyCleanup() { // Big issue with this! This method gets called not when it transitions to a new assembly, but after all assemblies finish testing. // It's an issue because each assembly is run in a separate AppDomain, so once the next assembly starts, it will actually // get TestingSiloHost.Instance and it will be null. Nevertheless, the another host might be running, and if they use the same ports then they'll be borked. TestingSiloHost.StopAllSilosIfRunning(); }
public override TestingSiloHost CreateSiloHost() { var siloHost = new TestingSiloHost( new TestingSiloOptions { SiloConfigFile = new FileInfo("OrleansConfigurationForTesting.xml"), AdjustConfig = config => { config.AddMemoryStorageProvider("PubSubStore"); config.Globals.RegisterStreamProvider <AzureQueueStreamProvider>(AQStreamProviderName); config.Globals.ClientDropTimeout = TimeSpan.FromSeconds(5); } }, new TestingClientOptions { AdjustConfig = config => { config.RegisterStreamProvider <AzureQueueStreamProvider>(AQStreamProviderName, new Dictionary <string, string>()); config.Gateways.Add(new IPEndPoint(IPAddress.Loopback, 40001)); } }); runner = new ClientStreamTestRunner(siloHost); return(siloHost); }
public override TestingSiloHost CreateSiloHost() { var siloOptions = new TestingSiloOptions { StartFreshOrleans = true, StartSecondary = false, SiloConfigFile = new FileInfo("OrleansConfigurationForTesting.xml"), AdjustConfig = config => { config.AddMemoryStorageProvider("PubSubStore"); config.Globals.RegisterStreamProvider <SimpleMessageStreamProvider>(SMSStreamProviderName); config.Globals.ClientDropTimeout = TimeSpan.FromSeconds(5); } }; var clientOptions = new TestingClientOptions { ClientConfigFile = new FileInfo("ClientConfigurationForTesting.xml"), AdjustConfig = config => { config.RegisterStreamProvider <SimpleMessageStreamProvider>(SMSStreamProviderName); } }; var testHost = new TestingSiloHost(siloOptions, clientOptions); runner = new ClientStreamTestRunner(testHost); return(testHost); }
public void NewCluster(string clusterid, int numSilos, Action <ClusterConfiguration> customizer = null) { lock (Clusters) { WriteLog("Starting Cluster {0}...", clusterid); var mycount = Clusters.Count; var silohandles = new SiloHandle[numSilos]; var options = new TestingSiloOptions { StartClient = false, AdjustConfig = customizer, BasePort = GetPortBase(mycount), ProxyBasePort = GetProxyBase(mycount) }; silohandles[0] = TestingSiloHost.StartOrleansSilo(null, Silo.SiloType.Primary, options, 0); Parallel.For(1, numSilos, i => { silohandles[i] = TestingSiloHost.StartOrleansSilo(null, Silo.SiloType.Secondary, options, i); }); Clusters[clusterid] = new ClusterInfo { Silos = silohandles.ToList(), SequenceNumber = mycount }; WriteLog("Cluster {0} started.", clusterid); } }
public HostedTestClusterPerTest() { TestDefaultConfiguration.InitializeDefaults(); GrainClient.Uninitialize(); SerializationManager.InitializeForTesting(); this.HostedCluster = this.CreateSiloHost(); }
public static TestingSiloHost CreateSiloHost() { var host = new TestingSiloHost(siloOptions); string config = host.Primary.Silo.TestHook.PrintSiloConfig(); Console.WriteLine("Running with Silo Config = " + config); return(host); }
public StreamPubSubReliabilityTests(Fixture fixture) { HostedCluster = fixture.HostedCluster; StreamId = Guid.NewGuid(); StreamProviderName = StreamTestsConstants.SMS_STREAM_PROVIDER_NAME; StreamNamespace = StreamTestsConstants.StreamLifecycleTestsNamespace; SetErrorInjection(PubSubStoreProviderName, ErrorInjectionPoint.None); }
public KafkaPressureCacheTests() : base(new TestingSiloOptions() { StartFreshOrleans = false, StartSecondary = false, SiloConfigFile = new FileInfo("OrleansConfigurationForPressureTests.xml"), }) { _runner = new PressuredCacheTestRunner(KafkaStreamProviderName, logger); _host = this; }
public SampleStreamingTests() : base(new TestingSiloOptions { StartFreshOrleans = false, StartSecondary = false, SiloConfigFile = new FileInfo("OrleansConfigurationForStreamingUnitTests.xml") }) { _host = this; }
public KafkaSubscriptionMultiplicityTests() : base(new TestingSiloOptions { StartFreshOrleans = false, StartSecondary = false, SiloConfigFile = new FileInfo("OrleansConfigurationForStreamingUnitTests.xml"), }) { _runner = new SubscriptionMultiplicityTestRunner(KafkaStreamProviderName, GrainClient.Logger); _host = this; }
public KafkaCustomEventTests() : base(new TestingSiloOptions() { StartFreshOrleans = false, StartSecondary = false, SiloConfigFile = new FileInfo("OrleansConfigurationForStreamingUnitTests.xml"), }) { _runner = new CustomEventTestRunner(KafkaStreamProviderName, logger); _host = this; }
public Base_PersistenceGrainTests_AWSStore(ITestOutputHelper output, BaseClusterFixture fixture) { if (!AWSTestConstants.IsDynamoDbAvailable) { throw new SkipException("Unable to connect to DynamoDB simulator"); } this.output = output; HostedCluster = fixture.HostedCluster; timingFactor = TestUtils.CalibrateTimings(); }
public void AddSiloToCluster(string clusterId, string siloName, Action <ClusterConfiguration> customizer = null) { var clusterinfo = Clusters[clusterId]; var options = new TestingSiloOptions { StartClient = false, AdjustConfig = customizer }; var silo = TestingSiloHost.StartOrleansSilo(this.siloHost, Silo.SiloType.Secondary, options, clusterinfo.Silos.Count); }
public ReminderTests_Base(BaseClusterFixture fixture) { HostedCluster = fixture.HostedCluster; ClientConfiguration cfg = ClientConfiguration.LoadFromFile("ClientConfigurationForTesting.xml"); TraceLogger.Initialize(cfg); #if DEBUG TraceLogger.AddTraceLevelOverride("Storage", Severity.Verbose3); TraceLogger.AddTraceLevelOverride("Reminder", Severity.Verbose3); #endif log = TraceLogger.GetLogger(this.GetType().Name, TraceLogger.LoggerType.Application); }
public void StopAllClusters() { lock (Clusters) { Parallel.ForEach(Clusters.Keys, key => { var info = Clusters[key]; Parallel.For(1, info.Silos.Count, i => TestingSiloHost.StopSilo(info.Silos[i])); TestingSiloHost.StopSilo(info.Silos[0]); }); Clusters.Clear(); } }
public async Task AsyncTimerTest_GrainCall() { const string testName = "AsyncTimerTest_GrainCall"; TimeSpan delay = TimeSpan.FromSeconds(5); TimeSpan wait = delay.Multiply(2); ITimerCallGrain grain = null; Exception error = null; try { grain = GrainClient.GrainFactory.GetGrain <ITimerCallGrain>(GetRandomGrainId()); await grain.StartTimer(testName, delay); await Task.Delay(wait); int tickCount = await grain.GetTickCount(); Assert.AreEqual(1, tickCount, "Should be {0} timer callback", tickCount); Exception err = await grain.GetException(); Assert.IsNull(err, "Should be no exceptions during timer callback"); } catch (Exception exc) { Console.WriteLine(exc); error = exc; } try { if (grain != null) { await grain.StopTimer(testName); } } catch (Exception exc) { // Ignore Console.WriteLine("Ignoring exception from StopTimer : {0}", exc); TestingSiloHost.StopAllSilosIfRunning(); } if (error != null) { Assert.Fail("Test {0} failed with error {1}", testName, error); } }
public override TestingSiloHost CreateSiloHost() { var host = new TestingSiloHost(new TestingSiloOptions { StartFreshOrleans = true, AdjustConfig = cfg => cfg.Globals.RegisterBootstrapProvider <PreInvokeCallbackBootrstrapProvider>( "PreInvokeCallbackBootrstrapProvider") }); return(host); }
public void EnsureDefaultOrleansHostInitialized() { var runningCluster = TestingSiloHost.Instance; if (runningCluster != null && runningCluster == defaultHostedCluster) { runningCluster.StopAdditionalSilos(); this.HostedCluster = runningCluster; return; } TestingSiloHost.StopAllSilosIfRunning(); this.HostedCluster = new TestingSiloHost(true); defaultHostedCluster = this.HostedCluster; }
public override TestingSiloHost CreateSiloHost() { var siloHost = new TestingSiloHost(new TestingSiloOptions { StartFreshOrleans = true, SiloConfigFile = new FileInfo("OrleansConfigurationForTesting.xml"), AdjustConfig = AdjustConfig }, new TestingClientOptions { AdjustConfig = AdjustConfig }); runner = new ClientStreamTestRunner(siloHost); return(siloHost); }
public override TestingSiloHost CreateSiloHost() { var siloHost = new TestingSiloHost( new TestingSiloOptions { SiloConfigFile = new FileInfo("OrleansConfigurationForStreamingUnitTests.xml"), }, new TestingClientOptions() { AdjustConfig = config => { config.RegisterStreamProvider <AzureQueueStreamProvider>(AQStreamProviderName, new Dictionary <string, string>()); config.Gateways.Add(new IPEndPoint(IPAddress.Loopback, 40001)); }, }); runner = new SubscriptionMultiplicityTestRunner(AQStreamProviderName, GrainClient.Logger); return(siloHost); }
public void NewCluster(string clusterId, int numSilos, Action <ClusterConfiguration> customizer = null) { lock (Clusters) { var myCount = Clusters.Count; WriteLog("Starting Cluster {0} ({1})...", myCount, clusterId); if (myCount == 0) { TestingSiloHost.StopAllSilosIfRunning(); this.siloHost = TestingSiloHost.CreateUninitialized(); } var silohandles = new SiloHandle[numSilos]; var options = new TestingSiloOptions { StartClient = false, AdjustConfig = customizer, BasePort = GetPortBase(myCount), ProxyBasePort = GetProxyBase(myCount) }; silohandles[0] = TestingSiloHost.StartOrleansSilo(this.siloHost, Silo.SiloType.Primary, options, 0); Parallel.For(1, numSilos, paralleloptions, i => { silohandles[i] = TestingSiloHost.StartOrleansSilo(this.siloHost, Silo.SiloType.Secondary, options, i); }); Clusters[clusterId] = new ClusterInfo { Silos = silohandles.ToList(), SequenceNumber = myCount }; if (myCount == 0) { gossipStabilizationTime = GetGossipStabilizationTime(this.siloHost.Globals); } WriteLog("Cluster {0} started. [{1}]", clusterId, string.Join(" ", silohandles.Select(s => s.ToString()))); } }
public async Task AllowClusterReuseBetweenInvocations() { try { var host = new TestingSiloHost(startFreshOrleans: true); var initialDeploymentId = host.DeploymentId; var initialSilo = ((AppDomainSiloHandle)host.Primary).SiloHost; var grain = host.GrainFactory.GetGrain <ISimpleGrain>(TestUtils.GetRandomGrainId()); await grain.GetA(); host = new TestingSiloHost(startFreshOrleans: false); Assert.Equal(initialDeploymentId, host.DeploymentId); Assert.Same(initialSilo, ((AppDomainSiloHandle)host.Primary).SiloHost); grain = host.GrainFactory.GetGrain <ISimpleGrain>(TestUtils.GetRandomGrainId()); await grain.GetA(); } finally { TestingSiloHost.StopAllSilosIfRunning(); } }
public static void ClassInitialize(TestContext testContext) { TestingSiloHost.StopAllSilos(); }
public BootstrapProvidersTests(ITestOutputHelper output, Fixture fixture) { this.output = output; this.HostedCluster = fixture.HostedCluster; }
public HostedTestClusterPerTest() { GrainClient.Uninitialize(); SerializationManager.InitializeForTesting(); this.HostedCluster = this.CreateSiloHost(); }
public ControllableStreamProviderTests(Fixture fixture) { this.fixture = fixture; this.HostedCluster = fixture.HostedCluster; }
public HaloStreamSubscribeTests(Fixture fixture) { HostedCluster = fixture.HostedCluster; }