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);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Main entry point
        /// </summary>
        /// <param name="args">List of test methods to run</param>
        private static void Main(string[] args)
        {
            var testMethods = GetAllTestMethods();

            Console.WriteLine("List of test methods:");
            Console.WriteLine(string.Join(Environment.NewLine, testMethods.Select(m => m.Name)));

            var context = new DummyTestContext();

            VegaBulkWatcherPerf.Setup(context);
            VegaBulkWatcherPerf.TestClassInitialize(context);
            VegaServiceFabricPerf.TestClassInitialize(context);

            foreach (var methodName in args)
            {
                var method = testMethods.FirstOrDefault(m => string.Compare(m.Name, methodName, StringComparison.OrdinalIgnoreCase) == 0);
                if (method != null)
                {
                    var inst = Activator.CreateInstance(method.DeclaringType);
                    method.Invoke(inst, null);
                }
            }
        }