コード例 #1
0
 protected override TestCluster CreateTestCluster()
 {
     var options = new TestClusterOptions();
     options.ClusterConfiguration.AddMemoryStorageProvider("Default");
     options.ClusterConfiguration.AddMemoryStorageProvider("MemoryStore");
     return new TestCluster(options);
 }
コード例 #2
0
 public override TestCluster CreateTestCluster()
 {
     var options = new TestClusterOptions(2);
     AdjustConfig(options.ClusterConfiguration);
     AdjustConfig(options.ClientConfiguration);
     return new TestCluster(options);
 }
コード例 #3
0
 public override TestCluster CreateTestCluster()
 {
     var options = new TestClusterOptions(2);
     options.ClusterConfiguration.AddMemoryStorageProvider("Default");
     options.ClusterConfiguration.Globals.RegisterBootstrapProvider<PreInvokeCallbackBootrstrapProvider>(
         "PreInvokeCallbackBootrstrapProvider");
     return new TestCluster(options);
 }
コード例 #4
0
 public override TestCluster CreateTestCluster()
 {
     var options = new TestClusterOptions(2);
     options.ClusterConfiguration.AddMemoryStorageProvider("PubSubStore");
     options.ClusterConfiguration.AddAzureQueueStreamProvider(AQStreamProviderName);
     options.ClientConfiguration.AddAzureQueueStreamProvider(AQStreamProviderName);
     return new TestCluster(options);
 }
コード例 #5
0
ファイル: MapReduceBenchmark.cs プロジェクト: ticup/orleans
 public void BenchmarkSetup()
 {
     TestClusterOptions.DefaultTraceToConsole = false;
     var options = new TestClusterOptions(1);
     options.ClusterConfiguration.ApplyToAllNodes(c => c.DefaultTraceLevel = Severity.Warning);
     _host = new TestCluster(options);
     _host.Deploy();
 }
コード例 #6
0
 public override TestCluster CreateTestCluster()
 {
     var options = new TestClusterOptions(2);
     options.ClusterConfiguration.AddMemoryStorageProvider("PubSubStore");
     options.ClusterConfiguration.AddAzureQueueStreamProvider(AQStreamProviderName);
     options.ClusterConfiguration.Globals.ClientDropTimeout = TimeSpan.FromSeconds(5);
     options.ClientConfiguration.AddAzureQueueStreamProvider(AQStreamProviderName);
     return new TestCluster(options);
 }
コード例 #7
0
 private void Initialize(TestClusterOptions options = null)
 {
     if (options == null)
     {
         options = new TestClusterOptions(1);
     }
     testCluster = new TestCluster(options);
     testCluster.Deploy();
 }
コード例 #8
0
        public override TestCluster CreateTestCluster()
        {
            TestUtils.CheckForAzureStorage();
            var options = new TestClusterOptions(2);

            options.ClusterConfiguration.AddMemoryStorageProvider("PubSubStore");
            options.ClusterConfiguration.AddAzureQueueStreamProvider(StreamProvider);
            return new TestCluster(options);
        }
コード例 #9
0
 private void SetupAndDeployCluster(string defaultPlacementStrategy, params Type[] blackListedTypes)
 {
     cluster?.StopAllSilos();
     var typesName = blackListedTypes.Select(t => t.FullName).ToList();
     var options = new TestClusterOptions(1);
     options.ClusterConfiguration.Globals.TypeMapRefreshInterval = refreshInterval;
     options.ClusterConfiguration.Globals.DefaultPlacementStrategy = defaultPlacementStrategy;
     options.ClusterConfiguration.Overrides[Silo.PrimarySiloName].ExcludedGrainTypes = typesName;
     cluster = new TestCluster(options);
     cluster.Deploy();
 }
コード例 #10
0
ファイル: SilosStopTests.cs プロジェクト: jdom/orleans
        public override TestCluster CreateTestCluster()
        {
            var options = new TestClusterOptions(2);
            options.ClusterConfiguration.Globals.DefaultPlacementStrategy = "ActivationCountBasedPlacement";
            options.ClusterConfiguration.Globals.NumMissedProbesLimit = 1;
            options.ClusterConfiguration.Globals.NumVotesForDeathDeclaration = 1;

            // use only Primary as the gateway
            options.ClientConfiguration.Gateways = options.ClientConfiguration.Gateways.Take(1).ToList();
            return new TestCluster(options);
        }
