protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.Options.InitialSilosCount = 1;
     builder.ConfigureLegacyConfiguration(legacy =>
     {
         legacy.ClusterConfiguration.AddMemoryStorageProvider("PubSubStore");
         legacy.ClusterConfiguration.Globals.ClientDropTimeout = TimeSpan.FromSeconds(5);
     });
     builder.AddClientBuilderConfigurator <ClientConfiguretor>();
     builder.AddSiloBuilderConfigurator <SiloConfigurator>();
 }
Esempio n. 2
0
        protected override void ConfigureTestCluster(TestClusterBuilder builder)
        {
            TestUtils.CheckForAzureStorage();

            // Define a cluster of 4, but 2 will be stopped.
            builder.Options.InitialSilosCount = 4;
            builder.ConfigureLegacyConfiguration(legacy =>
            {
                legacy.ClientConfiguration.Gateways = legacy.ClientConfiguration.Gateways.Take(1).ToList();
            });
            builder.AddSiloBuilderConfigurator <MySiloBuilderConfigurator>();
        }
Esempio n. 3
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     Assert.True(StorageEmulator.TryStart());
     builder.AddSiloBuilderConfigurator <SiloBuilderConfigurator>();
     builder.Options.InitialSilosCount = NumberOfSilos;
     builder.ConfigureLegacyConfiguration(legacy =>
     {
         legacy.ClusterConfiguration.Globals.DefaultPlacementStrategy    = "ActivationCountBasedPlacement";
         legacy.ClusterConfiguration.Globals.NumMissedProbesLimit        = 1;
         legacy.ClusterConfiguration.Globals.NumVotesForDeathDeclaration = 1;
     });
 }
Esempio n. 4
0
            protected override void ConfigureTestCluster(TestClusterBuilder builder)
            {
                builder.Options.InitialSilosCount = 4;

                builder.ConfigureLegacyConfiguration(legacy =>
                {
                    legacy.ClusterConfiguration.Globals.ServiceId = ServiceId;
                    this.ClusterConfiguration = legacy.ClusterConfiguration;
                });
                builder.AddSiloBuilderConfigurator <SiloConfigurator>();
                builder.AddClientBuilderConfigurator <ClientConfiguretor>();
            }
Esempio n. 5
0
 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");
     });
 }
Esempio n. 6
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     TestUtils.CheckForAzureStorage();
     builder.Options.UseTestClusterMembership = false;
     builder.ConfigureLegacyConfiguration(legacy =>
     {
         legacy.ClusterConfiguration.Globals.DataConnectionString = TestDefaultConfiguration.DataConnectionString;
         legacy.ClusterConfiguration.Globals.LivenessType         = GlobalConfiguration.LivenessProviderType.AzureTable;
         legacy.ClusterConfiguration.PrimaryNode = null;
         legacy.ClusterConfiguration.Globals.SeedNodes.Clear();
     });
 }
Esempio n. 7
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.ConfigureLegacyConfiguration(legacy =>
     {
         legacy.ClusterConfiguration.Globals.RegisterStreamProvider <SimpleMessageStreamProvider>("sms");
         legacy.ClusterConfiguration.Globals.AllowCallChainReentrancy = false;
         legacy.ClusterConfiguration.AddMemoryStorageProvider("Default");
         legacy.ClusterConfiguration.AddMemoryStorageProvider("MemoryStore");
         legacy.ClusterConfiguration.AddMemoryStorageProvider("PubSubStore");
         this.ClusterConfiguration = legacy.ClusterConfiguration;
     });
 }
Esempio n. 8
0
        public void Setup()
        {
            var builder = new TestClusterBuilder();

            builder.ConfigureLegacyConfiguration(legacy =>
            {
                legacy.ClusterConfiguration.AddMemoryStorageProvider();
            });
            builder.AddSiloBuilderConfigurator <SiloBuilderConfigurator>();
            this.host = builder.Build();
            this.host.Deploy();
        }
Esempio n. 9
0
        protected override void ConfigureTestCluster(TestClusterBuilder builder)
        {
            var relationalStorage = RelationalStorageForTesting.SetupInstance(AdoNetInvariants.InvariantNameSqlServer, TestDatabaseName).Result;

            builder.ConfigureLegacyConfiguration(legacy =>
            {
                legacy.ClusterConfiguration.Globals.DataConnectionString = relationalStorage.CurrentConnectionString;
                legacy.ClusterConfiguration.Globals.LivenessType         = GlobalConfiguration.LivenessProviderType.SqlServer;
                legacy.ClusterConfiguration.PrimaryNode = null;
                legacy.ClusterConfiguration.Globals.SeedNodes.Clear();
            });
        }
