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