diff --git a/DevOps.Status/Pages/Status.cshtml.cs b/DevOps.Status/Pages/Status.cshtml.cs
index 0cb8917..1e86f8b 100644
--- a/DevOps.Status/Pages/Status.cshtml.cs
+++ b/DevOps.Status/Pages/Status.cshtml.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using DevOps.Util.DotNet;
using DevOps.Util.DotNet.Triage;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
@@ -32,7 +33,7 @@ public async Task OnGetAsync()
var todayLimit = DateTime.UtcNow - TimeSpan.FromDays(1);
TodayCount = await context.ModelBuilds.Where(x => x.StartTime > todayLimit).CountAsync();
- var expiredLimit = DateTime.UtcNow - TimeSpan.FromDays(30);
+ var expiredLimit = DateTime.UtcNow - TimeSpan.FromDays(DotNetConstants.MaxBuildDays);
ExpiredCount = await context.ModelBuilds.Where(x => x.StartTime < expiredLimit).CountAsync();
}
}
diff --git a/DevOps.Util.DotNet/DotNetConstants.cs b/DevOps.Util.DotNet/DotNetConstants.cs
index 5ded248..b3fdeea 100644
--- a/DevOps.Util.DotNet/DotNetConstants.cs
+++ b/DevOps.Util.DotNet/DotNetConstants.cs
@@ -27,5 +27,8 @@ public static class DotNetConstants
public static string AzureOrganization => "dnceng-public";
public static string DefaultAzureProject => "public";
+ public const int MaxBuildDays = 14;
+ public const int MaxTestCaseCount = 200;
+ public const int MaxStringLength = 4096;
}
}
diff --git a/DevOps.Util.DotNet/Triage/TriageContextUtil.cs b/DevOps.Util.DotNet/Triage/TriageContextUtil.cs
index b2f7fb6..e6c560b 100644
--- a/DevOps.Util.DotNet/Triage/TriageContextUtil.cs
+++ b/DevOps.Util.DotNet/Triage/TriageContextUtil.cs
@@ -14,6 +14,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.Extensions.Options;
+using Microsoft.VisualBasic;
namespace DevOps.Util.DotNet.Triage
{
@@ -400,8 +401,15 @@ public async Task EnsureTestRunAsync(ModelBuildAttempt modelBuildA
};
Context.ModelTestRuns.Add(modelTestRun);
+ int count = 0;
foreach (var dotnetTestCaseResult in testRun.TestCaseResults)
{
+ count++;
+ if (count >= DotNetConstants.MaxTestCaseCount)
+ {
+ break;
+ }
+
var testCaseResult = dotnetTestCaseResult.TestCaseResult;
var testResult = new ModelTestResult()
{
@@ -476,10 +484,9 @@ string NormalizeString(string? value)
return "";
}
- var maxLen = 4096;
- if (value.Length > maxLen)
+ if (value.Length > DotNetConstants.MaxStringLength)
{
- value = $"{value.AsSpan().Slice(0, maxLen)}...";
+ value = $"{value.AsSpan().Slice(0, DotNetConstants.MaxStringLength)}...";
}
return value;