Exemple #1
0
        public TestConfig RegisterTest(string testName, string testClassName, string author)
        {
            //decide which servers/database the test will get
            if (_currentConfigSelectorStrategy == null)
            {
                throw new InvalidOperationException("Something really bad happened... the config selector strategy appears to be null!");
            }

            var testConfig = _currentConfigSelectorStrategy.GetNextTestConfig();

            using (var session = _reportingDocumentStore.OpenSession(OrchestratorDatabaseName))
            {
                var now = DateTime.UtcNow;
                session.Store(new TestInfo
                {
                    Name          = testName,
                    ExtendedName  = $"{testName} ({now})",
                    TestClassName = testClassName,
                    Author        = author,
                    Start         = now,
                    Events        = new List <EventInfo>(),
                    Config        = testConfig //record what servers we are working with in this particular test
                });
                session.SaveChanges();
            }

            return(testConfig);
        }
        public TestConfig RegisterTest(string testName, string testClassName, string author, string round)
        {
            if (int.TryParse(round, out var roundInt) == false)
            {
                roundInt = -1;
            }
            //decide which servers/database the test will get
            if (_currentConfigSelectorStrategy == null)
            {
                throw new InvalidOperationException("Something really bad happened... the config selector strategy appears to be null!");
            }

            var testConfig = _currentConfigSelectorStrategy.GetNextTestConfig();

            using (var session = _reportingDocumentStore.OpenSession(OrchestratorDatabaseName))
            {
                session.Advanced.UseOptimisticConcurrency = true;
                var now      = DateTime.UtcNow;
                var testInfo = new TestInfo
                {
                    Name          = testName,
                    ExtendedName  = $"{testName} ({now})",
                    TestClassName = testClassName,
                    Finished      = false,
                    Round         = roundInt,
                    Author        = author,
                    Start         = now,
                    Events        = new List <EventInfoWithExceptionAsString>(),
                    Config        = testConfig //record what servers we are working with in this particular test
                };

                session.Store(testInfo);
                session.SaveChanges();
            }

            return(testConfig);
        }