protected override TestCluster CreateTestCluster() { var options = new TestClusterOptions(); options.ClusterConfiguration.AddMemoryStorageProvider("Default"); options.ClusterConfiguration.AddMemoryStorageProvider("MemoryStore"); return new TestCluster(options); }
public override TestCluster CreateTestCluster() { var options = new TestClusterOptions(2); AdjustConfig(options.ClusterConfiguration); AdjustConfig(options.ClientConfiguration); return new TestCluster(options); }
public override TestCluster CreateTestCluster() { var options = new TestClusterOptions(2); options.ClusterConfiguration.AddMemoryStorageProvider("Default"); options.ClusterConfiguration.Globals.RegisterBootstrapProvider<PreInvokeCallbackBootrstrapProvider>( "PreInvokeCallbackBootrstrapProvider"); return new TestCluster(options); }
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); }
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(); }
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); }
private void Initialize(TestClusterOptions options = null) { if (options == null) { options = new TestClusterOptions(1); } testCluster = new TestCluster(options); testCluster.Deploy(); }
public override TestCluster CreateTestCluster() { TestUtils.CheckForAzureStorage(); var options = new TestClusterOptions(2); options.ClusterConfiguration.AddMemoryStorageProvider("PubSubStore"); options.ClusterConfiguration.AddAzureQueueStreamProvider(StreamProvider); return new TestCluster(options); }
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(); }
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); }
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(); }
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); }
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); }
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); }
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; }
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); }
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); }
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); }
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); } }
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); }
/// <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); }
/// <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); }
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); }
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); }
public override TestCluster CreateTestCluster() { var options = new TestClusterOptions(2); options.ClientConfiguration.PreferedGatewayIndex = 1; return new TestCluster(options); }
/// <summary> /// Configures the test cluster plus default client in-process. /// </summary> public TestCluster(ClusterConfiguration clusterConfiguration) : this(clusterConfiguration, TestClusterOptions.BuildClientConfiguration(clusterConfiguration)) { }
/// <summary> /// Configures the test cluster plus client in-process. /// </summary> public TestCluster(TestClusterOptions options) : this(options.ClusterConfiguration, options.ClientConfiguration) { }
/// <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; }
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); }
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); }
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(); } }
/// <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)); }
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); } }
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); }
/// <summary> /// Configures the test cluster plus client in-process. /// </summary> public TestCluster(TestClusterOptions options, IReadOnlyList <IConfigurationSource> configurationSources) { this.options = options; this.ConfigurationSources = configurationSources.ToArray(); }
private SiloHandle StartOrleansSilo(int instanceNumber, TestClusterOptions clusterOptions) { return(StartOrleansSilo(this, instanceNumber, clusterOptions)); }
/// <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); }
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); }