コード例 #11
0
 private void Initialize(TimeSpan collectionAgeLimit, TimeSpan quantum)
 {
     GlobalConfiguration.ENFORCE_MINIMUM_REQUIREMENT_FOR_AGE_LIMIT = false;
     var options = new TestClusterOptions(1);
     var config = options.ClusterConfiguration;
     config.Globals.CollectionQuantum = quantum;
     config.Globals.Application.SetDefaultCollectionAgeLimit(collectionAgeLimit);
     config.Globals.Application.SetCollectionAgeLimit(typeof(IdleActivationGcTestGrain2), TimeSpan.FromSeconds(10));
     config.Globals.Application.SetCollectionAgeLimit(typeof(BusyActivationGcTestGrain2), TimeSpan.FromSeconds(10));
     testCluster = new TestCluster(config);
     testCluster.Deploy();
 }
コード例 #12
0
ファイル: ElasticPlacementTest.cs プロジェクト: jdom/orleans
        public override TestCluster CreateTestCluster()
        {
            TestUtils.CheckForAzureStorage();
            var options = new TestClusterOptions();

            options.ClusterConfiguration.AddMemoryStorageProvider("MemoryStore");
            options.ClusterConfiguration.AddMemoryStorageProvider("Default");

            options.ClusterConfiguration.Globals.LivenessType = GlobalConfiguration.LivenessProviderType.AzureTable;
            options.ClientConfiguration.GatewayProvider = ClientConfiguration.GatewayProviderType.AzureTable;

            return new TestCluster(options);
        }
コード例 #13
0
        public override TestCluster CreateTestCluster()
        {
            var options = new TestClusterOptions();
            options.ClusterConfiguration.Globals.Application.SetDefaultCollectionAgeLimit(TimeSpan.FromMinutes(1));
            options.ClusterConfiguration.Globals.Application.SetCollectionAgeLimit(typeof(MultipleSubscriptionConsumerGrain), TimeSpan.FromHours(2));
            options.ClusterConfiguration.Globals.ResponseTimeout = TimeSpan.FromMinutes(30);

            options.ClusterConfiguration.AddMemoryStorageProvider("PubSubStore");
            options.ClusterConfiguration.AddSimpleMessageStreamProvider(StreamTestsConstants.SMS_STREAM_PROVIDER_NAME);
            options.ClientConfiguration.AddSimpleMessageStreamProvider(StreamTestsConstants.SMS_STREAM_PROVIDER_NAME);

            return new TestCluster(options);
        }
コード例 #14
0
        public override TestCluster CreateTestCluster()
        {
            TestUtils.CheckForAzureStorage();
            var options = new TestClusterOptions();

            options.ClusterConfiguration.AddMemoryStorageProvider("MemoryStore");
            options.ClusterConfiguration.AddMemoryStorageProvider("Default");

            options.ClusterConfiguration.Globals.LivenessType = GlobalConfiguration.LivenessProviderType.AzureTable;
            options.ClientConfiguration.GatewayProvider = ClientConfiguration.GatewayProviderType.AzureTable;
            options.ClusterConfiguration.Globals.TypeMapRefreshInterval = TimeSpan.FromMilliseconds(100);

            return new TestCluster(options);
        }
コード例 #15
0
        public override TestCluster CreateTestCluster()
        {
            // Define a cluster of 4, but deploy ony 2 to start.
            var options = new TestClusterOptions(4);

            options.ClusterConfiguration.AddMemoryStorageProvider("PubSubStore");
            var persistentStreamProviderConfig = new PersistentStreamProviderConfig
            {
                SiloMaturityPeriod = SILO_IMMATURE_PERIOD,
                BalancerType = StreamQueueBalancerType.DynamicClusterConfigDeploymentBalancer,
            };

            options.ClusterConfiguration.AddAzureQueueStreamProvider(adapterName, persistentStreamProviderConfig: persistentStreamProviderConfig);
            options.ClientConfiguration.Gateways = options.ClientConfiguration.Gateways.Take(1).ToList();
            var host = new TestCluster(options);
            host.Deploy(new[] { Silo.PrimarySiloName, "Secondary_1" });
            return host;
        }