Esempio n. 10
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     GlobalConfiguration.ENFORCE_MINIMUM_REQUIREMENT_FOR_AGE_LIMIT = false;
     builder.Options.InitialSilosCount = 1;
     builder.AddSiloBuilderConfigurator <SiloHostConfigurator>();
     builder.ConfigureLegacyConfiguration(legacy =>
     {
         legacy.ClusterConfiguration.Globals.Application.SetDefaultCollectionAgeLimit(TimeSpan.FromSeconds(3));
         legacy.ClusterConfiguration.Globals.MaxRequestProcessingTime = TimeSpan.FromSeconds(3);
         legacy.ClusterConfiguration.Globals.CollectionQuantum        = TimeSpan.FromSeconds(1);
     });
 }
Esempio n. 11
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.ConfigureLegacyConfiguration(legacy =>
     {
         legacy.ClusterConfiguration.Globals.AllowCallChainReentrancy = false;
         legacy.ClusterConfiguration.AddMemoryStorageProvider("Default");
         legacy.ClusterConfiguration.AddMemoryStorageProvider("MemoryStore");
         legacy.ClusterConfiguration.AddMemoryStorageProvider("PubSubStore");
         this.ClusterConfiguration = legacy.ClusterConfiguration;
     });
     builder.AddSiloBuilderConfigurator <ReentrancyTestsSiloBuilderConfigurator>();
 }
Esempio n. 12
0
            protected override void ConfigureTestCluster(TestClusterBuilder builder)
            {
                builder.ConfigureLegacyConfiguration(legacy =>
                {
                    legacy.ClusterConfiguration.AddMemoryStorageProvider("PubSubStore");

                    // register stream providers
                    // options.ClusterConfiguration.AddSimpleMessageStreamProvider(StreamTestsConstants.SMS_STREAM_PROVIDER_NAME, false);
                    // options.ClientConfiguration.AddSimpleMessageStreamProvider(StreamTestsConstants.SMS_STREAM_PROVIDER_NAME, false);

                    legacy.ClusterConfiguration.AddAzureQueueStreamProvider(StreamTestsConstants.AZURE_QUEUE_STREAM_PROVIDER_NAME);
                });
            }
Esempio n. 13
0
            protected override void ConfigureTestCluster(TestClusterBuilder builder)
            {
                builder.Options.InitialSilosCount = 4;
                builder.ConfigureLegacyConfiguration(legacy =>
                {
                    legacy.ClusterConfiguration.AddMemoryStorageProvider("MemoryStore", numStorageGrains: 1);

                    legacy.ClusterConfiguration.AddSimpleMessageStreamProvider(StreamTestsConstants.SMS_STREAM_PROVIDER_NAME, fireAndForgetDelivery: false);
                    legacy.ClusterConfiguration.AddSimpleMessageStreamProvider("SMSProviderDoNotOptimizeForImmutableData",
                                                                               fireAndForgetDelivery: false,
                                                                               optimizeForImmutableData: false);
                });
            }
Esempio n. 14
0
        protected override void ConfigureTestCluster(TestClusterBuilder builder)
        {
            builder.ConfigureLegacyConfiguration(legacy =>
            {
                legacy.ClusterConfiguration.Globals.Application.SetDefaultCollectionAgeLimit(TimeSpan.FromMinutes(1));
                legacy.ClusterConfiguration.Globals.Application.SetCollectionAgeLimit(typeof(MultipleSubscriptionConsumerGrain), TimeSpan.FromHours(2));
                legacy.ClusterConfiguration.Globals.ResponseTimeout = TimeSpan.FromMinutes(30);

                legacy.ClusterConfiguration.AddMemoryStorageProvider("PubSubStore");
                legacy.ClusterConfiguration.AddSimpleMessageStreamProvider(StreamTestsConstants.SMS_STREAM_PROVIDER_NAME);
                legacy.ClientConfiguration.AddSimpleMessageStreamProvider(StreamTestsConstants.SMS_STREAM_PROVIDER_NAME);
            });
        }
