Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Darling/Darling.Tests/StoredServerClockRowTextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ public void AJobStepReadFromTheStoredWallClock_PrintsNoOffset_InBothPassesOfTheR

Assert.Equal("2026-11-01 01:30:00", firstPass.RunTimeLocal);
Assert.Equal("2026-11-01 01:30:00", secondPass.RunTimeLocal);
Assert.Equal("2026-11-01 01:45:00", firstPass.LastSuccessfulRunLocal);
Assert.Equal("2026-11-01 01:45:00", secondPass.LastSuccessfulRunLocal);

/* A real instant in the same test keeps the offset: the two passes of 01:30 are 05:30Z and 06:30Z. */
Assert.Equal("2026-11-01 01:30:00 -04:00", TrueUtcRowText(Naive(2026, 11, 1, 5, 30)));
Expand All @@ -138,8 +136,6 @@ public void AJobStepOutsideTheRepeatedHour_ReadsAsTheDisplayTextItAlwaysDid()
Assert.Equal("2026-11-01 00:59:00", beforeTheHour.RunTimeLocal);
Assert.Equal("2026-11-01 02:00:00", afterTheHour.RunTimeLocal);
Assert.Equal("2026-07-06 12:00:00", summer.RunTimeLocal);
Assert.Equal("2026-07-06 11:00:00", summer.LastSuccessfulRunLocal);
Assert.Equal("Never", beforeTheHour.LastSuccessfulRunLocal);
Assert.Equal("", new ViewerJobHistoryRow().RunTimeLocal);
}

Expand Down
10 changes: 7 additions & 3 deletions Darling/Darling.Tests/UncorroboratedRouteStoreKnobTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,13 @@ public void TheSettingsWindowCombo_PrefillsSavesAndRestores_ThroughTheThreeState
Assert.Contains("darling.json value (store column cleared)\" Tag=\"\"", xaml, StringComparison.Ordinal);
/* The prose: what a lone finding is, that the store wins and when, and how to hand it back. */
Assert.Contains("ONE fact in its chain and no matched co-fire check", xaml, StringComparison.Ordinal);
Assert.Contains("win over darling.json's analysis.uncorroboratedRoute", xaml, StringComparison.Ordinal);
Assert.Contains("within one collection sweep", xaml, StringComparison.Ordinal);
Assert.Contains("analysis.uncorroborated_route_source", xaml, StringComparison.Ordinal);
/* #6651 (W8): the note under the combo is ViewerLabels.UncorroboratedRouteNote, in words for a person: the page that shows which
value is in force, no MCP key name. */
Assert.Contains("{x:Static local:ViewerLabels.UncorroboratedRouteNote}", xaml, StringComparison.Ordinal);
Assert.Contains("win over darling.json's analysis.uncorroboratedRoute", ViewerLabels.UncorroboratedRouteNote, StringComparison.Ordinal);
Assert.Contains("within one collection sweep", ViewerLabels.UncorroboratedRouteNote, StringComparison.Ordinal);
Assert.Contains("The Alert Settings page shows which one is in force.", ViewerLabels.UncorroboratedRouteNote, StringComparison.Ordinal);
Assert.DoesNotContain("analysis.uncorroborated_route_source", ViewerLabels.UncorroboratedRouteNote, StringComparison.Ordinal);
Assert.Contains("Escalation is the corroboration event", xaml, StringComparison.Ordinal);