コード例 #16
0
 public override TestCluster CreateTestCluster()
 {
     var deploymentId = Guid.NewGuid().ToString();
     var streamConnectionString = new Dictionary<string, string>
         {
             { "DataConnectionString",  StreamConnectionString},
             { "DeploymentId",  deploymentId}
         };
     var options = new TestClusterOptions(2);
     options.ClusterConfiguration.AddMemoryStorageProvider("PubSubStore");
     
     options.ClusterConfiguration.Globals.DeploymentId = deploymentId;
     options.ClientConfiguration.DeploymentId = deploymentId;
     options.ClientConfiguration.DataConnectionString = StreamConnectionString;
     options.ClusterConfiguration.Globals.DataConnectionString = StreamConnectionString;
     options.ClusterConfiguration.Globals.RegisterStreamProvider<SQSStreamProvider>(SQSStreamProviderName, streamConnectionString);
     options.ClientConfiguration.RegisterStreamProvider<SQSStreamProvider>(SQSStreamProviderName, streamConnectionString);
     return new TestCluster(options);
 }
コード例 #17
0
ファイル: StreamLimitTests.cs プロジェクト: jdom/orleans
        public override TestCluster CreateTestCluster()
        {
            var options = new TestClusterOptions();

            options.ClusterConfiguration.AddMemoryStorageProvider("MemoryStore", numStorageGrains: 1);

            options.ClusterConfiguration.AddAzureTableStorageProvider("AzureStore", deleteOnClear: true);
            options.ClusterConfiguration.AddAzureTableStorageProvider("PubSubStore", deleteOnClear: true, useJsonFormat: false);

            options.ClusterConfiguration.AddSimpleMessageStreamProvider(SmsStreamProviderName, fireAndForgetDelivery: false);
            options.ClusterConfiguration.AddSimpleMessageStreamProvider("SMSProviderDoNotOptimizeForImmutableData", fireAndForgetDelivery: false, optimizeForImmutableData: false);

            options.ClusterConfiguration.AddAzureQueueStreamProvider(AzureQueueStreamProviderName);
            options.ClusterConfiguration.AddAzureQueueStreamProvider("AzureQueueProvider2");

            options.ClusterConfiguration.Globals.MaxMessageBatchingSize = 100;

            return new TestCluster(options);
        }
コード例 #18
0
ファイル: AQStreamingTests.cs プロジェクト: jdom/orleans
        public override TestCluster CreateTestCluster()
        {
            var options = new TestClusterOptions(initialSilosCount: 2);

            options.ClusterConfiguration.AddMemoryStorageProvider("MemoryStore");

            options.ClusterConfiguration.AddAzureTableStorageProvider("AzureStore", deleteOnClear : true);
            options.ClusterConfiguration.AddAzureTableStorageProvider("PubSubStore", deleteOnClear: true, useJsonFormat: false);

            options.ClusterConfiguration.AddSimpleMessageStreamProvider(SmsStreamProviderName, fireAndForgetDelivery: false);

            options.ClusterConfiguration.AddAzureQueueStreamProvider(AzureQueueStreamProviderName);
            options.ClusterConfiguration.AddAzureQueueStreamProvider("AzureQueueProvider2");

            options.ClusterConfiguration.Globals.MaxMessageBatchingSize = 100;

            options.ClientConfiguration.AddSimpleMessageStreamProvider(SmsStreamProviderName, fireAndForgetDelivery: false);
            options.ClientConfiguration.AddAzureQueueStreamProvider(AzureQueueStreamProviderName);

            return new TestCluster(options);
        }
