Exemplo n.º 1
0
        public static void TestClassInitialize(TestContext context)
        {
            threadCount           = int.Parse(appSettings["BulkWatcherThreadCount"]);
            testRepetitions       = int.Parse(appSettings["TestRepetitions"]);
            minDataSize           = int.Parse(appSettings["BulkWatcherMinDataSize"]);
            maxDataSize           = int.Parse(appSettings["BulkWatcherMaxDataSize"]);
            requestTimeout        = int.Parse(appSettings["BulkWatcherRequestTimeout"]);
            partitionCount        = int.Parse(appSettings["PartitionCount"]);
            nodeCountPerPartition = int.Parse(appSettings["NodeCountPerPartition"]);
            channelCount          = int.Parse(appSettings["ChannelCount"]);
            server = appSettings["ServerAddress"];

            if (context.GetType().Name.StartsWith("Dummy"))
            {
                log = s => context.WriteLine(s);
            }
            else
            {
                log = s => Trace.TraceInformation(s);
            }

            if (threadCount < 0)
            {
                threadCount = Environment.ProcessorCount;
            }

            var serviceInfo = default(Tuple <string, string>);

            if (string.IsNullOrEmpty(server))
            {
                // Only queries the service info if the service address is not specified, e.g. when running in CloudTest
                // on local machine.
                serviceInfo = Helpers.GetVegaServiceInfo().Result;
                server      = serviceInfo.Item1;
            }

            clients = Enumerable.Range(0, channelCount).Select(n => new RingMasterClient(
                                                                   connectionString: server,
                                                                   clientCerts: null,
                                                                   serverCerts: null,
                                                                   requestTimeout: requestTimeout,
                                                                   watcher: null))
                      .ToArray();

            VegaServiceFabricPerf.InitializeMdm(serviceInfo?.Item2, appSettings);
        }