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