示例#1
0
        private static (string EventsJson, string ResultsJson) ExecuteWorkload(string connectionString, BsonDocument driverWorkload, bool async, CancellationToken astrolabeCancellationToken)
        {
            Environment.SetEnvironmentVariable("MONGODB_URI", connectionString); // force using atlas connection string in our internal test connection strings

            var additionalArgs = new Dictionary <string, object>()
            {
                { "UnifiedLoopOperationCancellationToken", astrolabeCancellationToken }
            };
            var eventFormatters = new Dictionary <string, IEventFormatter>()
            {
                { "events", new AstrolabeEventFormatter() } // "events" matches to the "storeEventsAsEntities.id" in the driverWorkload document
            };

            using (var testRunner = new UnifiedTestFormatTestRunner(
                       allowKillSessions: false,
                       additionalArgs: additionalArgs,
                       eventFormatters: eventFormatters))
            {
                var factory  = new TestCaseFactory();
                var testCase = factory.CreateTestCase(driverWorkload, async);
                testRunner.Run(testCase);
                Console.WriteLine("dotnet ExecuteWorkload> Returning...");
                return(CreateWorkloadResult(entityMap: testRunner.EntityMap));
            }
        }
示例#2
0
 public void Run(JsonDrivenTestCase testCase)
 {
     using (var runner = new UnifiedTestFormatTestRunner())
     {
         runner.Run(testCase);
     }
 }