コード例 #19
0
        public void SiloInitializationIsRetryableTest()
        {
            var appDomain = CreateAppDomain();
            appDomain.UnhandledException += (sender, args) =>
            {
                throw new AggregateException("Exception from AppDomain", (Exception) args.ExceptionObject);
            };

            try
            {
                var config = new TestClusterOptions(1).ClusterConfiguration;
                var originalLivenessType = config.Globals.LivenessType;
                var originalMembershipAssembly = config.Globals.MembershipTableAssembly;

                // Set a configuration which will cause an early initialization error.
                // Try initializing the cluster, verify that it fails.
                config.Globals.LivenessType = GlobalConfiguration.LivenessProviderType.Custom;
                config.Globals.MembershipTableAssembly = "NonExistentAssembly.jpg";

                var siloHost = CreateSiloHost(appDomain, config);
                siloHost.InitializeOrleansSilo();

                // Attempt to start the silo.
                Assert.ThrowsAny<Exception>(() => siloHost.StartOrleansSilo(catchExceptions: false));
                siloHost.UnInitializeOrleansSilo();

                // Reset the configuration to a valid configuration.
                config.Globals.LivenessType = originalLivenessType;
                config.Globals.MembershipTableAssembly = originalMembershipAssembly;

                // Starting a new cluster should succeed.
                siloHost = CreateSiloHost(appDomain, config);
                siloHost.InitializeOrleansSilo();
                siloHost.StartOrleansSilo(catchExceptions: false);
            }
            finally
            {
                AppDomain.Unload(appDomain);
            }
        }
コード例 #20
0
ファイル: SQSStreamTests.cs プロジェクト: jdom/orleans
        public override TestCluster CreateTestCluster()
        {
            var options = new TestClusterOptions();
            //from the config files
            options.ClusterConfiguration.AddMemoryStorageProvider("MemoryStore", numStorageGrains: 1);

            options.ClusterConfiguration.AddSimpleMessageStreamProvider("SMSProvider", fireAndForgetDelivery: false);
            options.ClusterConfiguration.Globals.MaxMessageBatchingSize = 100;

            options.ClientConfiguration.AddSimpleMessageStreamProvider("SMSProvider", fireAndForgetDelivery: false);

            //previous silo creation
            options.ClusterConfiguration.Globals.DataConnectionString = AWSTestConstants.DefaultSQSConnectionString;
            options.ClientConfiguration.DataConnectionString = AWSTestConstants.DefaultSQSConnectionString;
            var streamConnectionString = new Dictionary<string, string>
                {
                    { "DataConnectionString",  AWSTestConstants.DefaultSQSConnectionString}
                };

            options.ClientConfiguration.RegisterStreamProvider<SQSStreamProvider>("SQSProvider", streamConnectionString);

            options.ClusterConfiguration.Globals.RegisterStreamProvider<SQSStreamProvider>("SQSProvider", streamConnectionString);
            options.ClusterConfiguration.Globals.RegisterStreamProvider<SQSStreamProvider>("SQSProvider2", streamConnectionString);

            var storageConnectionString = new Dictionary<string, string>
                {
                    { "DataConnectionString",  $"Service={AWSTestConstants.Service}"},
                    { "DeleteStateOnClear",  "true"}
                };
            options.ClusterConfiguration.Globals.RegisterStorageProvider<DynamoDBStorageProvider>("DynamoDBStore", storageConnectionString);
            var storageConnectionString2 = new Dictionary<string, string>
                {
                    { "DataConnectionString",  $"Service={AWSTestConstants.Service}"},
                    { "DeleteStateOnClear",  "true"},
                    { "UseJsonFormat",  "true"}
                };
            options.ClusterConfiguration.Globals.RegisterStorageProvider<DynamoDBStorageProvider>("PubSubStore", storageConnectionString2);

            return new TestCluster(options);
        }
コード例 #21
0
ファイル: TestCluster.cs プロジェクト: zmyer/orleans
        /// <summary>
        /// Starts a new silo.
        /// </summary>
        /// <param name="instanceNumber">The instance number to deploy</param>
        /// <param name="clusterOptions">The options to use.</param>
        /// <param name="configurationOverrides">Configuration overrides.</param>
        /// <param name="startSiloOnNewPort">Whether we start this silo on a new port, instead of the default one</param>
        /// <returns>A handle to the deployed silo.</returns>
        public SiloHandle StartOrleansSilo(int instanceNumber, TestClusterOptions clusterOptions, IReadOnlyList <IConfigurationSource> configurationOverrides = null, bool startSiloOnNewPort = false)
        {
            var configurationSources = this.ConfigurationSources.ToList();

            // Add overrides.
            if (configurationOverrides != null)
            {
                configurationSources.AddRange(configurationOverrides);
            }
            var siloSpecificOptions = TestSiloSpecificOptions.Create(clusterOptions, instanceNumber, startSiloOnNewPort);

            configurationSources.Add(new MemoryConfigurationSource
            {
                InitialData = siloSpecificOptions.ToDictionary()
            });

            var handle = this.CreateSilo(siloSpecificOptions.SiloName, configurationSources);

            handle.InstanceNumber = (short)instanceNumber;
            Interlocked.Increment(ref this.startedInstances);
            return(handle);
        }
