Skip to content

Manual Test Runbook — X2: Terratest Harness

Owner: Sagar  |  Time: ~20 min  |  Sandbox: snowops-sandbox-01

Purpose

Validate that the X2 Terratest harness is correctly installed, that the self-test (TestNoopHarness) passes without cloud credentials, that the sandbox validate test (TestSandboxValidate) confirms the X1 HCL is valid, and that the integration probe (TestSandboxProbe) can deploy and destroy a real resource in the sandbox subscription.

Prerequisites

  • Go 1.22+ installed: go version
  • Terraform 1.6+ installed: terraform version
  • Azure CLI installed: az version
  • Sandbox sub access via PIM activated (Owner or Contributor)
  • az login --tenant <TENANT_ID> completed; az account show returns the sandbox sub
  • SNOWOPS_SANDBOX_SUBSCRIPTION_ID and SNOWOPS_SANDBOX_TENANT_ID env vars exported

Steps

1. Install Go dependencies

cd tests/terratest
go mod download
  • go mod download completes without error
  • No "module not found" or checksum errors

2. Run the X2 self-test (no cloud needed)

go test -v -timeout 5m ./...
  • --- PASS: TestNoopHarness in output
  • --- PASS: TestSandboxValidate in output
  • Exit code 0

3. Run the sandbox integration probe

export SNOWOPS_SANDBOX_SUBSCRIPTION_ID="<guid>"
export SNOWOPS_SANDBOX_TENANT_ID="<guid>"
go test -v -tags integration -timeout 15m ./sandbox/...
  • --- PASS: TestSandboxProbe in output
  • In the Azure portal, resource group snowops-x2-probe-* appeared during the run
  • Resource group was destroyed on test completion (not visible in portal)
  • Exit code 0

4. Verify ephemeral safety net

If the test had been aborted mid-run, the probe RG would survive. Confirm the X7 nightly cleanup would catch it:

az group show --name snowops-x2-probe-<suffix> --subscription $SNOWOPS_SANDBOX_SUBSCRIPTION_ID
  • Resource group is gone (404) — destroy completed normally
  • If it still exists: tags must include ephemeral=true (X7 will collect it)

Pass criteria

  • TestNoopHarness PASS without any Azure env vars set
  • TestSandboxValidate PASS without any Azure env vars set
  • TestSandboxProbe PASS with sandbox env vars; probe RG created and destroyed
  • No residual resources left in the subscription

Teardown

Terraform destroy runs automatically via defer terraform.Destroy(t, opts) inside the test. If a test is aborted:

# List any surviving probe resource groups
az group list --subscription $SNOWOPS_SANDBOX_SUBSCRIPTION_ID \
  --query "[?contains(name,'snowops-x2-probe')].[name]" -o tsv

# Destroy manually if needed
az group delete --name <name> --subscription $SNOWOPS_SANDBOX_SUBSCRIPTION_ID --yes

Sign-off

  • Tester: _  |  Date: _  |  Result: PASS / FAIL / N/A
  • Notes: