From bd5018e1a4712c19729fb26a17e03e4f93969e8f Mon Sep 17 00:00:00 2001 From: Takashi Uesaka Date: Fri, 13 Feb 2026 11:17:49 +0900 Subject: [PATCH 1/2] Fix outdated Japnaese doc --- .../docs/ja/testing/accessing-resources.mdx | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/content/docs/ja/testing/accessing-resources.mdx b/src/frontend/src/content/docs/ja/testing/accessing-resources.mdx index ecdba2ef..98e9260d 100644 --- a/src/frontend/src/content/docs/ja/testing/accessing-resources.mdx +++ b/src/frontend/src/content/docs/ja/testing/accessing-resources.mdx @@ -20,7 +20,9 @@ HTTP リソースへアクセスするには、`HttpClient` を使用してリ Aspire 9 以降では、依存するリソースが利用可能になるまで待機する仕組みが([正常性チェック](/ja/fundamentals/health-checks/) メカニズムを通じて)サポートされています。これは、リソースへアクセスする前に、そのリソースが利用可能であることを確認したいテストにおいて有用です。`ResourceNotificationService` クラスには、指定した名前のリソースが利用可能になるまで待機するための `WaitForResourceAsync` メソッドが用意されています。このメソッドは、リソース名と期待するリソースの状態をパラメーターとして受け取り、リソースが利用可能になった時点で完了する `Task` を返します。`ResourceNotificationService` には、次の例のように `app.ResourceNotifications` を通じてアクセスできます。 ```csharp @@ -42,3 +44,25 @@ await app.ResourceNotifications.WaitForResourceHealthyAsync( ``` このリソース通知パターンを利用することで、テスト実行前にリソースが確実に利用可能であることを保証でき、リソースの準備が整っていないことによるテスト失敗を防ぐことができます。 + +## Start & Stop + +場合によっては、最初は起動されていないリソースを手動で開始したいことがあります。たとえば、そのリソースが `WithExplicitStart` によって作成された場合などです。 + +```csharp +using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30)); +await app.ResourceCommands.ExecuteCommandAsync( + "webfrontend", + KnownResourceCommands.StartCommand, + cts.Token); +``` + +また、特定のリソースが停止したときにアプリケーションが適切に耐障害性を発揮できるか確認するため、リソースを手動で停止したい場合もあります。 + +```csharp +using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30)); +await app.ResourceCommands.ExecuteCommandAsync( + "webfrontend", + KnownResourceCommands.StopCommand, + cts.Token); +``` From 91781472ae728ee78bb7d59b52a9200d0f28b33d Mon Sep 17 00:00:00 2001 From: takashiuesaka <61622933+takashiuesaka@users.noreply.github.com> Date: Fri, 13 Feb 2026 11:22:04 +0900 Subject: [PATCH 2/2] Update src/frontend/src/content/docs/ja/testing/accessing-resources.mdx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../src/content/docs/ja/testing/accessing-resources.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/content/docs/ja/testing/accessing-resources.mdx b/src/frontend/src/content/docs/ja/testing/accessing-resources.mdx index 98e9260d..77ee35f8 100644 --- a/src/frontend/src/content/docs/ja/testing/accessing-resources.mdx +++ b/src/frontend/src/content/docs/ja/testing/accessing-resources.mdx @@ -45,7 +45,7 @@ await app.ResourceNotifications.WaitForResourceHealthyAsync( このリソース通知パターンを利用することで、テスト実行前にリソースが確実に利用可能であることを保証でき、リソースの準備が整っていないことによるテスト失敗を防ぐことができます。 -## Start & Stop +## 開始と停止 場合によっては、最初は起動されていないリソースを手動で開始したいことがあります。たとえば、そのリソースが `WithExplicitStart` によって作成された場合などです。