Consolidate boilerplate in AKS deployment E2E tests
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
## Context
From [PR #16394 review feedback](https://github.com/microsoft/aspire/pull/16394#pullrequestreview-4168730441) by @JamesNK:
> Across the 5 "aspire deploy" AKS test files (4 new + existing `AksBlazorRedisDeploymentTests`), roughly **67% of each file is copy-pasted boilerplate** — prerequisites checks, workspace/terminal setup, AKS credential retrieval, pod waiting, port-forward + curl retry loops, catch/finally/reporting, and the `TriggerCleanupResourceGroup` private method (duplicated in 4 files with 2 inconsistent variants).
## Consolidation opportunities
1. **Shared AKS/kubectl helpers in `Hex1bAutomatorTestHelpers`** — candidates:
- `GetAksCredentialsAsync(resourceGroupName)` — 4 identical copies
- `WaitForAllPodsReadyAsync()` — 4 identical copies
- `DiscoverNamespaceAsync(serviceName)` — 4 near-identical copies
- `VerifyEndpointViaPortForwardAsync(serviceName, port, path)` — 7 copies of the curl retry loop across different endpoints
2. **Unified `TriggerCleanupResourceGroup`** in `DeploymentE2ETestHelpers` — currently ~175 lines across 7 files doing the same `az group delete` call, with two inconsistent implementations (fire-and-forget vs. async `WaitForExitAsync`).
3. **Base class or shared runner for scaffolding** — the prerequisites check, CTS/timeout wrapper, workspace creation, try/catch/finally with `DeploymentReporter` calls are verbatim identical in every file (~80 lines each). A `RunDeploymentTestAsync(Func<...> testBody)` pattern would let each test file focus on just its unique ~60-120 lines.
Contributor guide
Assessment
This issue has not been assessed yet.