8 instantiations of DashboardRunStore
Aspire.Dashboard.Tests (8)
Model\DashboardDataSourceTests.cs (8)
341
using var runStore = new
DashboardRunStore
(
575
using var runStore = new
DashboardRunStore
(
602
using var secondRunStore = new
DashboardRunStore
(options, logger, TimeProvider.System);
650
using var secondRunStore = new
DashboardRunStore
(options, logger, TimeProvider.System);
1164
using var pruningRunStore = new
DashboardRunStore
(
1175
using var nextPruningRunStore = new
DashboardRunStore
(
1284
using var currentRunStore = new
DashboardRunStore
(
1706
return new
DashboardRunStore
(options, NullLogger<DashboardRunStore>.Instance, timeProvider ?? TimeProvider.System);
195 references to DashboardRunStore
Aspire.Dashboard (11)
DashboardWebApplication.cs (2)
390
builder.Services.AddSingleton<
DashboardRunStore
>();
391
builder.Services.AddSingleton<IDashboardRunStore>(services => services.GetRequiredService<
DashboardRunStore
>());
Model\DashboardSqliteOutgoingPeerResolver.cs (3)
14
var isDashboardSqlite = string.Equals(attributes.GetValue(OtlpSpan.PeerServiceAttributeKey),
DashboardRunStore
.DatabaseFileName, StringComparison.Ordinal) &&
16
string.Equals(attributes.GetValue("db.namespace"),
DashboardRunStore
.DatabaseFileName, StringComparison.Ordinal);
18
name = isDashboardSqlite ?
DashboardRunStore
.DatabaseFileName : null;
Serialization\DashboardJsonSerializerContext.cs (1)
53
[JsonSerializable(typeof(
DashboardRunStore
.DashboardRunMetadata))]
ServiceClient\DashboardRunStore.cs (5)
95
private readonly ILogger<
DashboardRunStore
> _logger;
102
public DashboardRunStore(IOptions<DashboardOptions> options, ILogger<
DashboardRunStore
> logger, TimeProvider timeProvider)
109
ILogger<
DashboardRunStore
> logger,
726
private sealed class RunLease(
DashboardRunStore
owner, DashboardRunDescriptor run, FileLock runLock) : IDisposable
788
internal bool IsCompatible => SchemaVersion ==
DashboardRunStore
.SchemaVersion;
Aspire.Dashboard.Components.Tests (28)
Dialogs\DashboardRunsDialogTests.cs (2)
82
"incompatible",
DashboardRunStore
.SchemaVersion - 1, new DateTimeOffset(2025, 1, 2, 12, 30, 0, TimeSpan.Zero),
201
new(runId,
DashboardRunStore
.SchemaVersion, startedAtUtc, endedAtUtc, CleanShutdown: !isCurrent, "TestApp", string.Empty, isCurrent);
Layout\MainLayoutResourceTerminalsTests.cs (2)
63
new("current",
DashboardRunStore
.SchemaVersion, DateTimeOffset.UnixEpoch, null, false, "TestApp", string.Empty, true),
64
new("historical",
DashboardRunStore
.SchemaVersion, DateTimeOffset.UnixEpoch, DateTimeOffset.UnixEpoch, true, "TestApp", string.Empty, false)
Layout\MainLayoutTerminalTests.cs (2)
96
new("current",
DashboardRunStore
.SchemaVersion, DateTimeOffset.UnixEpoch, null, false, "TestApp", string.Empty, true),
97
new("historical",
DashboardRunStore
.SchemaVersion, DateTimeOffset.UnixEpoch, DateTimeOffset.UnixEpoch, true, "TestApp", string.Empty, false)
Layout\MainLayoutTests.cs (21)
481
SchemaVersion:
DashboardRunStore
.SchemaVersion,
492
SchemaVersion:
DashboardRunStore
.SchemaVersion,
585
SchemaVersion:
DashboardRunStore
.SchemaVersion,
594
SchemaVersion:
DashboardRunStore
.SchemaVersion,
647
SchemaVersion:
DashboardRunStore
.SchemaVersion,
682
var currentRun = new DashboardRunDescriptor("current",
DashboardRunStore
.SchemaVersion, DateTimeOffset.UnixEpoch, null, false, "TestApp", string.Empty, IsCurrent: true);
683
var pinnedRunB = new DashboardRunDescriptor("pinned-b",
DashboardRunStore
.SchemaVersion, startedAtUtc, null, true, "TestApp", string.Empty, IsCurrent: false) { IsPinned = true };
684
var pinnedRunA = new DashboardRunDescriptor("pinned-a",
DashboardRunStore
.SchemaVersion, startedAtUtc, null, true, "TestApp", string.Empty, IsCurrent: false) { IsPinned = true };
685
var olderPinnedRun = new DashboardRunDescriptor("pinned-older",
DashboardRunStore
.SchemaVersion, startedAtUtc.AddDays(-1), null, true, "TestApp", string.Empty, IsCurrent: false) { IsPinned = true };
686
var unpinnedRun = new DashboardRunDescriptor("unpinned",
DashboardRunStore
.SchemaVersion, startedAtUtc.AddDays(1), null, true, "TestApp", string.Empty, IsCurrent: false);
687
var incompatibleRun = new DashboardRunDescriptor("incompatible",
DashboardRunStore
.SchemaVersion - 1, startedAtUtc.AddDays(2), null, true, "TestApp", string.Empty, IsCurrent: false) { IsSelectable = false };
688
var unavailableRun = new DashboardRunDescriptor("unavailable",
DashboardRunStore
.SchemaVersion, startedAtUtc.AddDays(3), null, true, "TestApp", string.Empty, IsCurrent: false) { IsSelectable = false };
689
var prunedRun = new DashboardRunDescriptor("pruned",
DashboardRunStore
.SchemaVersion, startedAtUtc.AddDays(4), null, true, "TestApp", string.Empty, IsCurrent: false) { IsPruned = true };
730
new("run",
DashboardRunStore
.SchemaVersion, startedAtUtc, endedAtUtc, CleanShutdown: endedAtUtc is not null, "TestApp", string.Empty, isCurrent);
745
SchemaVersion:
DashboardRunStore
.SchemaVersion,
789
SchemaVersion:
DashboardRunStore
.SchemaVersion,
800
SchemaVersion:
DashboardRunStore
.SchemaVersion,
845
SchemaVersion:
DashboardRunStore
.SchemaVersion,
854
SchemaVersion:
DashboardRunStore
.SchemaVersion,
906
SchemaVersion:
DashboardRunStore
.SchemaVersion,
917
SchemaVersion:
DashboardRunStore
.SchemaVersion,
Shared\FluentUISetupHelpers.cs (1)
299
SchemaVersion:
DashboardRunStore
.SchemaVersion,
Aspire.Dashboard.Tests (156)
Integration\StartupTests.cs (1)
1141
var runsDirectory =
DashboardRunStore
.GetRunsDirectory(workspace.Path);
Model\DashboardDataSourceTests.cs (154)
38
using
var
runStore = CreateRunStore(options);
40
var applicationDirectoryName =
DashboardRunStore
.GetApplicationDirectoryName("My Dashboard");
53
using
var
runStore = CreateRunStore(options);
55
var applicationDirectoryName =
DashboardRunStore
.GetApplicationDirectoryName("My Dashboard");
64
var applicationDirectoryName =
DashboardRunStore
.GetApplicationDirectoryName("My Dashboard");
71
Assert.Equal(expectedDirectory,
DashboardRunStore
.GetApplicationDirectory(dataRoot: null, "My Dashboard"));
86
? [
DashboardRunStore
.GetRunsDirectory(workspace.Path)]
89
DashboardRunStore
.GetResumesDirectory(workspace.Path),
90
DashboardRunStore
.GetApplicationDirectory(workspace.Path, "My Dashboard")
102
using
var
runStore = CreateRunStore(CreateOptions(workspace, "My Dashboard", persistenceMode));
118
using
var
runStore = CreateRunStore(CreateOptions(workspace), timeProvider);
130
using
var
firstRunStore = CreateRunStore(options, timeProvider);
132
using
var
secondRunStore = CreateRunStore(options, timeProvider);
138
var applicationDirectoryName =
DashboardRunStore
.GetApplicationDirectoryName("TestApp");
147
var existingRunDirectory = Path.Combine(
DashboardRunStore
.GetRunsDirectory(workspace.Path), "20260720T123456789Z");
152
using
var
runStore = CreateRunStore(CreateOptions(workspace), timeProvider);
165
var runsDirectory =
DashboardRunStore
.GetRunsDirectory(workspace.Path);
168
for (var i = 0; i <
DashboardRunStore
.MaxRunIdAttempts; i++)
171
Directory.CreateDirectory(
DashboardRunStore
.GetRunLockPath(Path.Combine(runsDirectory, runId)));
176
Assert.StartsWith($"Could not allocate a dashboard run in '{runsDirectory}' after {
DashboardRunStore
.MaxRunIdAttempts} attempts.", exception.Message);
185
using
var
runStore = CreateRunStore(options);
204
Assert.Equal(
DashboardRunStore
.SchemaVersion, metadata.RootElement.GetProperty("SchemaVersion").GetInt32());
205
Assert.Equal(
DashboardRunStore
.SchemaVersion, Assert.Single(runStore.GetRuns()).SchemaVersion);
217
using
var
runStore = CreateRunStore(CreateOptions(workspace, applicationName));
240
using (
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt)))
252
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddSeconds(1)));
291
using (
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt)))
305
using
var
nextRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMinutes(1)));
316
using
var
runStore = CreateRunStore(options);
341
using
var
runStore = new DashboardRunStore(
343
loggerFactory.CreateLogger<
DashboardRunStore
>(),
374
using (
var
runStore = CreateRunStore(options))
402
.AddSingleton<ILogger<
DashboardRunStore
>>(NullLogger<
DashboardRunStore
>.Instance)
406
.AddSingleton<
DashboardRunStore
>()
407
.AddSingleton<IDashboardRunStore>(serviceProvider => serviceProvider.GetRequiredService<
DashboardRunStore
>())
416
var
runStore = serviceProvider.GetRequiredService<
DashboardRunStore
>();
451
using
var
runStore = CreateRunStore(CreateOptions(workspace, persistenceMode: DashboardPersistenceMode.None));
482
using
var
runStore = CreateRunStore(
489
Assert.True(File.Exists(
DashboardRunStore
.GetRunLockPath(runStore.CurrentWorkingDirectory)));
505
var initializingLockPath =
DashboardRunStore
.GetRunLockPath(initializingDirectory);
511
using
var
runStore = CreateRunStore(
518
using
var
nextRunStore = CreateRunStore(
536
using
var
activeRunStore = CreateRunStore(options);
540
using
var
secondRunStore = CreateRunStore(options);
555
using
var
runStore = CreateRunStore(CreateOptions(workspace, persistenceMode: DashboardPersistenceMode.None));
573
var logger = new TestLogger<
DashboardRunStore
>(new TestLoggerFactory(testSink, enabled: true));
575
using
var
runStore = new DashboardRunStore(
593
using (
var
firstRunStore = CreateRunStore(options))
601
var logger = new TestLogger<
DashboardRunStore
>(new TestLoggerFactory(testSink, enabled: true));
602
using
var
secondRunStore = new DashboardRunStore(options, logger, TimeProvider.System);
619
using
var
firstRunStore = CreateRunStore(options);
637
using (
var
firstRunStore = CreateRunStore(options))
649
var logger = new TestLogger<
DashboardRunStore
>(new TestLoggerFactory(testSink, enabled: true));
650
using
var
secondRunStore = new DashboardRunStore(options, logger, TimeProvider.System);
656
write => write.Message == $"Existing dashboard database at '{databasePath}' is incompatible with schema version {
DashboardRunStore
.SchemaVersion} and will be replaced.");
670
using (
var
firstRunStore = CreateRunStore(options))
713
var firstDirectoryName =
DashboardRunStore
.GetApplicationDirectoryName(firstName);
714
var secondDirectoryName =
DashboardRunStore
.GetApplicationDirectoryName(secondName);
716
Assert.Equal(
DashboardRunStore
.MaxApplicationDirectoryNameLength, firstDirectoryName.Length);
717
Assert.Equal(
DashboardRunStore
.MaxApplicationDirectoryNameLength, secondDirectoryName.Length);
721
Assert.Equal(firstDirectoryName,
DashboardRunStore
.GetApplicationDirectoryName(firstName));
731
using (
var
historicalRunStore = CreateRunStore(options))
738
using
var
currentRunStore = CreateRunStore(options);
763
using (
var
otherApplicationRunStore = CreateRunStore(
771
using (
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMilliseconds(1))))
776
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMilliseconds(2)));
793
using (
var
incompatibleRunStore = CreateRunStore(
795
new FixedTimeProvider(startedAt.AddDays(-
DashboardRunStore
.MaxRuns))))
804
metadata["SchemaVersion"] =
DashboardRunStore
.SchemaVersion - 1;
807
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt));
823
Assert.Equal(
DashboardRunStore
.SchemaVersion - 1, updatedMetadata.RootElement.GetProperty("SchemaVersion").GetInt32());
836
using (
var
futureRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMinutes(-1))))
845
metadata["SchemaVersion"] =
DashboardRunStore
.SchemaVersion + 1;
853
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt));
862
Assert.Equal(
DashboardRunStore
.SchemaVersion + 1, updatedMetadata.RootElement.GetProperty("SchemaVersion").GetInt32());
878
using (
var
incompatibleRunStore = CreateRunStore(
880
new FixedTimeProvider(startedAt.AddDays(-
DashboardRunStore
.MaxRuns))))
889
metadata["SchemaVersion"] =
DashboardRunStore
.SchemaVersion - 1;
892
foreach (var index in Enumerable.Range(1,
DashboardRunStore
.MaxRuns - 1))
894
using
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(-index)));
898
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt));
906
Assert.Equal(
DashboardRunStore
.MaxRuns, Directory.GetDirectories(runsDirectory).Length);
915
using
var
runStore = CreateRunStore(CreateOptions(workspace));
927
using
var
runStore = CreateRunStore(CreateOptions(workspace));
943
using (
var
historicalRunStore = CreateRunStore(options))
950
using
var
activeRunStore = CreateRunStore(options);
953
using
var
currentRunStore = CreateRunStore(options);
973
foreach (var index in Enumerable.Range(1,
DashboardRunStore
.MaxRuns))
975
using
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(-index)));
980
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt));
984
Assert.Equal(
DashboardRunStore
.MaxRuns, Directory.GetDirectories(runsDirectory).Length);
996
var runsDirectory =
DashboardRunStore
.GetRunsDirectory(workspace.Path);
1006
using
var
runStore = CreateRunStore(options, new FixedTimeProvider(now));
1011
Assert.True(File.Exists(
DashboardRunStore
.GetRunLockPath(runStore.CurrentWorkingDirectory)));
1022
foreach (var index in Enumerable.Range(0,
DashboardRunStore
.MaxRuns - activeRunCount))
1024
using
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMilliseconds(index)));
1028
var activeRunStores = new List<
DashboardRunStore
>();
1029
foreach (var index in Enumerable.Range(
DashboardRunStore
.MaxRuns - activeRunCount, activeRunCount))
1031
var
activeRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMilliseconds(index)));
1038
using
var
currentRunStore = CreateRunStore(
1040
new FixedTimeProvider(startedAt.AddMilliseconds(
DashboardRunStore
.MaxRuns)));
1045
foreach (
var
activeRunStore in activeRunStores)
1054
Assert.Equal(
DashboardRunStore
.MaxRuns, runs.Count);
1055
Assert.Equal(
DashboardRunStore
.MaxRuns - activeRunCount, runs.Count(run => run.IsSelectable));
1072
using (
var
runStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(runIndex++))))
1078
using
var
pinningRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(runIndex++)));
1089
for (var index = 0; index <
DashboardRunStore
.MaxRuns - 1; index++)
1091
using
var
runStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(runIndex++)));
1095
using
var
finalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(runIndex)));
1103
Assert.Equal(
DashboardRunStore
.MaxRuns - 1, runs.Count(run => !run.IsCurrent && !run.IsPinned));
1115
foreach (var index in Enumerable.Range(1,
DashboardRunStore
.MaxRuns - 1))
1117
using
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(-index)));
1121
using
var
activeRunStore = CreateRunStore(
1123
new FixedTimeProvider(startedAt.AddDays(-
DashboardRunStore
.MaxRuns)));
1126
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt));
1131
Assert.Equal(
DashboardRunStore
.MaxRuns + 1, Directory.GetDirectories(runsDirectory).Length);
1143
using (
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt)))
1151
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMilliseconds(1)));
1157
foreach (var index in Enumerable.Range(1,
DashboardRunStore
.MaxRuns - 2))
1159
using
var
additionalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(index)));
1164
using
var
pruningRunStore = new DashboardRunStore(
1166
NullLogger<
DashboardRunStore
>.Instance,
1175
using
var
nextPruningRunStore = new DashboardRunStore(
1177
NullLogger<
DashboardRunStore
>.Instance,
1192
using (
var
historicalRunStore = CreateRunStore(options))
1199
using
var
currentRunStore = CreateRunStore(options);
1242
using (
var
historicalRunStore = CreateRunStore(options))
1249
using
var
currentRunStore = CreateRunStore(options);
1272
foreach (var index in Enumerable.Range(1,
DashboardRunStore
.MaxRuns))
1274
using
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(-index)));
1281
var logger = loggerFactory.CreateLogger<
DashboardRunStore
>();
1284
using
var
currentRunStore = new DashboardRunStore(
1293
Assert.Equal(typeof(
DashboardRunStore
).FullName, warning.LoggerName);
1308
using (
var
malformedRunStore = CreateRunStore(options))
1320
using
var
currentRunStore = CreateRunStore(options);
1352
using
var
currentRunStore = CreateRunStore(options);
1355
var historicalDatabasePath = Path.Combine(historicalDirectory,
DashboardRunStore
.DatabaseFileName);
1361
var malformedDatabasePath = Path.Combine(malformedDirectory,
DashboardRunStore
.DatabaseFileName);
1387
DatabasePath = Path.Combine(workspace.Path, "unavailable",
DashboardRunStore
.DatabaseFileName),
1454
using (
var
historicalRunStore = CreateRunStore(options))
1484
using
var
currentRunStore = CreateRunStore(options);
1563
using
var
currentRunStore = CreateRunStore(options);
1583
using
var
currentRunStore = CreateRunStore(options);
1588
SchemaVersion =
DashboardRunStore
.SchemaVersion + 1,
1589
DatabasePath = Path.Combine(workspace.Path, "incompatible",
DashboardRunStore
.DatabaseFileName),
1624
using (
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(historicalRunTime)))
1629
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(historicalRunTime.AddMilliseconds(1)));
1678
private static async Task InitializeAndPublishRunAsync(
DashboardRunStore
runStore)
1687
private static async Task InitializeAndPublishRunWithoutPruningAsync(
DashboardRunStore
runStore)
1704
private static
DashboardRunStore
CreateRunStore(IOptions<DashboardOptions> options, TimeProvider? timeProvider = null)
1706
return new DashboardRunStore(options, NullLogger<
DashboardRunStore
>.Instance, timeProvider ?? TimeProvider.System);
1727
DashboardRunStore
.GetRunLockPath(runDirectory),
Shared\TestDashboardDataSource.cs (1)
47
[new("current",
DashboardRunStore
.SchemaVersion, DateTimeOffset.UnixEpoch, null, false, "TestApp", databasePath ?? string.Empty, IsCurrent: true)])