8 instantiations of DashboardRunStore
Aspire.Dashboard.Tests (8)
Model\DashboardDataSourceTests.cs (8)
341
using var runStore = new
DashboardRunStore
(
577
using var runStore = new
DashboardRunStore
(
605
using var secondRunStore = new
DashboardRunStore
(options, logger, TimeProvider.System, new Aspire.Shared.TemporaryStorage());
653
using var secondRunStore = new
DashboardRunStore
(options, logger, TimeProvider.System, new Aspire.Shared.TemporaryStorage());
1167
using var pruningRunStore = new
DashboardRunStore
(
1179
using var nextPruningRunStore = new
DashboardRunStore
(
1289
using var currentRunStore = new
DashboardRunStore
(
1712
return new
DashboardRunStore
(options, NullLogger<DashboardRunStore>.Instance, timeProvider ?? TimeProvider.System, new Aspire.Shared.TemporaryStorage());
195 references to DashboardRunStore
Aspire.Dashboard (11)
DashboardWebApplication.cs (2)
412
builder.Services.AddSingleton<
DashboardRunStore
>();
413
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)
54
[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, ITemporaryStorage temporaryStorage)
109
ILogger<
DashboardRunStore
> logger,
727
private sealed class RunLease(
DashboardRunStore
owner, DashboardRunDescriptor run, FileLock runLock) : IDisposable
789
internal bool IsCompatible => SchemaVersion ==
DashboardRunStore
.SchemaVersion;
Aspire.Dashboard.Components.Tests (28)
Dialogs\DashboardRunsDialogTests.cs (2)
79
"incompatible",
DashboardRunStore
.SchemaVersion - 1, new DateTimeOffset(2025, 1, 2, 12, 30, 0, TimeSpan.Zero),
198
new(runId,
DashboardRunStore
.SchemaVersion, startedAtUtc, endedAtUtc, CleanShutdown: !isCurrent, "TestApp", string.Empty, isCurrent);
Layout\MainLayoutResourceTerminalsTests.cs (2)
88
new("current",
DashboardRunStore
.SchemaVersion, DateTimeOffset.UnixEpoch, null, false, "TestApp", string.Empty, true),
89
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)
627
SchemaVersion:
DashboardRunStore
.SchemaVersion,
638
SchemaVersion:
DashboardRunStore
.SchemaVersion,
727
SchemaVersion:
DashboardRunStore
.SchemaVersion,
736
SchemaVersion:
DashboardRunStore
.SchemaVersion,
789
SchemaVersion:
DashboardRunStore
.SchemaVersion,
822
var currentRun = new DashboardRunDescriptor("current",
DashboardRunStore
.SchemaVersion, DateTimeOffset.UnixEpoch, null, false, "TestApp", string.Empty, IsCurrent: true);
823
var pinnedRunB = new DashboardRunDescriptor("pinned-b",
DashboardRunStore
.SchemaVersion, startedAtUtc, null, true, "TestApp", string.Empty, IsCurrent: false) { IsPinned = true };
824
var pinnedRunA = new DashboardRunDescriptor("pinned-a",
DashboardRunStore
.SchemaVersion, startedAtUtc, null, true, "TestApp", string.Empty, IsCurrent: false) { IsPinned = true };
825
var olderPinnedRun = new DashboardRunDescriptor("pinned-older",
DashboardRunStore
.SchemaVersion, startedAtUtc.AddDays(-1), null, true, "TestApp", string.Empty, IsCurrent: false) { IsPinned = true };
826
var unpinnedRun = new DashboardRunDescriptor("unpinned",
DashboardRunStore
.SchemaVersion, startedAtUtc.AddDays(1), null, true, "TestApp", string.Empty, IsCurrent: false);
827
var incompatibleRun = new DashboardRunDescriptor("incompatible",
DashboardRunStore
.SchemaVersion - 1, startedAtUtc.AddDays(2), null, true, "TestApp", string.Empty, IsCurrent: false) { IsSelectable = false };
828
var unavailableRun = new DashboardRunDescriptor("unavailable",
DashboardRunStore
.SchemaVersion, startedAtUtc.AddDays(3), null, true, "TestApp", string.Empty, IsCurrent: false) { IsSelectable = false };
829
var prunedRun = new DashboardRunDescriptor("pruned",
DashboardRunStore
.SchemaVersion, startedAtUtc.AddDays(4), null, true, "TestApp", string.Empty, IsCurrent: false) { IsPruned = true };
853
new("run",
DashboardRunStore
.SchemaVersion, startedAtUtc, endedAtUtc, CleanShutdown: endedAtUtc is not null, "TestApp", string.Empty, isCurrent);
868
SchemaVersion:
DashboardRunStore
.SchemaVersion,
906
SchemaVersion:
DashboardRunStore
.SchemaVersion,
917
SchemaVersion:
DashboardRunStore
.SchemaVersion,
960
SchemaVersion:
DashboardRunStore
.SchemaVersion,
969
SchemaVersion:
DashboardRunStore
.SchemaVersion,
1019
SchemaVersion:
DashboardRunStore
.SchemaVersion,
1030
SchemaVersion:
DashboardRunStore
.SchemaVersion,
Shared\FluentUISetupHelpers.cs (1)
300
SchemaVersion:
DashboardRunStore
.SchemaVersion,
Aspire.Dashboard.Tests (156)
Integration\StartupTests.cs (1)
1185
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
>(),
375
using (
var
runStore = CreateRunStore(options))
403
.AddSingleton<ILogger<
DashboardRunStore
>>(NullLogger<
DashboardRunStore
>.Instance)
408
.AddSingleton<
DashboardRunStore
>()
409
.AddSingleton<IDashboardRunStore>(serviceProvider => serviceProvider.GetRequiredService<
DashboardRunStore
>())
418
var
runStore = serviceProvider.GetRequiredService<
DashboardRunStore
>();
453
using
var
runStore = CreateRunStore(CreateOptions(workspace, persistenceMode: DashboardPersistenceMode.None));
484
using
var
runStore = CreateRunStore(
491
Assert.True(File.Exists(
DashboardRunStore
.GetRunLockPath(runStore.CurrentWorkingDirectory)));
507
var initializingLockPath =
DashboardRunStore
.GetRunLockPath(initializingDirectory);
513
using
var
runStore = CreateRunStore(
520
using
var
nextRunStore = CreateRunStore(
538
using
var
activeRunStore = CreateRunStore(options);
542
using
var
secondRunStore = CreateRunStore(options);
557
using
var
runStore = CreateRunStore(CreateOptions(workspace, persistenceMode: DashboardPersistenceMode.None));
575
var logger = new TestLogger<
DashboardRunStore
>(new TestLoggerFactory(testSink, enabled: true));
577
using
var
runStore = new DashboardRunStore(
596
using (
var
firstRunStore = CreateRunStore(options))
604
var logger = new TestLogger<
DashboardRunStore
>(new TestLoggerFactory(testSink, enabled: true));
605
using
var
secondRunStore = new DashboardRunStore(options, logger, TimeProvider.System, new Aspire.Shared.TemporaryStorage());
622
using
var
firstRunStore = CreateRunStore(options);
640
using (
var
firstRunStore = CreateRunStore(options))
652
var logger = new TestLogger<
DashboardRunStore
>(new TestLoggerFactory(testSink, enabled: true));
653
using
var
secondRunStore = new DashboardRunStore(options, logger, TimeProvider.System, new Aspire.Shared.TemporaryStorage());
659
write => write.Message == $"Existing dashboard database at '{databasePath}' is incompatible with schema version {
DashboardRunStore
.SchemaVersion} and will be replaced.");
673
using (
var
firstRunStore = CreateRunStore(options))
716
var firstDirectoryName =
DashboardRunStore
.GetApplicationDirectoryName(firstName);
717
var secondDirectoryName =
DashboardRunStore
.GetApplicationDirectoryName(secondName);
719
Assert.Equal(
DashboardRunStore
.MaxApplicationDirectoryNameLength, firstDirectoryName.Length);
720
Assert.Equal(
DashboardRunStore
.MaxApplicationDirectoryNameLength, secondDirectoryName.Length);
724
Assert.Equal(firstDirectoryName,
DashboardRunStore
.GetApplicationDirectoryName(firstName));
734
using (
var
historicalRunStore = CreateRunStore(options))
741
using
var
currentRunStore = CreateRunStore(options);
766
using (
var
otherApplicationRunStore = CreateRunStore(
774
using (
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMilliseconds(1))))
779
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMilliseconds(2)));
796
using (
var
incompatibleRunStore = CreateRunStore(
798
new FixedTimeProvider(startedAt.AddDays(-
DashboardRunStore
.MaxRuns))))
807
metadata["SchemaVersion"] =
DashboardRunStore
.SchemaVersion - 1;
810
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt));
826
Assert.Equal(
DashboardRunStore
.SchemaVersion - 1, updatedMetadata.RootElement.GetProperty("SchemaVersion").GetInt32());
839
using (
var
futureRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMinutes(-1))))
848
metadata["SchemaVersion"] =
DashboardRunStore
.SchemaVersion + 1;
856
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt));
865
Assert.Equal(
DashboardRunStore
.SchemaVersion + 1, updatedMetadata.RootElement.GetProperty("SchemaVersion").GetInt32());
881
using (
var
incompatibleRunStore = CreateRunStore(
883
new FixedTimeProvider(startedAt.AddDays(-
DashboardRunStore
.MaxRuns))))
892
metadata["SchemaVersion"] =
DashboardRunStore
.SchemaVersion - 1;
895
foreach (var index in Enumerable.Range(1,
DashboardRunStore
.MaxRuns - 1))
897
using
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(-index)));
901
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt));
909
Assert.Equal(
DashboardRunStore
.MaxRuns, Directory.GetDirectories(runsDirectory).Length);
918
using
var
runStore = CreateRunStore(CreateOptions(workspace));
930
using
var
runStore = CreateRunStore(CreateOptions(workspace));
946
using (
var
historicalRunStore = CreateRunStore(options))
953
using
var
activeRunStore = CreateRunStore(options);
956
using
var
currentRunStore = CreateRunStore(options);
976
foreach (var index in Enumerable.Range(1,
DashboardRunStore
.MaxRuns))
978
using
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(-index)));
983
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt));
987
Assert.Equal(
DashboardRunStore
.MaxRuns, Directory.GetDirectories(runsDirectory).Length);
999
var runsDirectory =
DashboardRunStore
.GetRunsDirectory(workspace.Path);
1009
using
var
runStore = CreateRunStore(options, new FixedTimeProvider(now));
1014
Assert.True(File.Exists(
DashboardRunStore
.GetRunLockPath(runStore.CurrentWorkingDirectory)));
1025
foreach (var index in Enumerable.Range(0,
DashboardRunStore
.MaxRuns - activeRunCount))
1027
using
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMilliseconds(index)));
1031
var activeRunStores = new List<
DashboardRunStore
>();
1032
foreach (var index in Enumerable.Range(
DashboardRunStore
.MaxRuns - activeRunCount, activeRunCount))
1034
var
activeRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMilliseconds(index)));
1041
using
var
currentRunStore = CreateRunStore(
1043
new FixedTimeProvider(startedAt.AddMilliseconds(
DashboardRunStore
.MaxRuns)));
1048
foreach (
var
activeRunStore in activeRunStores)
1057
Assert.Equal(
DashboardRunStore
.MaxRuns, runs.Count);
1058
Assert.Equal(
DashboardRunStore
.MaxRuns - activeRunCount, runs.Count(run => run.IsSelectable));
1075
using (
var
runStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(runIndex++))))
1081
using
var
pinningRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(runIndex++)));
1092
for (var index = 0; index <
DashboardRunStore
.MaxRuns - 1; index++)
1094
using
var
runStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(runIndex++)));
1098
using
var
finalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(runIndex)));
1106
Assert.Equal(
DashboardRunStore
.MaxRuns - 1, runs.Count(run => !run.IsCurrent && !run.IsPinned));
1118
foreach (var index in Enumerable.Range(1,
DashboardRunStore
.MaxRuns - 1))
1120
using
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(-index)));
1124
using
var
activeRunStore = CreateRunStore(
1126
new FixedTimeProvider(startedAt.AddDays(-
DashboardRunStore
.MaxRuns)));
1129
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt));
1134
Assert.Equal(
DashboardRunStore
.MaxRuns + 1, Directory.GetDirectories(runsDirectory).Length);
1146
using (
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt)))
1154
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMilliseconds(1)));
1160
foreach (var index in Enumerable.Range(1,
DashboardRunStore
.MaxRuns - 2))
1162
using
var
additionalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(index)));
1167
using
var
pruningRunStore = new DashboardRunStore(
1169
NullLogger<
DashboardRunStore
>.Instance,
1179
using
var
nextPruningRunStore = new DashboardRunStore(
1181
NullLogger<
DashboardRunStore
>.Instance,
1197
using (
var
historicalRunStore = CreateRunStore(options))
1204
using
var
currentRunStore = CreateRunStore(options);
1247
using (
var
historicalRunStore = CreateRunStore(options))
1254
using
var
currentRunStore = CreateRunStore(options);
1277
foreach (var index in Enumerable.Range(1,
DashboardRunStore
.MaxRuns))
1279
using
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(-index)));
1286
var logger = loggerFactory.CreateLogger<
DashboardRunStore
>();
1289
using
var
currentRunStore = new DashboardRunStore(
1299
Assert.Equal(typeof(
DashboardRunStore
).FullName, warning.LoggerName);
1314
using (
var
malformedRunStore = CreateRunStore(options))
1326
using
var
currentRunStore = CreateRunStore(options);
1358
using
var
currentRunStore = CreateRunStore(options);
1361
var historicalDatabasePath = Path.Combine(historicalDirectory,
DashboardRunStore
.DatabaseFileName);
1367
var malformedDatabasePath = Path.Combine(malformedDirectory,
DashboardRunStore
.DatabaseFileName);
1393
DatabasePath = Path.Combine(workspace.Path, "unavailable",
DashboardRunStore
.DatabaseFileName),
1460
using (
var
historicalRunStore = CreateRunStore(options))
1490
using
var
currentRunStore = CreateRunStore(options);
1569
using
var
currentRunStore = CreateRunStore(options);
1589
using
var
currentRunStore = CreateRunStore(options);
1594
SchemaVersion =
DashboardRunStore
.SchemaVersion + 1,
1595
DatabasePath = Path.Combine(workspace.Path, "incompatible",
DashboardRunStore
.DatabaseFileName),
1630
using (
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(historicalRunTime)))
1635
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(historicalRunTime.AddMilliseconds(1)));
1684
private static async Task InitializeAndPublishRunAsync(
DashboardRunStore
runStore)
1693
private static async Task InitializeAndPublishRunWithoutPruningAsync(
DashboardRunStore
runStore)
1710
private static
DashboardRunStore
CreateRunStore(IOptions<DashboardOptions> options, TimeProvider? timeProvider = null)
1712
return new DashboardRunStore(options, NullLogger<
DashboardRunStore
>.Instance, timeProvider ?? TimeProvider.System, new Aspire.Shared.TemporaryStorage());
1733
DashboardRunStore
.GetRunLockPath(runDirectory),
Shared\TestDashboardDataSource.cs (1)
47
[new("current",
DashboardRunStore
.SchemaVersion, DateTimeOffset.UnixEpoch, null, false, "TestApp", databasePath ?? string.Empty, IsCurrent: true)])