Esempio n. 15
0
            protected override void ConfigureTestCluster(TestClusterBuilder builder)
            {
                var settings = new Dictionary <string, string>
                {
                    { PersistentStreamProviderConfig.QUEUE_BALANCER_TYPE, StreamQueueBalancerType.DynamicClusterConfigDeploymentBalancer.AssemblyQualifiedName },
                    { PersistentStreamProviderConfig.STREAM_PUBSUB_TYPE, StreamPubSubType.ImplicitOnly.ToString() }
                };

                builder.ConfigureLegacyConfiguration(legacy =>
                {
                    legacy.ClusterConfiguration.Globals.RegisterStreamProvider <ControllableTestStreamProvider>(StreamProviderName, settings);
                });
            }
Esempio n. 16
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     ConsulTestUtils.EnsureConsul();
     builder.ConfigureLegacyConfiguration(legacy =>
     {
         legacy.ClusterConfiguration.Globals.DataConnectionString = ConsulTestUtils.CONSUL_ENDPOINT;
         legacy.ClusterConfiguration.Globals.ReminderServiceType  = GlobalConfiguration.ReminderServiceProviderType.Disabled;
         legacy.ClusterConfiguration.PrimaryNode = null;
         legacy.ClusterConfiguration.Globals.SeedNodes.Clear();
     });
     builder.AddSiloBuilderConfigurator <SiloBuilderConfigurator>();
     builder.AddClientBuilderConfigurator <ClientBuilderConfigurator>();
 }
Esempio n. 17
0
            protected override void ConfigureTestCluster(TestClusterBuilder builder)
            {
                builder.ConfigureLegacyConfiguration(legacy =>
                {
                    legacy.ClusterConfiguration.Globals.RegisterBootstrapProvider <MockBootstrapProvider>(MockBootstrapProviderName);
                    legacy.ClusterConfiguration.Globals.RegisterBootstrapProvider <GrainCallBootstrapper>(GrainCallBootstrapperName);
                    legacy.ClusterConfiguration.Globals.RegisterBootstrapProvider <LocalGrainInitBootstrapper>(LocalGrainInitBootstrapperName);
                    legacy.ClusterConfiguration.Globals.RegisterBootstrapProvider <ControllableBootstrapProvider>(ControllableBootstrapProviderName);

                    legacy.ClusterConfiguration.AddMemoryStorageProvider("MemoryStore", numStorageGrains: 1);
                    legacy.ClusterConfiguration.AddMemoryStorageProvider("Default", numStorageGrains: 1);
                });
            }
Esempio n. 18
0
            protected override void ConfigureTestCluster(TestClusterBuilder builder)
            {
                // poor fault injection requires grain instances stay on same host, so only single host for this test
                builder.Options.InitialSilosCount = 1;

                builder.ConfigureLegacyConfiguration(legacy =>
                {
                    // register stream provider
                    legacy.ClusterConfiguration.AddMemoryStorageProvider("Default");
                    legacy.ClusterConfiguration.Globals.RegisterStreamProvider <EventHubStreamProvider>(StreamProviderName, BuildProviderSettings());
                    legacy.ClientConfiguration.RegisterStreamProvider <EventHubStreamProvider>(StreamProviderName, BuildProviderSettings());
                });
            }
            protected override void ConfigureTestCluster(TestClusterBuilder builder)
            {
                // poor fault injection requires grain instances stay on same host, so only single host for this test
                builder.Options.InitialSilosCount = 1;

                builder.ConfigureLegacyConfiguration(legacy =>
                {
                    // register stream provider
                    legacy.ClusterConfiguration.AddMemoryStorageProvider("Default");
                });
                builder.AddSiloBuilderConfigurator <MySiloBuilderConfigurator>();
                builder.AddClientBuilderConfigurator <MyClientBuilderConfigurator>();
            }
Esempio n. 20
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.Options.InitialSilosCount = 1;
     builder.AddSiloBuilderConfigurator <GrainSiloBuilderConfigurator>();
     builder.ConfigureLegacyConfiguration(legacy =>
     {
         legacy.ClusterConfiguration.Globals.RegisterGrainService("CustomGrainService",
                                                                  "Tester.CustomGrainService, Tester",
                                                                  new Dictionary <string, string> {
             { "test-property", "xyz" }
         });
     });
 }
        protected override void ConfigureTestCluster(TestClusterBuilder builder)
        {
            builder.ConfigureLegacyConfiguration(legacy =>
            {
                legacy.ClusterConfiguration.Globals.Application.SetDefaultCollectionAgeLimit(TimeSpan.FromMinutes(1));
                legacy.ClusterConfiguration.Globals.Application.SetCollectionAgeLimit(typeof(MultipleSubscriptionConsumerGrain), TimeSpan.FromHours(2));
                legacy.ClusterConfiguration.Globals.ResponseTimeout = TimeSpan.FromMinutes(30);

                legacy.ClusterConfiguration.AddMemoryStorageProvider("PubSubStore");
            });
            builder.AddClientBuilderConfigurator <ClientConfiguretor>();
            builder.AddSiloBuilderConfigurator <SiloConfigurator>();
        }
