117 references to KnownResourceStates
Aspire.Hosting (26)
ApplicationModel\CustomResourceSnapshot.cs (2)
116if (state != KnownResourceStates.Running) 134/// <param name="Text">The text for the state update. See <see cref="KnownResourceStates"/> for expected values.</param>
ApplicationModel\ResourceNotificationService.cs (19)
71/// Waits for a resource to reach the specified state. See <see cref="KnownResourceStates"/> for common states. 80/// <param name="targetState">The state to wait for the resource to transition to. See <see cref="KnownResourceStates"/> for common states.</param> 87string[] targetStates = !string.IsNullOrEmpty(targetState) ? [targetState] : [KnownResourceStates.Running]; 92/// Waits for a resource to reach one of the specified states. See <see cref="KnownResourceStates"/> for common states. 101/// <param name="targetStates">The set of states to wait for the resource to transition to one of. See <see cref="KnownResourceStates"/> for common states.</param> 126resourceLogger.LogInformation("Waiting for resource '{Name}' to enter the '{State}' state.", dependency.Name, KnownResourceStates.Running); 128await PublishUpdateAsync(resource, s => s with { State = KnownResourceStates.Waiting }).ConfigureAwait(false); 132if (snapshot.State?.Text == KnownResourceStates.FailedToStart) 141else if (snapshot.State!.Text == KnownResourceStates.Finished || snapshot.State!.Text == KnownResourceStates.Exited) 165snapshot.State?.Text == KnownResourceStates.Running || 166snapshot.State?.Text == KnownResourceStates.Finished || 167snapshot.State?.Text == KnownResourceStates.Exited || 168snapshot.State?.Text == KnownResourceStates.FailedToStart; 196await PublishUpdateAsync(resource, s => s with { State = KnownResourceStates.Waiting }).ConfigureAwait(false); 200if (snapshot.State?.Text == KnownResourceStates.FailedToStart) 209else if ((snapshot.State!.Text == KnownResourceStates.Finished || snapshot.State!.Text == KnownResourceStates.Exited) && snapshot.ExitCode is not null && snapshot.ExitCode != exitCode) 227KnownResourceStates.TerminalStates.Contains(snapshot.State?.Text) ||
Dashboard\DashboardLifecycleHook.cs (1)
153State = configuration.GetBool("DOTNET_ASPIRE_SHOW_DASHBOARD_RESOURCES") is true ? null : KnownResourceStates.Hidden
Dcp\ApplicationExecutor.cs (2)
615var state = container.AppModelInitialState == KnownResourceStates.Hidden ? KnownResourceStates.Hidden : container.Status?.State;
Health\ResourceHealthCheckService.cs (1)
30if (!resourcesStartedMonitoring.Contains(resourceEvent.Resource.Name) && resourceEvent.Snapshot.State?.Text == KnownResourceStates.Running)
ParameterResourceBuilderExtensions.cs (1)
167State = KnownResourceStates.Hidden,
Aspire.Hosting.Azure.Tests (9)
AzureCosmosDBEmulatorFunctionalTests.cs (3)
48await rns.WaitForResourceAsync(resource.Resource.Name, KnownResourceStates.Running, cts.Token); 50await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Waiting, cts.Token); 56await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Running, cts.Token);
AzureEventHubsExtensionsTests.cs (3)
49await rns.WaitForResourceAsync(resource.Resource.Name, KnownResourceStates.Running, cts.Token); 51await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Waiting, cts.Token); 57await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Running, cts.Token);
AzureStorageEmulatorFunctionalTests.cs (3)
50await rns.WaitForResourceAsync(storage.Resource.Name, KnownResourceStates.Running, cts.Token); 52await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Waiting, cts.Token); 60await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Running, cts.Token);
Aspire.Hosting.Dapr (2)
IDistributedApplicationBuilderExtensions.cs (1)
52State = KnownResourceStates.Hidden
IDistributedApplicationComponentBuilderExtensions.cs (1)
62State = KnownResourceStates.Hidden
Aspire.Hosting.Elasticsearch.Tests (3)
ElasticsearchFunctionalTests.cs (3)
231await rns.WaitForResourceAsync(resource.Resource.Name, KnownResourceStates.Running, cts.Token); 233await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Waiting, cts.Token); 239await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Running, cts.Token);
Aspire.Hosting.Garnet.Tests (3)
GarnetFunctionalTests.cs (3)
44await rns.WaitForResourceAsync(resource.Resource.Name, KnownResourceStates.Running, cts.Token); 46await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Waiting, cts.Token); 52await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Running, cts.Token);
Aspire.Hosting.Kafka.Tests (3)
KafkaFunctionalTests.cs (3)
45await rns.WaitForResourceAsync(resource.Resource.Name, KnownResourceStates.Running, cts.Token); 47await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Waiting, cts.Token); 53await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Running, cts.Token);
Aspire.Hosting.MongoDB.Tests (3)
MongoDbFunctionalTests.cs (3)
56await rns.WaitForResourceAsync(resource.Resource.Name, KnownResourceStates.Running, cts.Token); 58await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Waiting, cts.Token); 64await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Running, cts.Token);
Aspire.Hosting.MySql.Tests (3)
MySqlFunctionalTests.cs (3)
52await rns.WaitForResourceAsync(resource.Resource.Name, KnownResourceStates.Running, cts.Token); 54await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Waiting, cts.Token); 60await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Running, cts.Token);
Aspire.Hosting.Nats.Tests (3)
NatsFunctionalTests.cs (3)
347await rns.WaitForResourceAsync(resource.Resource.Name, KnownResourceStates.Running, cts.Token); 349await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Waiting, cts.Token); 355await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Running, cts.Token);
Aspire.Hosting.Oracle.Tests (3)
OracleFunctionalTests.cs (3)
375await rns.WaitForResourceAsync(resource.Resource.Name, KnownResourceStates.Running, cts.Token); 377await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Waiting, cts.Token); 383await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Running, cts.Token);
Aspire.Hosting.PostgreSQL.Tests (3)
PostgresFunctionalTests.cs (3)
56await rns.WaitForResourceAsync(postgres.Resource.Name, KnownResourceStates.Running, cts.Token); 59await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Waiting, cts.Token); 68await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Running, cts.Token);
Aspire.Hosting.Qdrant.Tests (3)
QdrantFunctionalTests.cs (3)
247await rns.WaitForResourceAsync(resource.Resource.Name, KnownResourceStates.Running, cts.Token); 249await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Waiting, cts.Token); 255await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Running, cts.Token);
Aspire.Hosting.RabbitMQ.Tests (3)
RabbitMQFunctionalTests.cs (3)
46await rns.WaitForResourceAsync(resource.Resource.Name, KnownResourceStates.Running, cts.Token); 48await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Waiting, cts.Token); 54await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Running, cts.Token);
Aspire.Hosting.Redis.Tests (3)
RedisFunctionalTests.cs (3)
50await rns.WaitForResourceAsync(resource.Resource.Name, KnownResourceStates.Running, cts.Token); 52await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Waiting, cts.Token); 58await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Running, cts.Token);
Aspire.Hosting.SqlServer.Tests (3)
SqlServerFunctionalTests.cs (3)
46await rns.WaitForResourceAsync(resource.Resource.Name, KnownResourceStates.Running, cts.Token); 48await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Waiting, cts.Token); 54await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Running, cts.Token);
Aspire.Hosting.Tests (36)
Codespaces\CodespacesUrlRewriterTests.cs (1)
79State = KnownResourceStates.Running,
Health\ResourceHealthCheckServiceTests.cs (16)
31State = new ResourceStateSnapshot(KnownResourceStates.Starting, null) 34var startingEvent = await rns.WaitForResourceAsync("resource", e => e.Snapshot.State?.Text == KnownResourceStates.Starting).DefaultTimeout(); 39State = new ResourceStateSnapshot(KnownResourceStates.Running, null) 65State = new ResourceStateSnapshot(KnownResourceStates.Starting, null) 68var startingEvent = await rns.WaitForResourceAsync("resource", e => e.Snapshot.State?.Text == KnownResourceStates.Starting).DefaultTimeout(); 73State = new ResourceStateSnapshot(KnownResourceStates.Running, null) 76var runningEvent = await rns.WaitForResourceAsync("resource", e => e.Snapshot.State?.Text == KnownResourceStates.Running).DefaultTimeout(); 110State = KnownResourceStates.Running 157State = KnownResourceStates.Running 159await rns.WaitForResourceAsync(resource.Resource.Name, KnownResourceStates.Running, abortTokenSource.Token).DefaultTimeout(); 194State = new ResourceStateSnapshot(KnownResourceStates.Running, null) 226State = new ResourceStateSnapshot(KnownResourceStates.Running, null) 290State = new ResourceStateSnapshot(KnownResourceStates.Running, null) 335State = new ResourceStateSnapshot(KnownResourceStates.Running, null) 388State = new ResourceStateSnapshot(KnownResourceStates.Running, null) 396State = new ResourceStateSnapshot(KnownResourceStates.Running, null)
HealthCheckTests.cs (3)
88await rns.WaitForResourceAsync(resource.Resource.Name, KnownResourceStates.Running).DefaultTimeout(TestConstants.LongTimeoutDuration); 90await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Waiting).DefaultTimeout(TestConstants.LongTimeoutDuration); 96await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Running).DefaultTimeout(TestConstants.LongTimeoutDuration);
ResourceNotificationTests.cs (1)
211await notificationService.PublishUpdateAsync(resource1, snapshot => snapshot with { State = KnownResourceStates.Running }).DefaultTimeout();
WaitForTests.cs (15)
32await rns.WaitForResourceAsync(throwingResource.Resource.Name, KnownResourceStates.FailedToStart, abortCts.Token); 33await rns.WaitForResourceAsync(dependingContainerResource.Resource.Name, KnownResourceStates.FailedToStart, abortCts.Token); 34await rns.WaitForResourceAsync(dependingExecutableResource.Resource.Name, KnownResourceStates.FailedToStart, abortCts.Token); 115State = KnownResourceStates.Running 149await rns.WaitForResourceAsync(nginx.Resource.Name, KnownResourceStates.Waiting, waitingStateCts.Token); 156State = KnownResourceStates.Finished, 164await rns.WaitForResourceAsync(nginx.Resource.Name, KnownResourceStates.Running, runningStateCts.Token); 204State = KnownResourceStates.Finished, 212await rns.WaitForResourceAsync(nginx.Resource.Name, KnownResourceStates.FailedToStart, runningStateCts.Token); 245await rns.WaitForResourceAsync(nginx.Resource.Name, KnownResourceStates.Waiting, waitingStateCts.Token); 252State = KnownResourceStates.Finished, 259await rns.WaitForResourceAsync(nginx.Resource.Name, KnownResourceStates.FailedToStart, runningStateCts.Token); 328await rns.WaitForResourceAsync(nginx.Resource.Name, KnownResourceStates.Waiting, waitingStateCts.Token); 333State = KnownResourceStates.Finished 336await rns.WaitForResourceAsync(nginx.Resource.Name, KnownResourceStates.Running, waitingStateCts.Token);
Aspire.Hosting.Valkey.Tests (3)
ValkeyFunctionalTests.cs (3)
221await rns.WaitForResourceAsync(resource.Resource.Name, KnownResourceStates.Running, cts.Token); 223await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Waiting, cts.Token); 229await rns.WaitForResourceAsync(dependentResource.Resource.Name, KnownResourceStates.Running, cts.Token);
Aspire.Playground.Tests (5)
Infrastructure\DistributedApplicationExtensions.cs (5)
87targetState ??= KnownResourceStates.Running; 97/// If <paramref name="targetStates"/> is null, the default states are <see cref="KnownResourceStates.Running"/> and <see cref="KnownResourceStates.Hidden"/>. 101targetStates ??= [KnownResourceStates.Running, KnownResourceStates.Hidden];