コード例 #22
0
        /// <summary>
        /// Start an additional silo, so that it joins the existing cluster.
        /// </summary>
        /// <returns>SiloHandle for the newly started silo.</returns>
        public SiloHandle StartAdditionalSilo()
        {
            var   clusterConfig   = this.ClusterConfiguration;
            short instanceNumber  = (short)clusterConfig.Overrides.Count;
            var   defaultNode     = clusterConfig.Defaults;
            int   baseSiloPort    = defaultNode.Port;
            int   baseGatewayPort = defaultNode.ProxyGatewayEndpoint.Port;
            var   nodeConfig      = TestClusterOptions.AddNodeConfiguration(
                this.ClusterConfiguration,
                Silo.SiloType.Secondary,
                instanceNumber,
                baseSiloPort,
                baseGatewayPort);

            SiloHandle instance = StartOrleansSilo(
                Silo.SiloType.Secondary,
                this.ClusterConfiguration,
                nodeConfig);

            additionalSilos.Add(instance);
            return(instance);
        }
コード例 #23
0
ファイル: LivenessTests.cs プロジェクト: jdom/orleans
 public override TestCluster CreateTestCluster()
 {
     var options = new TestClusterOptions(2);
     options.ClusterConfiguration.Globals.DataConnectionString = TestDefaultConfiguration.ZooKeeperConnectionString;
     options.ClusterConfiguration.Globals.LivenessType = GlobalConfiguration.LivenessProviderType.ZooKeeper;
     options.ClusterConfiguration.PrimaryNode = null;
     options.ClusterConfiguration.Globals.SeedNodes.Clear();
     return new TestCluster(options);
 }
コード例 #24
0
ファイル: LivenessTests.cs プロジェクト: jdom/orleans
        public override TestCluster CreateTestCluster()
        {
            if (!isDynamoDbAvailable.Value)
                throw new SkipException("Unable to connect to DynamoDB simulator");

            var options = new TestClusterOptions(2);
            options.ClusterConfiguration.Globals.DataConnectionString = "Service=http://localhost:8000;"; ;
            options.ClusterConfiguration.Globals.LivenessType = GlobalConfiguration.LivenessProviderType.Custom;
            options.ClusterConfiguration.Globals.MembershipTableAssembly = "OrleansAWSUtils";
            options.ClusterConfiguration.Globals.ReminderServiceType = GlobalConfiguration.ReminderServiceProviderType.Disabled;
            options.ClusterConfiguration.PrimaryNode = null;
            options.ClusterConfiguration.Globals.SeedNodes.Clear();
            return new TestCluster(options);
        }
コード例 #25
0
ファイル: LivenessTests.cs プロジェクト: jdom/orleans
 public override TestCluster CreateTestCluster()
 {
     var options = new TestClusterOptions(2);
     options.ClientConfiguration.PreferedGatewayIndex = 1;
     return new TestCluster(options);
 }
コード例 #26
0
 /// <summary>
 /// Configures the test cluster plus default client in-process.
 /// </summary>
 public TestCluster(ClusterConfiguration clusterConfiguration)
     : this(clusterConfiguration, TestClusterOptions.BuildClientConfiguration(clusterConfiguration))
 {
 }
コード例 #27
0
 /// <summary>
 /// Configures the test cluster plus client in-process.
 /// </summary>
 public TestCluster(TestClusterOptions options)
     : this(options.ClusterConfiguration, options.ClientConfiguration)
 {
 }
コード例 #28
0
ファイル: TestCluster.cs プロジェクト: zhust2003/orleans
 /// <summary>
 /// Configures the test cluster plus client in-process.
 /// </summary>
 public TestCluster(TestClusterOptions options)
     : this(options.ClusterConfiguration, options.ClientConfiguration)
 {
     this.siloBuilderFactoryType = options.SiloBuilderFactoryType;
     this.clientBuilderFactory   = options.ClientBuilderFactory;
 }