Esempio n. 22
0
        protected override void ConfigureTestCluster(TestClusterBuilder builder)
        {
            ZookeeperTestUtils.EnsureZooKeeper();

            builder.AddSiloBuilderConfigurator <SiloBuilderConfigurator>();
            builder.ConfigureLegacyConfiguration(legacy =>
            {
                legacy.ClusterConfiguration.Globals.DataConnectionString = TestDefaultConfiguration.ZooKeeperConnectionString;
                legacy.ClusterConfiguration.PrimaryNode = null;
                legacy.ClusterConfiguration.Globals.SeedNodes.Clear();
                legacy.ClientConfiguration.GatewayProvider = ClientConfiguration.GatewayProviderType.ZooKeeper;
            });
        }
Esempio n. 23
0
        protected override void ConfigureTestCluster(TestClusterBuilder builder)
        {
            builder.ConfigureLegacyConfiguration(legacy =>
            {
                legacy.ClusterConfiguration.Globals.DefaultPlacementStrategy    = "ActivationCountBasedPlacement";
                legacy.ClusterConfiguration.Globals.NumMissedProbesLimit        = 1;
                legacy.ClusterConfiguration.Globals.NumVotesForDeathDeclaration = 1;
                legacy.ClusterConfiguration.Globals.TypeMapRefreshInterval      = TimeSpan.FromMilliseconds(100);

                // use only Primary as the gateway
                legacy.ClientConfiguration.Gateways = legacy.ClientConfiguration.Gateways.Take(1).ToList();
            });
        }
Esempio n. 24
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     this.ServiceId = builder.Options.ServiceId;
     builder.Options.InitialSilosCount = 4;
     builder.ConfigureLegacyConfiguration(legacy =>
     {
         legacy.ClusterConfiguration.Globals.RegisterStorageProvider <UnitTests.StorageTests.MockStorageProvider>("test1");
         legacy.ClusterConfiguration.Globals.RegisterStorageProvider <UnitTests.StorageTests.MockStorageProvider>("test2");
         legacy.ClusterConfiguration.Globals.RegisterStorageProvider <UnitTests.StorageTests.ErrorInjectionStorageProvider>("ErrorInjector");
         legacy.ClusterConfiguration.Globals.RegisterStorageProvider <UnitTests.StorageTests.MockStorageProvider>("lowercase");
     });
     builder.AddSiloBuilderConfigurator <SiloHostConfigurator>();
 }
        private async Task DeactivateOnIdle_NonExistentActivation_Runner(int forwardCount)
        {
            var builder = new TestClusterBuilder(2);

            builder.ConfigureLegacyConfiguration(legacy =>
            {
                legacy.ClusterConfiguration.Globals.MaxForwardCount = forwardCount;
                // For this test we only want to talk to the primary
                legacy.ClientConfiguration.Gateways.RemoveAt(1);
                if (forwardCount == 0)
                {
                    // Disable reminder service for this test: when the secondary silo starts it may
                    // not see right away the activation from the primary silo. This request should be forwarded
                    // to the correct activation, but since we deactivate forwarding, the secondary silo will
                    // fail to start...
                    legacy.ClusterConfiguration.Globals.ReminderServiceType = GlobalConfiguration.ReminderServiceProviderType.Disabled;
                }
            });
            Initialize(builder);

            ICollectionTestGrain grain = await PickGrainInNonPrimary();

            output.WriteLine("About to make a 1st GetAge() call.");
            TimeSpan age = await grain.GetAge();

            output.WriteLine(age.ToString());

            await grain.DeactivateSelf();

            await Task.Delay(3000);

            // ReSharper disable once PossibleNullReferenceException
            var thrownException = await Record.ExceptionAsync(() => grain.GetAge());

            if (forwardCount != 0)
            {
                Assert.Null(thrownException);
                output.WriteLine("\nThe 1st call after DeactivateSelf has NOT thrown any exception as expected, since forwardCount is {0}.\n", forwardCount);
            }
            else
            {
                Assert.NotNull(thrownException);
                Assert.IsType <OrleansMessageRejectionException>(thrownException);
                Assert.Contains("Non-existent activation", thrownException.Message);
                output.WriteLine("\nThe 1st call after DeactivateSelf has thrown Non-existent activation exception as expected, since forwardCount is {0}.\n", forwardCount);

                // Try sending agan now and see it was fixed.
                await grain.GetAge();
            }
        }
