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