Exemplo n.º 1
0
        private async Task <List <BuildFailureEntity> > GetUnitTestFailures(BuildInfo buildInfo, string jobKind, PullRequestInfo prInfo)
        {
            // TODO: Resolve this with CoreCLR.  They are producing way too many failures at the moment though
            // and we need to stop uploading 50,000 rows a day until we can resolve this.
            if (buildInfo.Id.JobName.Contains("dotnet_coreclr"))
            {
                return(new List <BuildFailureEntity>(capacity: 0));
            }

            var buildId       = buildInfo.Id;
            var testCaseNames = await _client.GetFailedTestCasesAsync(buildInfo.BuildId);

            // Ignore obnoxious long test names.  This is a temporary work around due to CoreFX generating giantic test
            // names and log files.
            // https://github.com/dotnet/corefx/pull/11905
            if (testCaseNames.Any(x => x.Length > 10000))
            {
                return(new List <BuildFailureEntity>(capacity: 0));
            }

            var entityList = testCaseNames
                             .Select(x => BuildFailureEntity.CreateTestCaseFailure(buildInfo.Date, buildId, x, jobKind: jobKind, machineName: buildInfo.MachineName, prInfo: prInfo))
                             .ToList();

            EnsureTestCaseNamesUnique(entityList);
            return(entityList);
        }