コード例 #29
0
 private SiloHandle StartOrleansSilo(int instanceNumber, TestClusterOptions clusterOptions, bool startSiloOnNewPort = false)
 {
     return(StartOrleansSilo(this, instanceNumber, clusterOptions, null, startSiloOnNewPort));
 }
        public override TestCluster CreateTestCluster()
        {
            var options = new TestClusterOptions();

            foreach (var item in dbNames)
            {
                string actualDBName = item.Value.ConnectionString;
                string dbName = item.Key;
                options.ClusterConfiguration.AddSimpleSQLStorageProvider(dbName, actualDBName, "true");
            }




            //options.ClusterConfiguration.Globals.ClientDropTimeout = TimeSpan.FromSeconds(5);
            //options.ClusterConfiguration.Defaults.DefaultTraceLevel = Orleans.Runtime.Severity.Warning;
            //options.ClientConfiguration.DefaultTraceLevel = Orleans.Runtime.Severity.Warning;

            return new TestCluster(options);
        }
コード例 #31
0
ファイル: LivenessTests.cs プロジェクト: Rejendo/orleans
 public override TestCluster CreateTestCluster()
 {
     var options = new TestClusterOptions(2);
     options.ClusterConfiguration.Globals.DataConnectionString = StorageTestConstants.DataConnectionString;
     options.ClusterConfiguration.Globals.LivenessType = GlobalConfiguration.LivenessProviderType.AzureTable;
     options.ClusterConfiguration.PrimaryNode = null;
     options.ClusterConfiguration.Globals.SeedNodes.Clear();
     return new TestCluster(options);
 }
コード例 #32
0
ファイル: TestCluster.cs プロジェクト: MikeHardman/orleans
 /// <summary>
 /// Configures the test cluster plus client in-process.
 /// </summary>
 public TestCluster(TestClusterOptions options)
     : this(options.ClusterConfiguration, options.ClientConfiguration)
 {
 }
