public ClusterFixture() { TestClusterBuilder builder = new TestClusterBuilder(1); builder.Options.ServiceId = "Service"; builder.Options.ClusterId = "TestCluster"; builder.AddSiloBuilderConfigurator <SiloConfigurator>(); string redisHost = Environment.GetEnvironmentVariable("REDIS_HOST") ?? "127.0.0.1"; string redisPort = Environment.GetEnvironmentVariable("REDIS_PORT") ?? "6379"; string redisConnectionString = $"{redisHost}:{redisPort}, allowAdmin=true"; builder.ConfigureHostConfiguration(config => { config.AddInMemoryCollection(new Dictionary <string, string>() { { "RedisConnectionString", redisConnectionString } }); }); Cluster = builder.Build(); Cluster.Deploy(); Cluster.InitializeClient(); Client = Cluster.Client; ConfigurationOptions redisOptions = ConfigurationOptions.Parse(redisConnectionString); _redis = ConnectionMultiplexer.ConnectAsync(redisOptions).Result; Database = _redis.GetDatabase(); }
public ClusterFixture() { _redis = new RedisInside.Redis(); Console.WriteLine(_redis.Endpoint.ToString()); Console.WriteLine("Initializing Orleans TestCluster"); var builder = new TestClusterBuilder(1); builder.Options.ServiceId = "Service"; builder.Options.ClusterId = "TestCluster"; builder.AddSiloBuilderConfigurator <SiloConfigurator>(); builder.AddClientBuilderConfigurator <ClientConfigurator>(); //this is one of the only ways to be able to pass data (the redis connection string) to the silo(s) that TestCluster will startup builder.ConfigureHostConfiguration(config => { config.AddInMemoryCollection(new Dictionary <string, string>() { { nameof(RedisInside.Redis), _redis.Endpoint.ToString() } }); }); Cluster = builder.Build(); Cluster.Deploy(); Cluster.InitializeClient(); Client = Cluster.Client; var redisOptions = ConfigurationOptions.Parse(_redis.Endpoint.ToString()); var connection = ConnectionMultiplexer.ConnectAsync(redisOptions).Result; Database = connection.GetDatabase(); Console.WriteLine("Initialized Orleans TestCluster"); }
public ClusterFixture() { // prepare to receive the fake services from individual silos GrainStorageGroups[TestClusterId] = new ConcurrentBag <FakeGrainStorage>(); TimerRegistryGroups[TestClusterId] = new ConcurrentBag <FakeTimerRegistry>(); var builder = new TestClusterBuilder(); // add the cluster id for this instance // this allows the silos to safely lookup shared data for this cluster deployment // without this we can only share data via static properties and that messes up parallel testing builder.ConfigureHostConfiguration(config => { config.AddInMemoryCollection(new Dictionary <string, string>() { { nameof(TestClusterId), TestClusterId } }); }); // a configurator allows the silos to configure themselves // at this time, configurators cannot take injected parameters // therefore we must other means of sharing objects as you can see above builder.AddSiloBuilderConfigurator <SiloBuilderConfigurator>(); Cluster = builder.Build(); Cluster.Deploy(); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.Options.InitialSilosCount = 4; builder.Options.UseTestClusterMembership = false; var relationalStorage = RelationalStorageForTesting.SetupInstance(AdoInvariant, TestDatabaseName).Result; builder.ConfigureHostConfiguration(configBuilder => configBuilder.AddInMemoryCollection( new Dictionary <string, string> { { ConnectionStringKey, relationalStorage.CurrentConnectionString } })); builder.ConfigureLegacyConfiguration(legacy => { legacy.ClusterConfiguration.Globals.ServiceId = ServiceId; legacy.ClusterConfiguration.Globals.MaxResendCount = 0; legacy.ClusterConfiguration.Globals.RegisterStorageProvider <UnitTests.StorageTests.MockStorageProvider>("test1"); legacy.ClusterConfiguration.Globals.RegisterStorageProvider <UnitTests.StorageTests.MockStorageProvider>("test2", new Dictionary <string, string> { { "Config1", "1" }, { "Config2", "2" } }); legacy.ClusterConfiguration.Globals.RegisterStorageProvider <UnitTests.StorageTests.ErrorInjectionStorageProvider>("ErrorInjector"); legacy.ClusterConfiguration.Globals.RegisterStorageProvider <UnitTests.StorageTests.MockStorageProvider>("lowercase"); }); builder.AddSiloBuilderConfigurator <MySiloBuilderConfigurator>(); builder.AddClientBuilderConfigurator <GatewayConnectionTests.ClientBuilderConfigurator>(); }
public async Task CanInitialize() { var builder = new TestClusterBuilder(2); builder.Options.ServiceId = Guid.NewGuid().ToString(); builder.ConfigureHostConfiguration(TestDefaultConfiguration.ConfigureHostConfiguration); var testCluster = builder.Build(); await testCluster.DeployAsync(); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { string connectionString = RelationalStorageForTesting.SetupInstance(AdoInvariant, TestDatabaseName) .Result.CurrentConnectionString; builder.ConfigureHostConfiguration(config => config.AddInMemoryCollection(new Dictionary <string, string> { [ConnectionStringKey] = connectionString })); builder.AddSiloBuilderConfigurator <SiloConfigurator>(); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.ConfigureHostConfiguration(TestDefaultConfiguration.ConfigureHostConfiguration); builder.AddSiloBuilderConfigurator <SiloInvokerTestSiloBuilderConfigurator>(); builder.ConfigureLegacyConfiguration(legacy => { legacy.ClusterConfiguration.AddMemoryStorageProvider("Default"); legacy.ClusterConfiguration.AddMemoryStorageProvider("PubSubStore"); legacy.ClusterConfiguration.AddSimpleMessageStreamProvider("SMSProvider"); legacy.ClientConfiguration.AddSimpleMessageStreamProvider("SMSProvider"); }); }
public static void ConfigureTestCluster(TestClusterBuilder builder) { builder.ConfigureBuilder(() => { if (builder.Properties.TryGetValue(nameof(LegacyTestClusterConfiguration), out var legacyConfigObj) && legacyConfigObj is LegacyTestClusterConfiguration legacyConfig) { legacyConfig.ClusterConfiguration.AdjustForTestEnvironment(DataConnectionString); legacyConfig.ClientConfiguration.AdjustForTestEnvironment(DataConnectionString); } }); builder.ConfigureHostConfiguration(ConfigureHostConfiguration); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.Options.InitialSilosCount = 4; builder.Options.UseTestClusterMembership = false; var relationalStorage = RelationalStorageForTesting.SetupInstance(AdoInvariant, TestDatabaseName).Result; builder.ConfigureHostConfiguration(configBuilder => configBuilder.AddInMemoryCollection( new Dictionary <string, string> { { ConnectionStringKey, relationalStorage.CurrentConnectionString } })); builder.Options.ServiceId = ServiceId.ToString(); builder.AddSiloBuilderConfigurator <MySiloBuilderConfigurator>(); builder.AddClientBuilderConfigurator <GatewayConnectionTests.ClientBuilderConfigurator>(); }
public async Task CanInitializeWithLegacyConfiguration() { var builder = new TestClusterBuilder(2); builder.ConfigureHostConfiguration(TestDefaultConfiguration.ConfigureHostConfiguration); builder.AddSiloBuilderConfigurator <SiloConfigurator>(); this.testCluster = builder.Build(); await this.testCluster.DeployAsync(); var grain = this.testCluster.Client.GetGrain <ISimpleGrain>(1); await grain.SetA(2); Assert.Equal(2, await grain.GetA()); }
public async Task CanInitialize() { var builder = new TestClusterBuilder(2); builder.Options.ServiceId = Guid.NewGuid(); builder.ConfigureHostConfiguration(TestDefaultConfiguration.ConfigureHostConfiguration); this.testCluster = builder.Build(); await this.testCluster.DeployAsync(); var grain = this.testCluster.Client.GetGrain <ISimpleGrain>(1); await grain.SetA(2); Assert.Equal(2, await grain.GetA()); }
public ClusterFixture() { var builder = new TestClusterBuilder(); builder.ConfigureHostConfiguration(config => { config.AddInMemoryCollection(new Dictionary <string, string> { { "Orleans_SqlServer_ConStr", @"Data Source=(LocalDB)\MSSQLLocalDB;Initial Catalog=SqlServerTestDb;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False" } }); }); builder.AddSiloBuilderConfigurator <TestSiloBuilderConfigurator>(); TestCluster = builder.Build(); TestCluster.Deploy(); }
public async Task CanInitializeWithLegacyConfiguration() { var builder = new TestClusterBuilder(2); builder.ConfigureHostConfiguration(TestDefaultConfiguration.ConfigureHostConfiguration); builder.ConfigureLegacyConfiguration(legacy => { legacy.ClusterConfiguration.AddMemoryStorageProvider("Default"); }); this.testCluster = builder.Build(); await this.testCluster.DeployAsync(); var grain = this.testCluster.Client.GetGrain <ISimpleGrain>(1); await grain.SetA(2); Assert.Equal(2, await grain.GetA()); }
public ClusterFixture(IMessageSink messageSink) { _messageSink = messageSink; _elasticsearch = new ElasticsearchInside.Elasticsearch(c => c.SetElasticsearchStartTimeout(6000) .EnableLogging() .LogTo(s => _messageSink.OnMessage(new Xunit.Sdk.DiagnosticMessage(s ?? string.Empty)))); _elasticsearch.ReadySync(); var builder = new TestClusterBuilder(); // add the cluster id for this instance // this allows the silos to safely lookup shared data for this cluster deployment // without this we can only share data via static properties and that messes up parallel testing builder.ConfigureHostConfiguration(config => { config.AddInMemoryCollection(new Dictionary <string, string>() { { nameof(TestClusterId), TestClusterId }, { nameof(ESEndpoint), _elasticsearch.Url.ToString() } }); }); // a configurator allows the silos to configure themselves // at this time, configurators cannot take injected parameters // therefore we must other means of sharing objects as you can see above builder.AddSiloBuilderConfigurator <SiloBuilderConfigurator>(); builder.AddClientBuilderConfigurator <ClientBuilderConfigurator>(); Cluster = builder.Build(); Cluster.Deploy(); //var esTeleM = new ElasticSearchTelemetryConsumer(_elasticsearch.Url, "orleans-telemetry"); //LogManager.TelemetryConsumers.Add(esTeleM); //LogManager.LogConsumers.Add(esTeleM); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.ConfigureHostConfiguration(TestDefaultConfiguration.ConfigureHostConfiguration); builder.AddSiloBuilderConfigurator <SiloInvokerTestSiloBuilderConfigurator>(); builder.AddClientBuilderConfigurator <ClientConfigurator>(); }
public static void ConfigureTestCluster(TestClusterBuilder builder) { builder.ConfigureHostConfiguration(ConfigureHostConfiguration); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.ConfigureHostConfiguration(TestDefaultConfiguration.ConfigureHostConfiguration); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.ConfigureHostConfiguration(TestDefaultConfiguration.ConfigureHostConfiguration); builder.AddSiloBuilderConfigurator <StartupTaskSiloConfigurator>(); }