Assert.Contains("SelectAnalysisUncorroboratedRoute(r.AnalysisUncorroboratedRoute);", window, StringComparison.Ordinal);
Expand Down
7 changes: 4 additions & 3 deletions Darling/Darling.Tests/ViewerDataStartBannerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ public void CurrentWaits_AsksAboutTheToolbarWindow_AndComparesWithItsStart()
toolbar's range on a load (startUtc), the slicer's selection on a drag (e.StartUtc). Both await the probe through the
same catch as the two surfaces above, so a probe that throws costs the grid its banner and not the slicer and the
comparison loads that follow it. The tail is what the call passes after the start: the hourly-tier suffix on Top
Queries and Top Procedures, the interval-table plan on a Query Store load, nothing on a Query Store slicer drag. */
Queries and Top Procedures, the interval-table plan on a Query Store load, nothing on a Query Store slicer drag. Top Procedures names the databases its read left out (#6651) between the banner
and the next call. */
private const string HourlyTail = @",\s*HourlyBannerSuffix\(read\.Tier, read\.IoRoute, read\.HourlyEdgesNote\),\s*HourlyServedOf\(read\.Tier, read\.HourlyFirstBucket\)";
private const string WidePlanTail = @",\s*widePlan: widePlan";

Expand All @@ -195,7 +196,7 @@ public void QueriesTab_RangeLoad_AsksAboutTheToolbarWindow_AndComparesWithItsSta

Assert.Equal(1, Matches(tab, $@"var floorTask = Timed\(timer, ""data start"", _dataService\.{probe}\(_server\.ServerId,\s*startUtc,\s*endUtc\)\);"));
Assert.Equal(1, Matches(tab,
$@"UpdateTruncationBanner\({grid}TruncationBanner,\s*await DataStartOrNullAsync\(floorTask,\s*""{surface}""\),\s*startUtc{tail}\);\s*await Load{grid}SlicerAsync\(startUtc,\s*endUtc,\s*slicerTask\);\s*\}}\s*catch\s*\{{[^}}]*\}}\s*await Refresh{grid}ComparisonAsync\(startUtc,\s*endUtc,\s*timer\);"));
$@"UpdateTruncationBanner\({grid}TruncationBanner,\s*await DataStartOrNullAsync\(floorTask,\s*""{surface}""\),\s*startUtc{tail}\);(?:\s*await Update{grid}LeftOutBannerAsync\(read,\s*startUtc,\s*endUtc\);)?\s*await Load{grid}SlicerAsync\(startUtc,\s*endUtc,\s*slicerTask\);\s*\}}\s*catch\s*\{{[^}}]*\}}\s*await Refresh{grid}ComparisonAsync\(startUtc,\s*endUtc,\s*timer\);"));
}

[Theory]
Expand All @@ -208,7 +209,7 @@ public void QueriesTab_SlicerDrag_AsksAboutTheSelection_AndComparesWithItsStart(

Assert.Equal(1, Matches(tab, $@"var floorTask = _dataService\.{probe}\(_server\.ServerId,\s*e\.StartUtc,\s*e\.EndUtc\);"));
Assert.Equal(1, Matches(tab,
$@"UpdateTruncationBanner\({grid}TruncationBanner,\s*await DataStartOrNullAsync\(floorTask,\s*""{surface}""\),\s*e\.StartUtc{tail}\);\s*await Refresh{grid}ComparisonAsync\(e\.StartUtc,\s*e\.EndUtc\);"));
$@"UpdateTruncationBanner\({grid}TruncationBanner,\s*await DataStartOrNullAsync\(floorTask,\s*""{surface}""\),\s*e\.StartUtc{tail}\);(?:\s*await Update{grid}LeftOutBannerAsync\(read,\s*e\.StartUtc,\s*e\.EndUtc\);)?\s*await Refresh{grid}ComparisonAsync\(e\.StartUtc,\s*e\.EndUtc\);"));
}

