Example #1
0
        public TestResultData GetTestCache(string id, [FromUri] TestSourceData testSourceData)
        {
            TestResult testResult;

            var buildSource = new BuildSource(testSourceData.MachineName, testSourceData.EnlistmentRoot);
            var isJenkins = string.IsNullOrEmpty(testSourceData.Source)
                ? null
                : (bool?)(testSourceData.Source == "jenkins");

            if (_storage.TryGetValue(id, out testResult))
            {
                var isJenkinsValue = isJenkins ?? false;
                _statsUtil.AddHit(isJenkinsValue);
                _statsUtil.AddUnitTestQuery(testResult.UnitTestData, testResult.Elapsed, isJenkinsValue);

                var testResultData = new TestResultData()
                {
                    ExitCode = testResult.ExitCode,
                    OutputStandard = testResult.OutputStandard,
                    OutputError = testResult.OutputError,
                    ResultsFileName = testResult.ResultsFileName,
                    ResultsFileContent = testResult.ResultsFileContent,
                    ElapsedSeconds = (int)testResult.Elapsed.TotalSeconds
                };
                return testResultData;
            }

            _statsUtil.AddMiss(isJenkins ?? false);
            throw new HttpResponseException(HttpStatusCode.NotFound);
        }
Example #2
0
 public TestRunEntity(DateTime runDate, BuildSource buildSource)
 {
     PartitionKey = GetPartitionKey(runDate);
     RowKey = GetRowKey(RunDate, buildSource);
     MachineName = buildSource.MachineName;
     EnlistmentRoot = buildSource.EnlistmentRoot;
     RunDate = runDate;
 }
Example #3
0
 public EntityKey CreateEntityKey(DateTime runDate, BuildSource buildSource)
 {
     return new EntityKey(
         GetPartitionKey(runDate),
         GetRowKey(runDate, buildSource));
 }
Example #4
0
 public static string GetRowKey(DateTime runDate, BuildSource buildSource)
 {
     var machineName = AzureUtil.NormalizeKey(buildSource.MachineName, '-');
     return $"{machineName}-{(long)runDate.Ticks}";
 }
Example #5
0
 public EntityKey CreateEntityKey(DateTime runDate, BuildSource buildSource)
 {
     return(new EntityKey(
                GetPartitionKey(runDate),
                GetRowKey(runDate, buildSource)));
 }
Example #6
0
        public static string GetRowKey(DateTime runDate, BuildSource buildSource)
        {
            var machineName = AzureUtil.NormalizeKey(buildSource.MachineName, '-');

            return($"{machineName}-{(long)runDate.Ticks}");
        }