コード例 #33
0
        private async Task DeactivateOnIdle_NonExistentActivation_Runner(int forwardCount)
        {
            var options = new TestClusterOptions(2);
            options.ClusterConfiguration.Globals.MaxForwardCount = forwardCount;
            options.ClusterConfiguration.Defaults.Generation = 13;
            // For this test we only want to talk to the primary
            options.ClientConfiguration.Gateways.RemoveAt(1);
            Initialize(options);

            ICollectionTestGrain grain = await PickGrain();
            Assert.NotNull(grain);

            logger.Info("About to make a 1st GetAge() call.");
            TimeSpan age = await grain.GetAge();
            logger.Info(age.ToString());

            await grain.DeactivateSelf();
            Thread.Sleep(3000);

            // ReSharper disable once PossibleNullReferenceException
            var thrownException = await Record.ExceptionAsync(() => grain.GetAge());
            if (forwardCount != 0)
            {
                Assert.Null(thrownException);
                logger.Info("\nThe 1st call after DeactivateSelf has NOT thrown any exception as expected, since forwardCount is {0}.\n", forwardCount);
            }
            else
            {
                Assert.NotNull(thrownException);
                Assert.IsType<OrleansException>(thrownException);
                Assert.Contains("Non-existent activation", thrownException.Message);
                logger.Info("\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();
            }
        }
コード例 #34
0
ファイル: TestCluster.cs プロジェクト: zmyer/orleans
 /// <summary>
 /// Start a new silo in the target cluster
 /// </summary>
 /// <param name="cluster">The TestCluster in which the silo should be deployed</param>
 /// <param name="instanceNumber">The instance number to deploy</param>
 /// <param name="clusterOptions">The options to use.</param>
 /// <param name="configurationOverrides">Configuration overrides.</param>
 /// <param name="startSiloOnNewPort">Whether we start this silo on a new port, instead of the default one</param>
 /// <returns>A handle to the silo deployed</returns>
 public static SiloHandle StartOrleansSilo(TestCluster cluster, int instanceNumber, TestClusterOptions clusterOptions, IReadOnlyList <IConfigurationSource> configurationOverrides = null, bool startSiloOnNewPort = false)
 {
     if (cluster == null)
     {
         throw new ArgumentNullException(nameof(cluster));
     }
     return(cluster.StartOrleansSilo(instanceNumber, clusterOptions, configurationOverrides, startSiloOnNewPort));
 }
コード例 #35
0
        public async Task MissingActivation_WithDirectoryLazyDeregistration_SingleSilo()
        {
            var directoryLazyDeregistrationDelay = TimeSpan.FromMilliseconds(5000);
            var lazyDeregistrationDelay = TimeSpan.FromMilliseconds(5000);
            var options = new TestClusterOptions(1);
            options.ClusterConfiguration.Globals.DirectoryLazyDeregistrationDelay = directoryLazyDeregistrationDelay;
            // Disable retries in this case, to make test more predictable.
            options.ClusterConfiguration.Globals.MaxForwardCount = 0;
            Initialize(options);

            for (int i = 0; i < 10; i++)
            {
                await MissingActivation_Runner(i, lazyDeregistrationDelay);
            }
        }
コード例 #36
0
ファイル: LivenessTests.cs プロジェクト: jdom/orleans
 public override TestCluster CreateTestCluster()
 {
     var relationalStorage = RelationalStorageForTesting.SetupInstance(AdoNetInvariants.InvariantNameMySql, TestDatabaseName).Result;
     var options = new TestClusterOptions(2);
     options.ClusterConfiguration.Globals.DataConnectionString = relationalStorage.CurrentConnectionString;
     options.ClusterConfiguration.Globals.LivenessType = GlobalConfiguration.LivenessProviderType.SqlServer;
     options.ClusterConfiguration.Globals.AdoInvariant = AdoNetInvariants.InvariantNameMySql;
     options.ClusterConfiguration.PrimaryNode = null;
     options.ClusterConfiguration.Globals.SeedNodes.Clear();
     return new TestCluster(options);
 }
コード例 #37
0
 /// <summary>
 /// Configures the test cluster plus client in-process.
 /// </summary>
 public TestCluster(TestClusterOptions options, IReadOnlyList <IConfigurationSource> configurationSources)
 {
     this.options = options;
     this.ConfigurationSources = configurationSources.ToArray();
 }
コード例 #38
0
ファイル: TestCluster.cs プロジェクト: yartat/orleans
 private SiloHandle StartOrleansSilo(int instanceNumber, TestClusterOptions clusterOptions)
 {
     return(StartOrleansSilo(this, instanceNumber, clusterOptions));
 }
コード例 #39
0
        /// <summary>
        /// Start a new silo in the target cluster
        /// </summary>
        /// <param name="cluster">The TestCluster in which the silo should be deployed</param>
        /// <param name="instanceNumber">The instance number to deploy</param>
        /// <param name="clusterOptions">The options to use.</param>
        /// <param name="configurationOverrides">Configuration overrides.</param>
        /// <param name="startSiloOnNewPort">Whether we start this silo on a new port, instead of the default one</param>
        /// <returns>A handle to the silo deployed</returns>
        public static SiloHandle StartOrleansSilo(TestCluster cluster, int instanceNumber, TestClusterOptions clusterOptions, IReadOnlyList <IConfigurationSource> configurationOverrides = null, bool startSiloOnNewPort = false)
        {
            if (cluster == null)
            {
                throw new ArgumentNullException(nameof(cluster));
            }

            var configurationSources = cluster.ConfigurationSources.ToList();

            // Add overrides.
            if (configurationOverrides != null)
            {
                configurationSources.AddRange(configurationOverrides);
            }
            var siloSpecificOptions = TestSiloSpecificOptions.Create(clusterOptions, instanceNumber, startSiloOnNewPort);

            configurationSources.Add(new MemoryConfigurationSource
            {
                InitialData = siloSpecificOptions.ToDictionary()
            });

            var handle = cluster.LoadSiloInNewAppDomain(
                siloSpecificOptions.SiloName,
                configurationSources);

            handle.InstanceNumber = (short)instanceNumber;
            Interlocked.Increment(ref cluster.startedInstances);
            return(handle);
        }
コード例 #40
0
        public async Task MissingActivation_WithoutDirectoryLazyDeregistration_MultiSilo_SecondaryFirst()
        {
            var lazyDeregistrationDelay = TimeSpan.FromMilliseconds(-1);
            var options = new TestClusterOptions(2);
            // Disable retries in this case, to make test more predictable.
            options.ClusterConfiguration.Globals.MaxForwardCount = 0;
            options.ClientConfiguration.Gateways.RemoveAt(1);
            Initialize(options);

            await MissingActivation_Runner(1, lazyDeregistrationDelay, true);
        }