예제 #1
0
 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();
 }
예제 #2
0
 internal static void LogStartTest(string testName, Guid streamId, string streamProviderName, Logger logger, TestCluster siloHost)
 {
     SiloAddress primSilo = siloHost.Primary.SiloAddress;
     SiloAddress secSilo = siloHost.SecondarySilos.First()?.SiloAddress;
     logger.Info("\n\n**START********************** {0} ********************************* \n\n"
                 + "Running with initial silos Primary={1} Secondary={2} StreamId={3} StreamType={4} \n\n",
         testName, primSilo, secSilo, streamId, streamProviderName);
 }
예제 #3
0
 private void Initialize(TestClusterOptions options = null)
 {
     if (options == null)
     {
         options = new TestClusterOptions(1);
     }
     testCluster = new TestCluster(options);
     testCluster.Deploy();
 }
 protected void Initialize()
 {
     GrainClient.Uninitialize();
     var testCluster = CreateTestCluster();
     if (testCluster.Primary == null)
     {
         testCluster.Deploy();
     }
     this.HostedCluster = testCluster;
 }
예제 #5
0
 public TestClusterPerTest()
 {
     GrainClient.Uninitialize();
     var testCluster = this.CreateTestCluster();
     if (testCluster.Primary == null)
     {
         testCluster.Deploy();
     }
     this.HostedCluster = testCluster;
 }
예제 #6
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();
 }
예제 #7
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();
 }
예제 #8
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;
        }
예제 #9
0
        public static SiloHandle StartOrleansSilo(TestCluster cluster, Silo.SiloType type, ClusterConfiguration clusterConfig, NodeConfiguration nodeConfig)
        {
            if (cluster == null) throw new ArgumentNullException(nameof(cluster));
            var siloName = nodeConfig.SiloName;

            cluster.WriteLog("Starting a new silo in app domain {0} with config {1}", siloName, clusterConfig.ToString(siloName));
            AppDomain appDomain;
            Silo silo = cluster.LoadSiloInNewAppDomain(siloName, type, clusterConfig, out appDomain);

            silo.Start();

            SiloHandle retValue = new SiloHandle
            {
                Name = siloName,
                Silo = silo,
                NodeConfiguration = nodeConfig,
                Endpoint = silo.SiloAddress.Endpoint,
                AppDomain = appDomain,
            };
            cluster.ImportGeneratedAssemblies(retValue);
            return retValue;
        }
예제 #10
0
 public void Dispose()
 {
     cluster?.StopAllSilos();
     cluster = null;
 }
예제 #11
0
 public void Dispose()
 {
     testCluster?.StopAllSilos();
     testCluster = null;
 }
예제 #12
0
 public HostedTestClusterEnsureDefaultStarted(DefaultClusterFixture fixture)
 {
     this.HostedCluster = fixture.HostedCluster;
 }
예제 #13
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="type">The type of the silo to deploy</param>
        /// <param name="clusterConfig">The cluster config to use</param>
        /// <param name="nodeConfig">The configuration for the silo to deploy</param>
        /// <returns>A handle to the silo deployed</returns>
        public static SiloHandle StartOrleansSilo(TestCluster cluster, Silo.SiloType type, ClusterConfiguration clusterConfig, NodeConfiguration nodeConfig)
        {
            if (cluster == null) throw new ArgumentNullException(nameof(cluster));
            var siloName = nodeConfig.SiloName;

            cluster.WriteLog("Starting a new silo in app domain {0} with config {1}", siloName, clusterConfig.ToString(siloName));
            var handle = cluster.LoadSiloInNewAppDomain(siloName, type, clusterConfig, nodeConfig);
            return handle;
        }
예제 #14
0
 public void Dispose()
 {
     GlobalConfiguration.ENFORCE_MINIMUM_REQUIREMENT_FOR_AGE_LIMIT = true;
     testCluster?.StopAllSilos();
     testCluster = null;
 }
예제 #15
0
 public ClientStreamTestRunner(TestCluster testHost)
 {
     this.testHost = testHost;
 }