Esempio n. 26
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     if (!isDynamoDbAvailable.Value)
         throw new SkipException("Unable to connect to DynamoDB simulator");
     builder.AddSiloBuilderConfigurator<SiloBuilderConfigurator>();
     builder.AddClientBuilderConfigurator<ClientBuilderConfigurator>();
     builder.ConfigureLegacyConfiguration(legacy =>
     {
         legacy.ClusterConfiguration.Globals.DataConnectionString = $"Service={Service}";
         legacy.ClusterConfiguration.Globals.ReminderServiceType = GlobalConfiguration.ReminderServiceProviderType.Disabled;
         legacy.ClusterConfiguration.PrimaryNode = null;
         legacy.ClusterConfiguration.Globals.SeedNodes.Clear();
     });
 }
Esempio n. 27
0
            protected override void ConfigureTestCluster(TestClusterBuilder builder)
            {
                builder.Options.InitialSilosCount = 1;

                builder.ConfigureLegacyConfiguration(legacy =>
                {
                    legacy.ClusterConfiguration.AddStateStorageBasedLogConsistencyProvider();
                    legacy.ClusterConfiguration.AddLogStorageBasedLogConsistencyProvider();
                    legacy.ClusterConfiguration.AddCustomStorageInterfaceBasedLogConsistencyProvider("CustomStorage");

                    legacy.ClusterConfiguration.AddCustomStorageInterfaceBasedLogConsistencyProvider("CustomStoragePrimaryCluster", "A");
                });
                builder.AddSiloBuilderConfigurator <SiloBuilderConfigurator>();
            }
Esempio n. 28
0
        protected override void ConfigureTestCluster(TestClusterBuilder builder)
        {
            if (!GoogleTestUtils.IsPubSubSimulatorAvailable.Value)
            {
                throw new SkipException("Google PubSub Simulator not available");
            }

            builder.ConfigureLegacyConfiguration(legacy =>
            {
                legacy.ClusterConfiguration.Globals.ClientDropTimeout = TimeSpan.FromSeconds(5);
            });
            builder.AddSiloBuilderConfigurator <MySiloBuilderConfigurator>();
            builder.AddClientBuilderConfigurator <MyClientBuilderConfigurator>();
        }
Esempio n. 29
0
            protected override void ConfigureTestCluster(TestClusterBuilder builder)
            {
                builder.Options.InitialSilosCount = 1;

                builder.ConfigureLegacyConfiguration(legacy =>
                {
                    legacy.ClusterConfiguration.Globals.RegisterStatisticsProvider <UnitTests.Stats.MockStatsSiloCollector>("MockStats");
                    legacy.ClusterConfiguration.ApplyToAllNodes(nc => nc.StatisticsMetricsTableWriteInterval = TimeSpan.FromSeconds(1));
                    legacy.ClusterConfiguration.ApplyToAllNodes(nc => nc.StatisticsLogWriteInterval          = TimeSpan.FromSeconds(1));

                    legacy.ClientConfiguration.RegisterStatisticsProvider <UnitTests.Stats.MockStatsClientCollector>("MockStats");
                    legacy.ClientConfiguration.StatisticsMetricsTableWriteInterval = TimeSpan.FromSeconds(1);
                    legacy.ClientConfiguration.StatisticsLogWriteInterval          = TimeSpan.FromSeconds(1);
                });
            }
Esempio n. 30
0
        protected override void ConfigureTestCluster(TestClusterBuilder builder)
        {
            if (!GoogleTestUtils.IsPubSubSimulatorAvailable.Value)
            {
                throw new SkipException("Google PubSub Simulator not available");
            }

            builder.ConfigureLegacyConfiguration(legacy =>
            {
                legacy.ClusterConfiguration.Globals.ClusterId = GoogleTestUtils.ProjectId;
                legacy.ClientConfiguration.ClusterId          = GoogleTestUtils.ProjectId;
            });
            builder.AddSiloBuilderConfigurator <MySiloBuilderConfigurator>();
            builder.AddClientBuilderConfigurator <MyClientBuilderConfigurator>();
        }