8 instantiations of DashboardRunStore
Aspire.Dashboard.Tests (8)
Model\DashboardDataSourceTests.cs (8)
297
using var runStore = new
DashboardRunStore
(
531
using var runStore = new
DashboardRunStore
(
558
using var secondRunStore = new
DashboardRunStore
(options, logger, TimeProvider.System);
606
using var secondRunStore = new
DashboardRunStore
(options, logger, TimeProvider.System);
1120
using var pruningRunStore = new
DashboardRunStore
(
1131
using var nextPruningRunStore = new
DashboardRunStore
(
1240
using var currentRunStore = new
DashboardRunStore
(
1662
return new
DashboardRunStore
(options, NullLogger<DashboardRunStore>.Instance, timeProvider ?? TimeProvider.System);
196 references to DashboardRunStore
Aspire.Dashboard (11)
DashboardWebApplication.cs (2)
380
builder.Services.AddSingleton<
DashboardRunStore
>();
381
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)
50
[JsonSerializable(typeof(
DashboardRunStore
.DashboardRunMetadata))]
ServiceClient\DashboardRunStore.cs (5)
91
private readonly ILogger<
DashboardRunStore
> _logger;
98
public DashboardRunStore(IOptions<DashboardOptions> options, ILogger<
DashboardRunStore
> logger, TimeProvider timeProvider)
105
ILogger<
DashboardRunStore
> logger,
667
private sealed class RunLease(
DashboardRunStore
owner, DashboardRunDescriptor run, FileLock runLock) : IDisposable
729
internal bool IsCompatible => SchemaVersion ==
DashboardRunStore
.SchemaVersion;
Aspire.Dashboard.Components.Tests (37)
Layout\MainLayoutResourceTerminalsTests.cs (2)
64
new("current",
DashboardRunStore
.SchemaVersion, DateTimeOffset.UnixEpoch, null, false, "TestApp", string.Empty, true),
65
new("historical",
DashboardRunStore
.SchemaVersion, DateTimeOffset.UnixEpoch, DateTimeOffset.UnixEpoch, true, "TestApp", string.Empty, false)
Layout\MainLayoutTerminalTests.cs (2)
97
new("current",
DashboardRunStore
.SchemaVersion, DateTimeOffset.UnixEpoch, null, false, "TestApp", string.Empty, true),
98
new("historical",
DashboardRunStore
.SchemaVersion, DateTimeOffset.UnixEpoch, DateTimeOffset.UnixEpoch, true, "TestApp", string.Empty, false)
Layout\MainLayoutTests.cs (32)
319
SchemaVersion:
DashboardRunStore
.SchemaVersion,
330
SchemaVersion:
DashboardRunStore
.SchemaVersion,
367
SchemaVersion:
DashboardRunStore
.SchemaVersion - 1,
376
SchemaVersion:
DashboardRunStore
.SchemaVersion,
385
SchemaVersion:
DashboardRunStore
.SchemaVersion,
437
SchemaVersion:
DashboardRunStore
.SchemaVersion,
471
SchemaVersion:
DashboardRunStore
.SchemaVersion,
482
SchemaVersion:
DashboardRunStore
.SchemaVersion,
678
SchemaVersion:
DashboardRunStore
.SchemaVersion,
687
SchemaVersion:
DashboardRunStore
.SchemaVersion,
740
SchemaVersion:
DashboardRunStore
.SchemaVersion,
749
SchemaVersion:
DashboardRunStore
.SchemaVersion,
792
var currentRun = new DashboardRunDescriptor("current",
DashboardRunStore
.SchemaVersion, DateTimeOffset.UnixEpoch, null, false, "TestApp", string.Empty, IsCurrent: true);
793
var pinnedRunB = new DashboardRunDescriptor("pinned-b",
DashboardRunStore
.SchemaVersion, startedAtUtc, null, true, "TestApp", string.Empty, IsCurrent: false) { IsPinned = true };
794
var pinnedRunA = new DashboardRunDescriptor("pinned-a",
DashboardRunStore
.SchemaVersion, startedAtUtc, null, true, "TestApp", string.Empty, IsCurrent: false) { IsPinned = true };
795
var olderPinnedRun = new DashboardRunDescriptor("pinned-older",
DashboardRunStore
.SchemaVersion, startedAtUtc.AddDays(-1), null, true, "TestApp", string.Empty, IsCurrent: false) { IsPinned = true };
796
var unpinnedRun = new DashboardRunDescriptor("unpinned",
DashboardRunStore
.SchemaVersion, startedAtUtc.AddDays(1), null, true, "TestApp", string.Empty, IsCurrent: false);
797
var incompatibleRun = new DashboardRunDescriptor("incompatible",
DashboardRunStore
.SchemaVersion - 1, startedAtUtc.AddDays(2), null, true, "TestApp", string.Empty, IsCurrent: false) { IsSelectable = false };
798
var unavailableRun = new DashboardRunDescriptor("unavailable",
DashboardRunStore
.SchemaVersion, startedAtUtc.AddDays(3), null, true, "TestApp", string.Empty, IsCurrent: false) { IsSelectable = false };
799
var prunedRun = new DashboardRunDescriptor("pruned",
DashboardRunStore
.SchemaVersion, startedAtUtc.AddDays(4), null, true, "TestApp", string.Empty, IsCurrent: false) { IsPruned = true };
823
SchemaVersion:
DashboardRunStore
.SchemaVersion,
832
new DashboardRunDescriptor("unpinned-b",
DashboardRunStore
.SchemaVersion, new(2025, 1, 2, 12, 0, 0, TimeSpan.Zero), null, true, "TestApp", string.Empty, IsCurrent: false),
833
new DashboardRunDescriptor("pinned-b",
DashboardRunStore
.SchemaVersion, new(2025, 1, 2, 11, 0, 0, TimeSpan.Zero), null, true, "TestApp", string.Empty, IsCurrent: false),
834
new DashboardRunDescriptor("unpinned-a",
DashboardRunStore
.SchemaVersion, new(2025, 1, 2, 9, 0, 0, TimeSpan.Zero), null, true, "TestApp", string.Empty, IsCurrent: false),
835
new DashboardRunDescriptor("pinned-a",
DashboardRunStore
.SchemaVersion, new(2025, 1, 2, 10, 0, 0, TimeSpan.Zero), null, true, "TestApp", string.Empty, IsCurrent: false)
918
SchemaVersion:
DashboardRunStore
.SchemaVersion,
962
SchemaVersion:
DashboardRunStore
.SchemaVersion,
973
SchemaVersion:
DashboardRunStore
.SchemaVersion,
1016
SchemaVersion:
DashboardRunStore
.SchemaVersion,
1025
SchemaVersion:
DashboardRunStore
.SchemaVersion,
1075
SchemaVersion:
DashboardRunStore
.SchemaVersion,
1086
SchemaVersion:
DashboardRunStore
.SchemaVersion,
Shared\FluentUISetupHelpers.cs (1)
273
SchemaVersion:
DashboardRunStore
.SchemaVersion,
Aspire.Dashboard.Tests (148)
Integration\StartupTests.cs (1)
1141
var runsDirectory =
DashboardRunStore
.GetRunsDirectory(workspace.Path);
Model\DashboardDataSourceTests.cs (146)
37
using
var
runStore = CreateRunStore(options);
39
var applicationDirectoryName =
DashboardRunStore
.GetApplicationDirectoryName("My Dashboard");
52
using
var
runStore = CreateRunStore(options);
54
var applicationDirectoryName =
DashboardRunStore
.GetApplicationDirectoryName("My Dashboard");
63
var applicationDirectoryName =
DashboardRunStore
.GetApplicationDirectoryName("My Dashboard");
70
Assert.Equal(expectedDirectory,
DashboardRunStore
.GetApplicationDirectory(dataRoot: null, "My Dashboard"));
85
? [
DashboardRunStore
.GetRunsDirectory(workspace.Path)]
88
DashboardRunStore
.GetResumesDirectory(workspace.Path),
89
DashboardRunStore
.GetApplicationDirectory(workspace.Path, "My Dashboard")
101
using
var
runStore = CreateRunStore(CreateOptions(workspace, "My Dashboard", persistenceMode));
117
using
var
runStore = CreateRunStore(CreateOptions(workspace), timeProvider);
129
using
var
firstRunStore = CreateRunStore(options, timeProvider);
141
using
var
runStore = CreateRunStore(options);
160
Assert.Equal(
DashboardRunStore
.SchemaVersion, metadata.RootElement.GetProperty("SchemaVersion").GetInt32());
161
Assert.Equal(
DashboardRunStore
.SchemaVersion, Assert.Single(runStore.GetRuns()).SchemaVersion);
173
using
var
runStore = CreateRunStore(CreateOptions(workspace, applicationName));
196
using (
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt)))
208
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddSeconds(1)));
247
using (
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt)))
261
using
var
nextRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMinutes(1)));
272
using
var
runStore = CreateRunStore(options);
297
using
var
runStore = new DashboardRunStore(
299
loggerFactory.CreateLogger<
DashboardRunStore
>(),
330
using (
var
runStore = CreateRunStore(options))
358
.AddSingleton<ILogger<
DashboardRunStore
>>(NullLogger<
DashboardRunStore
>.Instance)
362
.AddSingleton<
DashboardRunStore
>()
363
.AddSingleton<IDashboardRunStore>(serviceProvider => serviceProvider.GetRequiredService<
DashboardRunStore
>())
372
var
runStore = serviceProvider.GetRequiredService<
DashboardRunStore
>();
407
using
var
runStore = CreateRunStore(CreateOptions(workspace, persistenceMode: DashboardPersistenceMode.None));
438
using
var
runStore = CreateRunStore(
445
Assert.True(File.Exists(
DashboardRunStore
.GetRunLockPath(runStore.CurrentWorkingDirectory)));
461
var initializingLockPath =
DashboardRunStore
.GetRunLockPath(initializingDirectory);
467
using
var
runStore = CreateRunStore(
474
using
var
nextRunStore = CreateRunStore(
492
using
var
activeRunStore = CreateRunStore(options);
496
using
var
secondRunStore = CreateRunStore(options);
511
using
var
runStore = CreateRunStore(CreateOptions(workspace, persistenceMode: DashboardPersistenceMode.None));
529
var logger = new TestLogger<
DashboardRunStore
>(new TestLoggerFactory(testSink, enabled: true));
531
using
var
runStore = new DashboardRunStore(
549
using (
var
firstRunStore = CreateRunStore(options))
557
var logger = new TestLogger<
DashboardRunStore
>(new TestLoggerFactory(testSink, enabled: true));
558
using
var
secondRunStore = new DashboardRunStore(options, logger, TimeProvider.System);
575
using
var
firstRunStore = CreateRunStore(options);
593
using (
var
firstRunStore = CreateRunStore(options))
605
var logger = new TestLogger<
DashboardRunStore
>(new TestLoggerFactory(testSink, enabled: true));
606
using
var
secondRunStore = new DashboardRunStore(options, logger, TimeProvider.System);
612
write => write.Message == $"Existing dashboard database at '{databasePath}' is incompatible with schema version {
DashboardRunStore
.SchemaVersion} and will be replaced.");
626
using (
var
firstRunStore = CreateRunStore(options))
669
var firstDirectoryName =
DashboardRunStore
.GetApplicationDirectoryName(firstName);
670
var secondDirectoryName =
DashboardRunStore
.GetApplicationDirectoryName(secondName);
672
Assert.Equal(
DashboardRunStore
.MaxApplicationDirectoryNameLength, firstDirectoryName.Length);
673
Assert.Equal(
DashboardRunStore
.MaxApplicationDirectoryNameLength, secondDirectoryName.Length);
677
Assert.Equal(firstDirectoryName,
DashboardRunStore
.GetApplicationDirectoryName(firstName));
687
using (
var
historicalRunStore = CreateRunStore(options))
694
using
var
currentRunStore = CreateRunStore(options);
719
using (
var
otherApplicationRunStore = CreateRunStore(
727
using (
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMilliseconds(1))))
732
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMilliseconds(2)));
749
using (
var
incompatibleRunStore = CreateRunStore(
751
new FixedTimeProvider(startedAt.AddDays(-
DashboardRunStore
.MaxRuns))))
760
metadata["SchemaVersion"] =
DashboardRunStore
.SchemaVersion - 1;
763
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt));
779
Assert.Equal(
DashboardRunStore
.SchemaVersion - 1, updatedMetadata.RootElement.GetProperty("SchemaVersion").GetInt32());
792
using (
var
futureRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMinutes(-1))))
801
metadata["SchemaVersion"] =
DashboardRunStore
.SchemaVersion + 1;
809
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt));
818
Assert.Equal(
DashboardRunStore
.SchemaVersion + 1, updatedMetadata.RootElement.GetProperty("SchemaVersion").GetInt32());
834
using (
var
incompatibleRunStore = CreateRunStore(
836
new FixedTimeProvider(startedAt.AddDays(-
DashboardRunStore
.MaxRuns))))
845
metadata["SchemaVersion"] =
DashboardRunStore
.SchemaVersion - 1;
848
foreach (var index in Enumerable.Range(1,
DashboardRunStore
.MaxRuns - 1))
850
using
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(-index)));
854
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt));
862
Assert.Equal(
DashboardRunStore
.MaxRuns, Directory.GetDirectories(runsDirectory).Length);
871
using
var
runStore = CreateRunStore(CreateOptions(workspace));
883
using
var
runStore = CreateRunStore(CreateOptions(workspace));
899
using (
var
historicalRunStore = CreateRunStore(options))
906
using
var
activeRunStore = CreateRunStore(options);
909
using
var
currentRunStore = CreateRunStore(options);
929
foreach (var index in Enumerable.Range(1,
DashboardRunStore
.MaxRuns))
931
using
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(-index)));
936
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt));
940
Assert.Equal(
DashboardRunStore
.MaxRuns, Directory.GetDirectories(runsDirectory).Length);
952
var runsDirectory =
DashboardRunStore
.GetRunsDirectory(workspace.Path);
962
using
var
runStore = CreateRunStore(options, new FixedTimeProvider(now));
967
Assert.True(File.Exists(
DashboardRunStore
.GetRunLockPath(runStore.CurrentWorkingDirectory)));
978
foreach (var index in Enumerable.Range(0,
DashboardRunStore
.MaxRuns - activeRunCount))
980
using
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMilliseconds(index)));
984
var activeRunStores = new List<
DashboardRunStore
>();
985
foreach (var index in Enumerable.Range(
DashboardRunStore
.MaxRuns - activeRunCount, activeRunCount))
987
var
activeRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMilliseconds(index)));
994
using
var
currentRunStore = CreateRunStore(
996
new FixedTimeProvider(startedAt.AddMilliseconds(
DashboardRunStore
.MaxRuns)));
1001
foreach (
var
activeRunStore in activeRunStores)
1010
Assert.Equal(
DashboardRunStore
.MaxRuns, runs.Count);
1011
Assert.Equal(
DashboardRunStore
.MaxRuns - activeRunCount, runs.Count(run => run.IsSelectable));
1028
using (
var
runStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(runIndex++))))
1034
using
var
pinningRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(runIndex++)));
1045
for (var index = 0; index <
DashboardRunStore
.MaxRuns - 1; index++)
1047
using
var
runStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(runIndex++)));
1051
using
var
finalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(runIndex)));
1059
Assert.Equal(
DashboardRunStore
.MaxRuns - 1, runs.Count(run => !run.IsCurrent && !run.IsPinned));
1071
foreach (var index in Enumerable.Range(1,
DashboardRunStore
.MaxRuns - 1))
1073
using
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(-index)));
1077
using
var
activeRunStore = CreateRunStore(
1079
new FixedTimeProvider(startedAt.AddDays(-
DashboardRunStore
.MaxRuns)));
1082
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt));
1087
Assert.Equal(
DashboardRunStore
.MaxRuns + 1, Directory.GetDirectories(runsDirectory).Length);
1099
using (
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt)))
1107
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddMilliseconds(1)));
1113
foreach (var index in Enumerable.Range(1,
DashboardRunStore
.MaxRuns - 2))
1115
using
var
additionalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(index)));
1120
using
var
pruningRunStore = new DashboardRunStore(
1122
NullLogger<
DashboardRunStore
>.Instance,
1131
using
var
nextPruningRunStore = new DashboardRunStore(
1133
NullLogger<
DashboardRunStore
>.Instance,
1148
using (
var
historicalRunStore = CreateRunStore(options))
1155
using
var
currentRunStore = CreateRunStore(options);
1198
using (
var
historicalRunStore = CreateRunStore(options))
1205
using
var
currentRunStore = CreateRunStore(options);
1228
foreach (var index in Enumerable.Range(1,
DashboardRunStore
.MaxRuns))
1230
using
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(startedAt.AddDays(-index)));
1237
var logger = loggerFactory.CreateLogger<
DashboardRunStore
>();
1240
using
var
currentRunStore = new DashboardRunStore(
1249
Assert.Equal(typeof(
DashboardRunStore
).FullName, warning.LoggerName);
1264
using (
var
malformedRunStore = CreateRunStore(options))
1276
using
var
currentRunStore = CreateRunStore(options);
1308
using
var
currentRunStore = CreateRunStore(options);
1311
var historicalDatabasePath = Path.Combine(historicalDirectory,
DashboardRunStore
.DatabaseFileName);
1317
var malformedDatabasePath = Path.Combine(malformedDirectory,
DashboardRunStore
.DatabaseFileName);
1343
DatabasePath = Path.Combine(workspace.Path, "unavailable",
DashboardRunStore
.DatabaseFileName),
1410
using (
var
historicalRunStore = CreateRunStore(options))
1440
using
var
currentRunStore = CreateRunStore(options);
1519
using
var
currentRunStore = CreateRunStore(options);
1539
using
var
currentRunStore = CreateRunStore(options);
1544
SchemaVersion =
DashboardRunStore
.SchemaVersion + 1,
1545
DatabasePath = Path.Combine(workspace.Path, "incompatible",
DashboardRunStore
.DatabaseFileName),
1580
using (
var
historicalRunStore = CreateRunStore(options, new FixedTimeProvider(historicalRunTime)))
1585
using
var
currentRunStore = CreateRunStore(options, new FixedTimeProvider(historicalRunTime.AddMilliseconds(1)));
1634
private static async Task InitializeAndPublishRunAsync(
DashboardRunStore
runStore)
1643
private static async Task InitializeAndPublishRunWithoutPruningAsync(
DashboardRunStore
runStore)
1660
private static
DashboardRunStore
CreateRunStore(IOptions<DashboardOptions> options, TimeProvider? timeProvider = null)
1662
return new DashboardRunStore(options, NullLogger<
DashboardRunStore
>.Instance, timeProvider ?? TimeProvider.System);
1683
DashboardRunStore
.GetRunLockPath(runDirectory),
Shared\TestDashboardDataSource.cs (1)
47
[new("current",
DashboardRunStore
.SchemaVersion, DateTimeOffset.UnixEpoch, null, false, "TestApp", databasePath ?? string.Empty, IsCurrent: true)])