You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add Go AppHost CLI end-to-end tests and a PolyglotGo image - #21189
Adds CLI end-to-end coverage for Go AppHosts that mirrors what TypeScript has, plus a PolyglotGo image variant that carries the Go toolchain for those tests.
empty Go AppHost from the template picker and from the direct template command
GoCodegenValidationTests
TypeScriptCodegenValidationTests
restore generates the SDK files, and regenerates them when the SDK on disk is stale (the baseline is put back after an aspire add)
GoPolyglotApphostDirectoryTests
TypeScriptPolyglotApphostDirectoryTests
stop a running Go AppHost through --apphost <dir>
GoSecretAppHostTests
SecretTypeScriptAppHostTests
secret create, read, update, delete and environment-scoped secrets. get and list output is checked with grep, and the JSON listing after the delete must hold exactly the remaining secret
GoPublishTests (3)
TypeScriptPublishTests
Docker Compose publish with a service callback, the default output directory, and the Dockerfile generated for AddGoApp
GoKubernetesDeployTests
KubernetesDeployTypeScriptTests
Go AppHost deployed to KinD with Helm, using the Helm defaults (namespace default, chart version 0.1.0); the api and cache pods must become Ready
Image and CI plumbing
tests/Shared/Docker/Dockerfile.e2e-polyglot-go, the image build, warm and load workflows, eng/scripts/load-cli-e2e-images.sh (--require-go), reproduce-flaky-tests.yml and docs/ci/cli-e2e-images.md get a PolyglotGo variant next to PolyglotJava.
The Go layer installs docker-buildx. aspire deploy builds the api image with docker buildx build and throws when buildx is missing (DockerContainerRuntime), while the shared polyglot base installs docker.io with --no-install-recommends, which leaves buildx out. The DotNet image (Dockerfile.e2e) installs it the same way. kind, helm and kubectl are installed by the test at runtime.
run-tests.yml downloads and loads that image for split jobs whose short name contains -Go. The classes are all named Go* for that reason: matching a bare go would also select names such as MongoDB and Config.
The three new actions/* pins reuse SHAs that are already pinned elsewhere in the repository, so no allow-list change is needed.
Aspire.Hosting.Go and Aspire.Hosting.CodeGeneration.Go join the CLI E2E runtime-package consumers in eng/github-ci/test-trigger-map.yml, next to the Java and TypeScript code generation packages. Two InlineData rows in SelectTestsAcceptanceTests cover the routing.
Helpers.AppHostLanguagePromptSelection.Go, AspireTemplate.GoStarter and GoEmptyAppHost, AspireNewGoEmptyAppHostAsync, and EnableExperimentalGoSupportAsync. The last is the only place the E2E projects write features:experimentalPolyglotGo, so removing the flag (#21106, in draft #21183) deletes one helper and its ten call sites instead of reworking each test.
The pickers type the entry's name (Go API for the starter, Go at the language prompt) instead of counting Down presses, and each step waits for the expected selection text before pressing Enter, so a wrong match fails with a clear timeout instead of choosing another entry. The PolyglotGo image has no .NET SDK, which drops the two C# starters from the template list: a Down count that is right with an SDK clamps onto Empty AppHost without one, which is how the first CI run failed. The search prompt jumps to the first entry whose text contains what was typed, ignoring case, so the selection no longer depends on what else a picker lists.
The first CI run (head d24eb6c14a) passed the CLI E2E image build (including the docker-buildx line), GoCodegenValidationTests, GoEmptyAppHostTemplateTests (2 tests), GoPolyglotApphostDirectoryTests, GoSecretAppHostTests and 2 of the 3 GoPublishTests: 7 of the 10 tests. The other three (GoStarterTemplateTests, GoPublishTests.PublishGoStarterGeneratesGoAppDockerfile and GoKubernetesDeployTests) failed for one reason, the 4 Down presses to the Go starter.
On c788f994e7, which replaces the Down presses with type-ahead, makes the Kubernetes AppHost callback-free and asserts the full secrets listing, all seven classes passed: 10 of 10 tests, including GoStarterTemplateTests (start, check that cache and api exist, stop) and GoKubernetesDeployTests. No check on that head is failing on its latest attempt (447 succeeded, 11 skipped).
The three commits after it (dad6c38807, 5506d5944a and 962ebc83a4) tighten three assertions that could pass without proving anything (see the findings below). On the last of them, 962ebc83a4, all seven classes passed again on ubuntu-latest: 10 of 10 tests, none skipped. That includes the stale-SDK baseline and restore flow in GoCodegenValidationTests and, in GoKubernetesDeployTests, a kubectl wait --for=condition=Ready that exited 0 for both the api and cache pods on a real kind cluster.
Three other jobs failed on the first attempt of that run and passed on a rerun of the same commit. This PR changes nothing under src/ or extension/.
Hosting.Azure (AzureFunctionsTests.AddAzureFunctionsProject_WorksWithMultipleProjects) failed on attempts 1 and 2 and passed on attempt 3.
KubernetesDeployWithMongoDBTests failed on attempt 1, on a runner with kernel 7.0.0-1017-azure, and passed on attempt 2.
The java-apphost-debug-startup-timeout VS Code extension E2E failed on attempt 1 and passed on attempt 2.
The latest attempt of every check on 962ebc83a4 is green: 447 succeeded, 11 skipped.
Findings that shaped the tests
The Go starter's api/go.mod ships without a go.sum, and WithModTidy only runs in run mode, so building the starter's container fails with missing go.sum entry (reproduced with a scratch go build). GoPublishTests asserts the generated Dockerfile only, and GoKubernetesDeployTests runs go mod tidy in api/ before deploying. The product fix is not in this PR (item 1 of Go AppHost: starter go.sum and E2E fixture follow-ups #21206).
Three checks are written so that doing nothing cannot pass:
secret get and secret list are piped through grep and an echo marker is awaited. The key and value are already on screen from the typed secret set command, so waiting for that text alone always succeeds.
The codegen validation test copies the baseline aspire.go and .codegen-hash aside, runs aspire add Aspire.Hosting.SqlServer (which regenerates the SDK itself), puts the baseline back, checks that it is stale, and only then runs aspire restore. A restore that does nothing fails the test.
The Kubernetes test runs kubectl wait --for=condition=Ready for the api and cache pods, selected by app.kubernetes.io/component. kubectl get pods exits 0 on an empty namespace and Helm's --wait only waits for workloads that are in the chart, whereas kubectl wait exits 1 with no matching resources found when nothing matches.
Not in this PR
An HTTP probe against the Go starter's API (item 6 of Go AppHost: starter go.sum and E2E fixture follow-ups #21206). GoStarterTemplateTests starts the AppHost and checks that cache and api exist, which does not show that the API serves requests. No existing helper reads a resource URL without jq, which the PolyglotGo image does not carry, and the API probably needs host networking to reach the Redis container (an inference, not run).
The same weaknesses in the TypeScript and Java tests (Strengthen weak restore and pod checks in CLI E2E tests #21210). TypeScriptCodegenValidationTests and JavaCodegenValidationTests run aspire restore right after an aspire add and compare the codegen hash with the one from before the add, and KubernetesDeployTypeScriptTests checks kubectl get pods, which exits 0 on an empty namespace.
An ACA deployment test for the Go starter. A new class in Aspire.Deployment.EndToEnd.Tests would run nightly against the real Azure subscription and cannot be verified from here.
Brownfield aspire init in an existing Go repository (Go AppHost parity gaps vs TypeScript #21201). Reading ScaffoldingService suggests an existing go.mod conflicts, but no test was run.
Go toolchain missing or too old diagnostics, which need an image without Go.
Windows, repo-local SDK, head 962ebc83a4 on top of upstream/main230d5ac2a8. main has since gained one unrelated commit that touches only KubernetesDeployWithCertManagerTests.cs, so no rebase was needed. Rows 1 to 3 ran on this head. Rows 4 to 6 ran on d24eb6c14a: the later commits change only E2E test sources and the shared Hex1b helpers, and Infrastructure.Tests links neither (it links TemporaryWorkspace.cs, WindowsTrayTestPayload.cs and PathLookupHelper.cs from the shared directories) and does not read them, so those rows are unaffected.
dotnet test --project tests\Infrastructure.Tests\Infrastructure.Tests.csproj --no-restore --no-launch-profile -- --filter-method "*.RealMapRepresentativeCliE2eRuntimeConsumerSelectsCliE2e"
4 passed, 0 failed
dotnet test --project tests\Infrastructure.Tests\Infrastructure.Tests.csproj --no-restore --no-launch-profile -- --filter-namespace "Infrastructure.Tests.TestTriggerMap"
351 total, 329 passed, 22 failed (exit 2)
The 22 TestTriggerMap failures are pre-existing and Windows-only: 5 SelectTestsCliTests and 17 PrComparisonBaseTests data rows. A control run on a clean 82c3b01ce1 (the main tip before this rebase) gave 349 total, 327 passed and the same 22 failures, caused by bash receiving mangled Windows paths and an UnauthorizedAccessException deleting a temporary git repository. This branch adds the 2 passing rows.
The shell fragments of the three newest commits were also run outside CI. 27 cases ran against stub aspire and kubectl executables, with the fragments extracted from the C# sources so the dry run cannot drift from the tests: the grep checks accept the exact value and reject a wrong, empty or longer one, the baseline snapshot and put-back restore the stale SDK, and the kubectl wait command covers exactly api and cache. Real kubectl v1.36.1 against a throwaway fake API server confirmed the difference the Kubernetes test relies on: in an empty namespace kubectl get pods --no-headers exits 0 while kubectl wait --for=condition=Ready exits 1 with no matching resources found, and with only an api pod Ready the wait exits 0 for api and 1 for cache.
Not run locally: all seven new E2E classes. They need Docker (and kind for the Kubernetes test), the CLI archive and the new PolyglotGo image, so CI is their only execution. All ten passed on c788f994e7 and again on 962ebc83a4, so the snapshot, put-back and restore flow in GoCodegenValidationTests and the kubectl wait check on a real kind cluster in GoKubernetesDeployTests have run end to end in CI. A crash-looping api or an image pull failure fails the Kubernetes test by design.
Checklist
Is this feature complete?
Yes. Ready to ship.
No. Follow-up changes expected.
Are you including unit tests for the changes and scenario tests if relevant?
Yes
No
Did you add public API?
Yes
If yes, did you have an API Review for it?
Yes
No
Did you add <remarks /> and <code /> elements on your triple slash comments?
Yes
No
No
Does the change make any security assumptions or guarantees?
Yes
If yes, have you done a threat model and had a security review?
Go AppHost E2E tests need the Go toolchain on top of the shared polyglot base image, the same way Java tests need a JDK. Add Dockerfile.e2e-polyglot-go, the PolyglotGo DockerfileVariant and the build, upload, download and load plumbing for the prebuilt image. The image is only downloaded for split jobs whose class name starts with Go, so other jobs do not transfer the extra tarball.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
Adds AspireTemplate.GoStarter and GoEmptyAppHost with their prompt sequences, a direct aspire-go-empty helper, and a single EnableExperimentalGoSupportAsync helper that owns the experimentalPolyglotGo gate so dropping the flag is a one-line change.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
Covers the Go starter (aspire new, go build, start, stop), the Go empty AppHost from both the template picker and the direct template command, and SDK regeneration on aspire add and aspire restore. They run on the PolyglotGo image and enable the experimentalPolyglotGo gate through the single helper.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
Mirrors the TypeScript scenarios: stopping a Go AppHost by directory, secret CRUD with environment scopes, Docker Compose publish (explicit and default output path, service callback, generated Go app Dockerfile) and a KinD plus Helm deploy of the Go starter. The Kubernetes test runs go mod tidy in the starter API first because the template ships no go.sum and the container build needs one.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
The Go CLI E2E tests restore Aspire.Hosting.Go and Aspire.Hosting.CodeGeneration.Go from the repo-built package source at runtime, an edge the ProjectGraph cannot see. List both packages with the other CLI E2E runtime consumers, and cover them in the representative runtime-consumer theory.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
The PolyglotGo image has no .NET SDK, so the template list omits the two C# starters and a Down count that is right with an SDK clamps onto Empty AppHost. Type the entry's name instead (Go API for the starter, Go for the language prompt). The prompt jumps to the first entry whose text contains what was typed, and each step still waits for the expected selection before pressing Enter.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
A Configure func inside the generated Go options struct panics when the options are merged (#18080), so the AppHost drops the WithHelm callback and the deploy uses the Helm defaults: namespace default and chart version 0.1.0. The namespace and chart version parameters can return once that merge is fixed.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
Deleting a secret and then waiting for another secret's name on screen cannot show the deleted one is gone. List the secrets as JSON, which is keyed by secret name, and assert the complete collection.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
GuestAppHostProject.AddPackageAsync already calls BuildAndGenerateSdkAsync (src/Aspire.Cli/Projects/GuestAppHostProject.cs:1786–1795). The new AddSqlServer binding and hash therefore exist before this restore runs, so even a restore that does no generation passes. Reinstate the baseline SDK and hash after adding the package so restore must refresh stale output.
kubectl get pods succeeds even when the namespace has no pods, and this test never checks its output. Helm's --wait only waits for workloads present in the chart, so omitting api or cache can still pass. Require pods for both expected components to exist and become ready before cleanup.
This wait can match test-key-123 still on screen from the earlier secret set command. The success-prompt check only verifies the exit code, so a getter returning the wrong value with exit code 0 can pass. Validate the current command's output rather than searching the terminal's existing text.
The get and list steps waited for the secret value and key on screen, but both strings are part of the earlier secret set command lines that are still visible, so the waits passed even when the commands printed nothing and the numbered prompt only reported the exit code. Both steps now pipe the CLI output through grep, like the Staging and Production checks in the same test, so grep decides the exit status that the prompt reports.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
aspire add already regenerates the SDK, so by the time the second restore ran, aspire.go exposed AddSqlServer and .codegen-hash had changed, and the test passed even if restore did nothing. The test now copies the baseline aspire.go and .codegen-hash inside the container before aspire add and puts them back afterwards, so restore starts from a stale SDK. It also asserts the baseline hash file exists instead of treating a missing file as null.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
kubectl get pods succeeds on an empty namespace and Helm --wait only waits for workloads that are in the chart, so a chart missing api or cache still passed. Wait for Ready pods selected by app.kubernetes.io/component for api and cache instead; kubectl wait exits 1 with 'no matching resources found' when nothing matches.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
Follow-up to the Copilot review that listed three assertions in the Go E2E tests that could pass without proving anything. All three held up and are fixed in the last three commits:
Restore (5506d5944a): GoCodegenValidationTests puts a stale SDK back after aspire add and asserts that aspire restore regenerates it.
Secrets (dad6c38807): secret get and secret list output is checked with grep and an echo marker, because the typed secret set command line already contains the key and value.
Kubernetes (962ebc83a4): kubectl wait --for=condition=Ready for the api and cache pods, because kubectl get pods exits 0 on an empty namespace.
Checked locally: the E2E and Deployment E2E projects build, the shell fragments ran in 27 dry-run cases against stub aspire and kubectl, and real kubectl ran against a fake API server. Not run: the E2E classes themselves (they need Docker, kind and the PolyglotGo image), so CI on 962ebc83a4 is the first real run of these three. The description has the details.
The reason will be displayed to describe this comment to others. Learn more.
Thanks, David! This looks good to me. The PolyglotGo image follows the Java variant at every step (build with mirror retry, save/upload, load script, env-var contract, local fallback and unit tests). The trigger-map additions cover the new runtime consumers, and the earlier feedback on picker selection, the WithHelm callback and the delete check is addressed.
The inline comments are minor and can be small updates before merge or follow-ups.
One coordination note: #21183 removes the experimentalPolyglotGo flag. Whichever of the two PRs merges second needs to drop this PR's use of the flag, which is just EnableExperimentalGoSupportAsync and its call sites.
- Assert Go secret get/list output with RunCommandAsync instead of waiting for an
echoed marker that is already part of the typed command line. This also restores
the intended 30 second bound, which the following default-timeout prompt wait
had been silently replacing.
- Wait for the Go language picker to highlight "> Go" before pressing Enter in the
Go empty AppHost template helpers, matching the existing Go starter and
language-selection helpers.
- Note in the Go Dockerfile's DisableDockerDetector justification that the Go
toolchain image copied with COPY --from is registered through
polyglot-validation/Dockerfile.golang.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Triggered signal: pr_body_has_cli_flag_mention (evidence: PR body table mentions --apphost <dir> in a test description). The signal is a false positive: all changed files are under tests/**, .github/workflows/**, eng/**, or docs/ci/**. They add Go AppHost CLI E2E tests and a PolyglotGo test image. The PR adds no user-facing behavior and no new flag.
> [!IMPORTANT]
> **Merge last.** This PR depends on the other open Go AppHost PRs and
must land after them.
>
> - **Must land first**, because each adds references to the flag that
this PR has to delete: #21189 (E2E helper and call sites), #21195
(`SdkExportCommandTests`) and #21196 (`GoAppHostToolingCheck` and its
tests).
> - **Must land first**, because it edits the same hunk of
`DefaultLanguageDiscovery.cs` and this PR rebases onto it: #21191.
> - **Should land first**, because removing the flag turns Go on for
everyone and these fixes should ship before it: #21186, #21187, #21188,
#21193, #21194, #21197 and #21199.
## Description
Removes the `experimentalPolyglotGo` feature flag so Go AppHosts are
available by default, the same way TypeScript AppHosts are. With no
flag, **Empty (Go AppHost)** and **Starter App (Go API + Redis, Go
AppHost)** are offered by interactive and non-interactive `aspire new`,
and Go is offered by `aspire init` language selection and `--language
go`.
**This is the GA switch for the Go AppHost epic (#21115) and must merge
last**, after the other children have landed: #21108 (E2E, publish,
deploy), #21110 (support policy, API review, packaging), #21112 (docs
and samples) and #21114 (VS Code debugging). It was opened as a draft so
CI exercises the 52 Go fixtures without the flag. It is ready for review
now, but not for merging.
What changed:
- **CLI:** `KnownFeatures` drops the Go flag and
`DefaultLanguageDiscovery` no longer marks Go experimental.
`LanguageInfo.IsExperimental` is kept because Python, Java and Rust
still use it.
- **Leftover key:** a stale `experimentalPolyglotGo` in a user's
configuration is ignored with no warning, matching what happened to the
TypeScript flag when it was removed. `Features` only reads named keys,
and the extension schemas set `additionalProperties: false`, so VS Code
flags the stale key.
- **Extension schemas:** `aspire-config`, `aspire-global-settings` and
`aspire-settings` are regenerated with
`extension/scripts/generate-schema.js`. Only the 16-line Go block is
removed from each.
- **Fixtures and CI:** 52
`tests/PolyglotAppHosts/*/Go/aspire.config.json` files and
`.github/workflows/polyglot-validation/Dockerfile.golang` no longer set
the key.
- **Java E2E picker offsets:** Go is always listed now, so with only the
Java flag set the `aspire init` language picker is C#, TypeScript, Go,
Java, and Java needs 3 Down presses instead of 2. The first CI run on
this PR timed out waiting for `> Java` in `JavaPolyglotTests`,
`JavaCodegenValidationTests` and `JavaPolyglotApphostDirectoryTests`;
each now presses Down once more, with a comment stating the picker
order. The order comes from `DefaultLanguageDiscovery`,
`LanguageService` and `CliTemplateFactory`. TypeScript flows are
unaffected because TypeScript sorts before Go.
- **Tests:** `DefaultLanguageDiscoveryTests`, `NewCommandTests`,
`ConfigCommandTests`, `NewCommandTemplateConfigPersistenceTests` and
`InitCommandTests` now expect Go without the flag, with 6 new tests. One
of them, `GetAvailableLanguagesAsync_ListsLanguagesInPickerOrder`, pins
the picker order so a future ungated language fails a unit test before
it breaks a Docker E2E run.
- **Docs:** `docs/specs/polyglot-apphost.md`, the Go code generation
README and `playground/GoAppHost/apphost.go` no longer mention the flag.
Fixes#21106
## Validation
| Command | Result |
| --- | --- |
| `.\restore.cmd` | passed |
| `dotnet build
tests\Aspire.Cli.EndToEnd.Tests\Aspire.Cli.EndToEnd.Tests.csproj -m:2
--no-restore` | 0 warnings, 0 errors |
| `dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj
--no-launch-profile -- --filter-class "*.DefaultLanguageDiscoveryTests"
--filter-class "*.NewCommandTests" --filter-class "*.ConfigCommandTests"
--filter-class "*.NewCommandTemplateConfigPersistenceTests"
--filter-class "*.InitCommandTests" --filter-not-trait
"quarantined=true" --filter-not-trait "outerloop=true"` | 312 passed, 0
failed (run before the picker-order test was added) |
| `dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj
--no-launch-profile -- --filter-class "*.DefaultLanguageDiscoveryTests"
--filter-not-trait "quarantined=true" --filter-not-trait
"outerloop=true"` | 39 passed, 0 failed (38 existing plus the
picker-order test) |
| `node extension\scripts\generate-schema.js` | only the Go block was
removed from each schema |
| repository-wide search for `experimentalPolyglotGo` and its variants |
0 hits |
| JSON parse of the 53 fixtures and 3 schemas | all parse, none contain
the flag |
Run in PR CI instead of locally, all passing on `0e65752d44`: the three
Java E2E tests (`JavaPolyglotTests`, `JavaCodegenValidationTests` and
`JavaPolyglotApphostDirectoryTests`; they need Docker, so CI was the
first execution of the extra Down press), `Infrastructure.Tests` and the
VS Code extension unit and E2E jobs.
Not run: the VS Code new-project flow in an extension host
(`extension/src/commands/new.ts` just runs `aspire new`).
### Before merging
- [ ] Search again for `experimentalPolyglotGo`,
`KnownFeatures.ExperimentalPolyglotGo`,
`EnableExperimentalGoSupportAsync`, `features__experimentalPolyglotGo`
and `experimentalPolyglot:go`, because open Go branches add flag setup
of their own and this PR must merge after all of them. Today that covers
#21189 (the `EnableExperimentalGoSupportAsync` helper and its call sites
in every Go scenario), #21195 (`SdkExportCommandTests` sets
`KnownFeatures.ExperimentalPolyglotGo`) and #21196
(`GoAppHostToolingCheckTests` builds its language discovery with the
flag, including a `goEnabled: false` case that stops being meaningful,
and `GoAppHostToolingCheck` has a comment that describes the flag). Each
of them stops compiling or goes stale once the flag is removed, so
delete or rewrite them here.
- [ ] Rebase onto #21191, which adds `DefaultHostingPackages =
["Aspire.Hosting.Go"]` to Go's `LanguageInfo` in the same hunk of
`DefaultLanguageDiscovery.cs` (#21045). Keep that initializer and drop
`IsExperimental: true`.
- [ ] Drop the Go experimental notes in the aspire.dev API reference and
docs at the same time.
## Checklist
- Is this feature complete?
- [ ] Yes. Ready to ship.
- [x] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
- [x] Yes
- [ ] No
- Did you add public API?
- [ ] Yes
- If yes, did you have an API Review for it?
- [ ] Yes
- [ ] No
- Did you add `<remarks />` and `<code />` elements on your triple slash
comments?
- [ ] Yes
- [ ] No
- [x] No
- Does the change make any security assumptions or guarantees?
- [ ] Yes
- If yes, have you done a threat model and had a security review?
- [ ] Yes
- [ ] No
- [x] No
---------
Co-authored-by: David Pine <7679720+IEvangelist@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds CLI end-to-end coverage for Go AppHosts that mirrors what TypeScript has, plus a
PolyglotGoimage variant that carries the Go toolchain for those tests.Tests (
tests/Aspire.Cli.EndToEnd.Tests, 7 classes, 10 tests):GoStarterTemplateTestsTypeScriptStarterTemplateTestsaspire newGo starter, then start, wait and stopGoEmptyAppHostTemplateTests(2)TypeScriptEmptyAppHostTemplateTestsGoCodegenValidationTestsTypeScriptCodegenValidationTestsaspire add)GoPolyglotApphostDirectoryTestsTypeScriptPolyglotApphostDirectoryTests--apphost <dir>GoSecretAppHostTestsSecretTypeScriptAppHostTestsgetandlistoutput is checked withgrep, and the JSON listing after the delete must hold exactly the remaining secretGoPublishTests(3)TypeScriptPublishTestsAddGoAppGoKubernetesDeployTestsKubernetesDeployTypeScriptTestsdefault, chart version0.1.0); theapiandcachepods must become ReadyImage and CI plumbing
tests/Shared/Docker/Dockerfile.e2e-polyglot-go, the image build, warm and load workflows,eng/scripts/load-cli-e2e-images.sh(--require-go),reproduce-flaky-tests.ymlanddocs/ci/cli-e2e-images.mdget aPolyglotGovariant next toPolyglotJava.docker-buildx.aspire deploybuilds theapiimage withdocker buildx buildand throws when buildx is missing (DockerContainerRuntime), while the shared polyglot base installsdocker.iowith--no-install-recommends, which leaves buildx out. The DotNet image (Dockerfile.e2e) installs it the same way.kind,helmandkubectlare installed by the test at runtime.run-tests.ymldownloads and loads that image for split jobs whose short name contains-Go. The classes are all namedGo*for that reason: matching a baregowould also select names such asMongoDBandConfig.actions/*pins reuse SHAs that are already pinned elsewhere in the repository, so no allow-list change is needed.Aspire.Hosting.GoandAspire.Hosting.CodeGeneration.Gojoin the CLI E2E runtime-package consumers ineng/github-ci/test-trigger-map.yml, next to the Java and TypeScript code generation packages. TwoInlineDatarows inSelectTestsAcceptanceTestscover the routing.Helpers.
AppHostLanguagePromptSelection.Go,AspireTemplate.GoStarterandGoEmptyAppHost,AspireNewGoEmptyAppHostAsync, andEnableExperimentalGoSupportAsync. The last is the only place the E2E projects writefeatures:experimentalPolyglotGo, so removing the flag (#21106, in draft #21183) deletes one helper and its ten call sites instead of reworking each test.The pickers type the entry's name (
Go APIfor the starter,Goat the language prompt) instead of countingDownpresses, and each step waits for the expected selection text before pressing Enter, so a wrong match fails with a clear timeout instead of choosing another entry. ThePolyglotGoimage has no .NET SDK, which drops the two C# starters from the template list: aDowncount that is right with an SDK clamps ontoEmpty AppHostwithout one, which is how the first CI run failed. The search prompt jumps to the first entry whose text contains what was typed, ignoring case, so the selection no longer depends on what else a picker lists.Part of #21108.
CI status
The first CI run (head
d24eb6c14a) passed the CLI E2E image build (including thedocker-buildxline),GoCodegenValidationTests,GoEmptyAppHostTemplateTests(2 tests),GoPolyglotApphostDirectoryTests,GoSecretAppHostTestsand 2 of the 3GoPublishTests: 7 of the 10 tests. The other three (GoStarterTemplateTests,GoPublishTests.PublishGoStarterGeneratesGoAppDockerfileandGoKubernetesDeployTests) failed for one reason, the 4Downpresses to the Go starter.On
c788f994e7, which replaces theDownpresses with type-ahead, makes the Kubernetes AppHost callback-free and asserts the full secrets listing, all seven classes passed: 10 of 10 tests, includingGoStarterTemplateTests(start, check thatcacheandapiexist, stop) andGoKubernetesDeployTests. No check on that head is failing on its latest attempt (447 succeeded, 11 skipped).The three commits after it (
dad6c38807,5506d5944aand962ebc83a4) tighten three assertions that could pass without proving anything (see the findings below). On the last of them,962ebc83a4, all seven classes passed again onubuntu-latest: 10 of 10 tests, none skipped. That includes the stale-SDK baseline and restore flow inGoCodegenValidationTestsand, inGoKubernetesDeployTests, akubectl wait --for=condition=Readythat exited 0 for both theapiandcachepods on a real kind cluster.Three other jobs failed on the first attempt of that run and passed on a rerun of the same commit. This PR changes nothing under
src/orextension/.Hosting.Azure(AzureFunctionsTests.AddAzureFunctionsProject_WorksWithMultipleProjects) failed on attempts 1 and 2 and passed on attempt 3.KubernetesDeployWithMongoDBTestsfailed on attempt 1, on a runner with kernel7.0.0-1017-azure, and passed on attempt 2.java-apphost-debug-startup-timeoutVS Code extension E2E failed on attempt 1 and passed on attempt 2.The latest attempt of every check on
962ebc83a4is green: 447 succeeded, 11 skipped.Findings that shaped the tests
api/go.modships without ago.sum, andWithModTidyonly runs in run mode, so building the starter's container fails withmissing go.sum entry(reproduced with a scratchgo build).GoPublishTestsasserts the generated Dockerfile only, andGoKubernetesDeployTestsrunsgo mod tidyinapi/before deploying. The product fix is not in this PR (item 1 of Go AppHost: starter go.sum and E2E fixture follow-ups #21206).WithHelmcallback. In the generated Go SDK aConfigurefunc inside an options struct panics the options merge withunexpected end of JSON input(Go AppHost: AddManifest is unusable — Configure option panics on publish, and WithField can't express nested/dotted CRD fields #18080, fix in Fix Go AppHost panic on callback options and accept Go numbers in unions #21188), so the test uses the Helm defaults (namespacedefault, chart version0.1.0) and takes the namespace and chart-version parameters back once that fix lands (item 7 of Go AppHost: starter go.sum and E2E fixture follow-ups #21206). The deploy path itself (AddKubernetesEnvironment,AddContainerRegistry,aspire deploy) is unchanged, so the test is not marked[ActiveIssue]and the trigger map needs no new edge.secret getandsecret listare piped throughgrepand anechomarker is awaited. The key and value are already on screen from the typedsecret setcommand, so waiting for that text alone always succeeds.aspire.goand.codegen-hashaside, runsaspire add Aspire.Hosting.SqlServer(which regenerates the SDK itself), puts the baseline back, checks that it is stale, and only then runsaspire restore. A restore that does nothing fails the test.kubectl wait --for=condition=Readyfor theapiandcachepods, selected byapp.kubernetes.io/component.kubectl get podsexits 0 on an empty namespace and Helm's--waitonly waits for workloads that are in the chart, whereaskubectl waitexits 1 withno matching resources foundwhen nothing matches.Not in this PR
GoStarterTemplateTestsstarts the AppHost and checks thatcacheandapiexist, which does not show that the API serves requests. No existing helper reads a resource URL withoutjq, which thePolyglotGoimage does not carry, and the API probably needs host networking to reach the Redis container (an inference, not run).TypeScriptCodegenValidationTestsandJavaCodegenValidationTestsrunaspire restoreright after anaspire addand compare the codegen hash with the one from before the add, andKubernetesDeployTypeScriptTestscheckskubectl get pods, which exits 0 on an empty namespace.Aspire.Deployment.EndToEnd.Testswould run nightly against the real Azure subscription and cannot be verified from here.AddManifestandWithFieldcoverage. Go AppHost: AddManifest is unusable — Configure option panics on publish, and WithField can't express nested/dotted CRD fields #18080 is an open product bug..gitignoreassertions for the Go scaffold and starter. The templates do not write a.gitignoreentry onmainyet. Make new Go AppHosts gofmt-clean, ignore the generated SDK and check every resource #21193 adds one, and asserting it is item 3 of Go AppHost: starter go.sum and E2E fixture follow-ups #21206.aspire initin an existing Go repository (Go AppHost parity gaps vs TypeScript #21201). ReadingScaffoldingServicesuggests an existinggo.modconflicts, but no test was run.go vetin the polyglot validation and a Go scenario incli-starter-validation(Go AppHost CI: add vet, starter and stable-restore validation #21202).Validation
Windows, repo-local SDK, head
962ebc83a4on top ofupstream/main230d5ac2a8.mainhas since gained one unrelated commit that touches onlyKubernetesDeployWithCertManagerTests.cs, so no rebase was needed. Rows 1 to 3 ran on this head. Rows 4 to 6 ran ond24eb6c14a: the later commits change only E2E test sources and the shared Hex1b helpers, andInfrastructure.Testslinks neither (it linksTemporaryWorkspace.cs,WindowsTrayTestPayload.csandPathLookupHelper.csfrom the shared directories) and does not read them, so those rows are unaffected.dotnet build tests\Aspire.Cli.EndToEnd.Tests\Aspire.Cli.EndToEnd.Tests.csproj -m:2 --no-restoredotnet build tests\Aspire.Deployment.EndToEnd.Tests\Aspire.Deployment.EndToEnd.Tests.csproj -m:2 --no-restoredotnet test --project tests\Aspire.Cli.EndToEnd.Tests\Aspire.Cli.EndToEnd.Tests.csproj --no-restore --no-launch-profile -- --filter-class "*.CliInstallStrategyTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"--list-tests(placed before the--) discovers the same 67, all in this class, including 4 newPolyglotGocasesdotnet build tests\Infrastructure.Tests\Infrastructure.Tests.csproj -m:2 --no-restoredotnet test --project tests\Infrastructure.Tests\Infrastructure.Tests.csproj --no-restore --no-launch-profile -- --filter-method "*.RealMapRepresentativeCliE2eRuntimeConsumerSelectsCliE2e"dotnet test --project tests\Infrastructure.Tests\Infrastructure.Tests.csproj --no-restore --no-launch-profile -- --filter-namespace "Infrastructure.Tests.TestTriggerMap"The 22
TestTriggerMapfailures are pre-existing and Windows-only: 5SelectTestsCliTestsand 17PrComparisonBaseTestsdata rows. A control run on a clean82c3b01ce1(themaintip before this rebase) gave 349 total, 327 passed and the same 22 failures, caused bybashreceiving mangled Windows paths and anUnauthorizedAccessExceptiondeleting a temporary git repository. This branch adds the 2 passing rows.The shell fragments of the three newest commits were also run outside CI. 27 cases ran against stub
aspireandkubectlexecutables, with the fragments extracted from the C# sources so the dry run cannot drift from the tests: thegrepchecks accept the exact value and reject a wrong, empty or longer one, the baseline snapshot and put-back restore the stale SDK, and thekubectl waitcommand covers exactlyapiandcache. Realkubectlv1.36.1 against a throwaway fake API server confirmed the difference the Kubernetes test relies on: in an empty namespacekubectl get pods --no-headersexits 0 whilekubectl wait --for=condition=Readyexits 1 withno matching resources found, and with only anapipod Ready the wait exits 0 forapiand 1 forcache.Not run locally: all seven new E2E classes. They need Docker (and kind for the Kubernetes test), the CLI archive and the new
PolyglotGoimage, so CI is their only execution. All ten passed onc788f994e7and again on962ebc83a4, so the snapshot, put-back and restore flow inGoCodegenValidationTestsand thekubectl waitcheck on a real kind cluster inGoKubernetesDeployTestshave run end to end in CI. A crash-loopingapior an image pull failure fails the Kubernetes test by design.Checklist
<remarks />and<code />elements on your triple slash comments?