|
| 1 | +--- |
| 2 | +name: run-windows-e2e |
| 3 | +description: Run Windows E2E tests (MSI install tests or Fleet Automation/installer tests) locally against AWS-provisioned VMs |
| 4 | +allowed-tools: Bash, Read, Glob, Grep, AskUserQuestion |
| 5 | +argument-hint: "[suite] [TestFunctionName] [--build release|pipeline|local] [--pipeline-id <id>] [--version <version>]" |
| 6 | +--- |
| 7 | + |
| 8 | +Run Windows E2E tests from `test/new-e2e/tests/windows/` or `test/new-e2e/tests/installer/windows/`. |
| 9 | + |
| 10 | +Detailed reference material lives in `references/` next to this file — read the |
| 11 | +relevant one when a step calls for it rather than duplicating it here: |
| 12 | + |
| 13 | +- [`references/setup.md`](references/setup.md) — prerequisites, `~/.test_infra_config.yaml`, dev mode |
| 14 | +- [`references/running.md`](references/running.md) — `setup-env`, local builds, `go test` flags |
| 15 | +- [`references/vm-access.md`](references/vm-access.md) — connecting to a dev-mode VM (RDP/SSH) |
| 16 | +- [`references/troubleshooting.md`](references/troubleshooting.md) — test outputs, Pulumi locks, AWS profile |
| 17 | + |
| 18 | +## Instructions |
| 19 | + |
| 20 | +### Step 1 — Parse `$ARGUMENTS` |
| 21 | + |
| 22 | +Determine: |
| 23 | +- **Suite**: which test suite to run (e.g. `install-test`, `service-test`, `agent-package`, `install-script`). If not provided, ask the user. |
| 24 | +- **Test function**: specific `TestXxx` function. Most suites expect exactly one test per run — ask the user which one if not specified. |
| 25 | +- **Artifact source**: `--build pipeline` (default), `--build local`, or `--build release`; pass `--pipeline-id <id>` through if given. |
| 26 | +- **Stable/previous version** (upgrade tests only): if the user specifies a version to upgrade *from*, plan a second `setup-env` run with `--prefix STABLE_AGENT` in Step 3 (see [`references/running.md`](references/running.md) "Upgrade tests"). |
| 27 | +- **Branch**: if the user mentions a branch ("from main"), pass `--branch <name>` to `setup-env`. The default is the current git branch, which may have no pipelines if it's a local feature branch. |
| 28 | + |
| 29 | +Map suite names to Go package paths: |
| 30 | + |
| 31 | +| Suite | Package path | |
| 32 | +|-------|-------------| |
| 33 | +| `install-test` | `./test/new-e2e/tests/windows/install-test` | |
| 34 | +| `service-test` | `./test/new-e2e/tests/windows/service-test` | |
| 35 | +| `fips-test` | `./test/new-e2e/tests/windows/fips-test` | |
| 36 | +| `domain-test` | `./test/new-e2e/tests/windows/domain-test` | |
| 37 | +| installer / Fleet Automation (agent-package, install-script, install-exe, ddot, apm-inject, …) | `./test/new-e2e/tests/installer/windows` | |
| 38 | + |
| 39 | +The installer / Fleet Automation tests are all one flat package (the |
| 40 | +`suites/<package>/` subdirectories were flattened in #47161) — pick the area by |
| 41 | +test function with `-run` (e.g. `TestAgentUpgrades`, `TestInstallScript`, |
| 42 | +`TestDDOTExtensionViaMSI`, `TestAPMInjectInstalls`). |
| 43 | + |
| 44 | +If the user gives a partial name or test function, search with Glob/Grep under `test/new-e2e/tests/windows/` and `test/new-e2e/tests/installer/windows/` to resolve it. |
| 45 | + |
| 46 | +### Step 2 — Check prerequisites |
| 47 | + |
| 48 | +```bash |
| 49 | +test -f ~/.test_infra_config.yaml && echo "EXISTS" || echo "MISSING" |
| 50 | +pulumi version 2>/dev/null || echo "MISSING" |
| 51 | +``` |
| 52 | + |
| 53 | +If either is missing, offer to run `dda inv e2e.setup` and wait for the user to |
| 54 | +complete its interactive prompts. If prerequisites exist but `devMode` is not |
| 55 | +set, mention that `devMode: true` reuses VMs across runs (much faster for |
| 56 | +iterative development). Full detail in [`references/setup.md`](references/setup.md). |
| 57 | + |
| 58 | +### Step 3 — Resolve artifact environment variables |
| 59 | + |
| 60 | +Run `setup-env` with `--fmt json` to capture the required env vars (no shell |
| 61 | +`eval` needed — prepend the parsed pairs inline to `go test` in Step 5). |
| 62 | + |
| 63 | +```bash |
| 64 | +# From a pipeline (most common) |
| 65 | +dda inv new-e2e-tests.setup-env --build pipeline --fmt json [--branch <branch>] [--pipeline-id <id>] |
| 66 | + |
| 67 | +# From a local build (run `dda inv msi.build` first, + `msi.package-oci` for installer/OCI tests) |
| 68 | +dda inv new-e2e-tests.setup-env --build local --fmt json |
| 69 | +``` |
| 70 | + |
| 71 | +For upgrade tests, run a second time with `--prefix STABLE_AGENT` and merge the |
| 72 | +vars in. GitLab token handling, local-build details, and the `STABLE_AGENT` |
| 73 | +flow are in [`references/running.md`](references/running.md). |
| 74 | + |
| 75 | +### Step 4 — Check for stale state (dev mode only) |
| 76 | + |
| 77 | +If `devMode: true` and the user is rerunning, the previous VM may still have the |
| 78 | +agent installed. Ask whether they've cleaned up (MSI tests: uninstall the agent; |
| 79 | +installer tests: `datadog-installer.exe purge`). See |
| 80 | +[`references/running.md`](references/running.md) "Clean state between runs". |
| 81 | + |
| 82 | +### Step 5 — Build and confirm the `go test` command |
| 83 | + |
| 84 | +```bash |
| 85 | +go test -v -timeout 30m -tags test <package-path> -run <TestFunction>$ |
| 86 | +``` |
| 87 | + |
| 88 | +Two rules to apply (rationale in [`references/running.md`](references/running.md)): |
| 89 | +anchor the `-run` regex with `$` at both suite and subtest level, and use the |
| 90 | +exact package path with **no trailing `/...`** (or output won't stream). |
| 91 | + |
| 92 | +Show the full command to the user and confirm before running. |
| 93 | + |
| 94 | +### Step 6 — Run the test |
| 95 | + |
| 96 | +Warn the user that AWS SSO auth may open a browser window when the test starts |
| 97 | +(the test pauses until login completes), and that a non-sandbox `AWS_PROFILE` |
| 98 | +will cause auth errors — advise `unset AWS_PROFILE`. |
| 99 | + |
| 100 | +Run with `run_in_background: true` since tests provision real AWS VMs. |
| 101 | +Provisioning takes a few minutes; once the VM is up, SSH becomes available |
| 102 | +within ~60s (Linux) / ~180s (Windows). If SSH is not available within those |
| 103 | +windows, troubleshoot before assuming the test is still running normally |
| 104 | +(see [`references/vm-access.md`](references/vm-access.md)). |
| 105 | + |
| 106 | +### Step 7 — Report results |
| 107 | + |
| 108 | +When the test completes: |
| 109 | +- Report pass/fail. |
| 110 | +- On failure, point the user to `~/e2e-output/latest/` (crash dumps, agent/installer logs, event logs). If `devMode` is on, the VM is still up — offer to help RDP/SSH in via [`references/vm-access.md`](references/vm-access.md). |
| 111 | +- For Pulumi lock errors or AWS auth errors, see [`references/troubleshooting.md`](references/troubleshooting.md). |
0 commit comments