/* No read awaits its probe bare (a probe that throws would unwind the load past the slicer, or the rest of the tab),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ public sealed class ViewerGridTimeColumnSortMemberTests
/* Columns whose row already had a UTC (or display-zone) DateTime and only lacked the SortMemberPath. */
{ "AlertsHistoryTab.xaml", "AlertsDataGrid", "TimeLocal", Name(typeof(ViewerAlertRow)), "AlertTime" },
{ "JobHistoryTab.xaml", "JobHistoryDataGrid", "RunTimeLocal", Name(typeof(ViewerJobHistoryRow)), "RunDateTimeUtc" },
{ "JobHistoryTab.xaml", "JobHistoryDataGrid", "LastSuccessfulRunLocal", Name(typeof(ViewerJobHistoryRow)), "LastSuccessfulRunUtc" },
{ "MuteRulesWindow.xaml", "RulesGrid", "ExpiresDisplay", Name(typeof(MuteRule)), "ExpiresAtUtc" },
{ "ProcedureHistoryWindow.xaml", "HistoryDataGrid", "CollectionTimeLocal", Name(typeof(ViewerProcedureStatsHistoryRow)), "CollectionTime" },
{ "QueryStatsHistoryWindow.xaml", "HistoryDataGrid", "CollectionTimeLocal", Name(typeof(ViewerQueryStatsHistoryRow)), "CollectionTime" },
Expand Down
22 changes: 12 additions & 10 deletions Darling/Darling.Tests/ViewerHourlyWindowEdgesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,26 @@ public void HourlyCeilingSql_IsEmptyWithoutACeiling_AndBoundsTheBucketWithOne()
public void HourlySql_BindsTheCeilingOnlyWhenOneIsKnown_OnBothGrids()
{
const string From = "collect.query_stats_io_hourly AS f";
foreach (var build in new Func<DateTime?, string>[]
/* The procedures grid binds the dropped-database exclusion at $6 (#6651), so its ceiling is the seventh parameter. */
foreach (var (build, slot) in new (Func<DateTime?, string>, int)[]
{
ceiling => ViewerDataService.BuildTopQueriesHourlySql(From, withIo: true, ceiling: ceiling),
ceiling => ViewerDataService.BuildTopQueriesHourlySql(From, withIo: false, ceiling: ceiling),
ceiling => ViewerDataService.BuildTopProceduresHourlySql(From, withIo: true, ceiling: ceiling),
ceiling => ViewerDataService.BuildTopProceduresHourlySql(From, withIo: false, ceiling: ceiling),
(ceiling => ViewerDataService.BuildTopQueriesHourlySql(From, withIo: true, ceiling: ceiling), 6),
(ceiling => ViewerDataService.BuildTopQueriesHourlySql(From, withIo: false, ceiling: ceiling), 6),
(ceiling => ViewerDataService.BuildTopProceduresHourlySql(From, withIo: true, ceiling: ceiling), 7),
(ceiling => ViewerDataService.BuildTopProceduresHourlySql(From, withIo: false, ceiling: ceiling), 7),
})
{
var ceilingSlot = "bucket < $" + slot;
var bounded = build(Aligned);
Assert.Contains("bucket < $6", bounded, StringComparison.Ordinal);
Assert.Contains(ceilingSlot, bounded, StringComparison.Ordinal);
/* The ceiling rides beside the window end, ahead of the grouping. */
Assert.True(
bounded.IndexOf("bucket < $3", StringComparison.Ordinal) < bounded.IndexOf("bucket < $6", StringComparison.Ordinal)
&& bounded.IndexOf("bucket < $6", StringComparison.Ordinal) < bounded.IndexOf("GROUP BY", StringComparison.Ordinal));
bounded.IndexOf("bucket < $3", StringComparison.Ordinal) < bounded.IndexOf(ceilingSlot, StringComparison.Ordinal)
&& bounded.IndexOf(ceilingSlot, StringComparison.Ordinal) < bounded.IndexOf("GROUP BY", StringComparison.Ordinal));

/* A null ceiling means no bound: today's text, with no sixth parameter. */
/* A null ceiling means no bound: today's text, with no ceiling parameter. */
var open = build(null);
Assert.DoesNotContain("$6", open, StringComparison.Ordinal);
Assert.DoesNotContain(ceilingSlot, open, StringComparison.Ordinal);
Assert.Contains("bucket < $3", open, StringComparison.Ordinal);
}
}
Expand Down
Loading
Loading