End-to-end test infrastructure
This document describes the one-time manual setup required to run the E2E test suite. The infrastructure is intentionally stable (not ephemeral) to keep costs low and setup reproducible.
The default fixture is a pair of existing, dedicated, non-production organizations and repositories. Creating organizations or repositories, pushing fixture content, installing the GitHub App and setting repository secrets all change shared systems and need explicit authorization from a maintainer or the organization administrators. The commands below describe what an authorized maintainer does once; they are not routine steps and this documentation never runs them for you.
Overview
Section titled “Overview”The E2E tests authenticate against real private GitHub repositories spread across two test organizations. This validates the core enterprise use-case: cross-organization repository access via GitHub App credentials, including git submodules.
gh-app-auth-test-1 (org)└── main-repo (private) ├── README.md ├── data/main-marker.txt ← contains "gh-app-auth-e2e-main-marker" └── .gitmodules ← submodule → gh-app-auth-test-2/submodule-repo
gh-app-auth-test-2 (org)└── submodule-repo (private) ├── README.md └── data/submodule-marker.txt ← contains "gh-app-auth-e2e-submodule-marker"Step 1 — Create Test Organizations
Section titled “Step 1 — Create Test Organizations”The fixture needs two GitHub organizations. Names are configurable but default to:
gh-app-auth-test-1gh-app-auth-test-2Normally these already exist and you only need access to them. Creating organizations is an
administrative action that depends on your company’s GitHub policy, so ask the administrator who owns
that policy to approve and, where required, perform it. gh api user/orgs only lists organizations you
already belong to; it does not show whether you may create one. The organizations can use the
Free plan and need no members beyond an owner.
Step 2 — Create Test Repositories
Section titled “Step 2 — Create Test Repositories”In gh-app-auth-test-1
Section titled “In gh-app-auth-test-1”export ORG1="gh-app-auth-test-1"
# Create main-repo (MUST be private)gh repo create "${ORG1}/main-repo" --private --description "E2E test repo — do not use"
# Populate with required contentTMPDIR=$(mktemp -d)gh repo clone "${ORG1}/main-repo" "${TMPDIR}/main-repo"cd "${TMPDIR}/main-repo"
mkdir -p dataecho "gh-app-auth-e2e-main-marker" > data/main-marker.txt
git add data/main-marker.txtgit commit -m "chore: add E2E test marker file"git pushcd - && rm -rf "${TMPDIR}"In gh-app-auth-test-2
Section titled “In gh-app-auth-test-2”export ORG2="gh-app-auth-test-2"
# Create submodule-repo (MUST be private)gh repo create "${ORG2}/submodule-repo" --private --description "E2E submodule repo — do not use"
TMPDIR=$(mktemp -d)gh repo clone "${ORG2}/submodule-repo" "${TMPDIR}/submodule-repo"cd "${TMPDIR}/submodule-repo"
mkdir -p dataecho "gh-app-auth-e2e-submodule-marker" > data/submodule-marker.txt
git add data/submodule-marker.txtgit commit -m "chore: add E2E test marker file"git pushcd - && rm -rf "${TMPDIR}"Add submodule from org2 into org1’s main-repo
Section titled “Add submodule from org2 into org1’s main-repo”TMPDIR=$(mktemp -d)gh repo clone "${ORG1}/main-repo" "${TMPDIR}/main-repo"cd "${TMPDIR}/main-repo"
git submodule add "https://github.com/${ORG2}/submodule-repo" submodule-repo
git add .gitmodules submodule-repogit commit -m "chore: add cross-org submodule for E2E testing"git pushcd - && rm -rf "${TMPDIR}"Step 3 — Create the GitHub App
Section titled “Step 3 — Create the GitHub App”Create a single GitHub App that will be installed in both organizations.
# Navigate to your GitHub account or organization settingsopen "https://github.com/settings/apps/new"App configuration:
| Field | Value |
|---|---|
| Name | gh-app-auth-e2e |
| Homepage URL | https://github.com/AmadeusITGroup/gh-app-auth |
| Webhook | Disabled (uncheck “Active”) |
| Repository permissions | Contents: Read-only |
| Where can it be installed | Any account |
After creation:
- Note the App ID (shown on the app settings page)
- Generate and download a private key (
.pemfile)
Step 4 — Install App in Both Test Organizations
Section titled “Step 4 — Install App in Both Test Organizations”Install the app in both test organizations. The E2E tests will discover the installation IDs dynamically via the GitHub API:
# Install in org1open "https://github.com/apps/gh-app-auth-e2e/installations/new"# Select gh-app-auth-test-1 → All repositories
# Install in org2# Select gh-app-auth-test-2 → All repositoriesEach organization will have its own installation. The E2E tests automatically discover these IDs using the GitHub App credentials.
Step 5 — Prepare the Private Key for CI
Section titled “Step 5 — Prepare the Private Key for CI”The private key is stored as a base64-encoded repository secret. Keep the downloaded .pem file in a
location approved for secrets, readable only by you. Do not print the encoded key to the terminal, and do
not pass it as a command-line argument, where it could appear in the process list or shell history.
Encode it straight into the secret in the next step instead.
Step 6 — Set Repository Secrets
Section titled “Step 6 — Set Repository Secrets”In https://github.com/AmadeusITGroup/gh-app-auth/settings/secrets/actions, create:
| Secret Name | Value | Description |
|---|---|---|
E2E_APP_ID |
123456 |
GitHub App ID (numeric) |
E2E_PRIVATE_KEY_B64 |
<base64 output> |
Base64-encoded private key PEM |
An authorized maintainer sets the secrets from the approved key file, with the value coming from standard input rather than an argument:
printf '%s' "$APP_ID" | gh secret set E2E_APP_ID --repo AmadeusITGroup/gh-app-authbase64 < "$KEY_FILE" | tr -d '\n' | gh secret set E2E_PRIVATE_KEY_B64 --repo AmadeusITGroup/gh-app-authAPP_ID and KEY_FILE are variables you set to your App’s ID and the path of the approved key file.
This is a manual maintainer action and this documentation does not execute it.
Security: The E2E tests generate short-lived installation tokens using the App ID and private key. Installation IDs are discovered dynamically via the GitHub API. No long-lived tokens are required.
Step 7 — Verify the Infrastructure
Section titled “Step 7 — Verify the Infrastructure”Run the pre-flight check locally before pushing a release:
export E2E_APP_ID="123456"export E2E_PRIVATE_KEY_B64="$(base64 < "$KEY_FILE" | tr -d '\n')"
go test -v -tags=e2e -run TestPreflight -timeout=2m ./test/e2e/...KEY_FILE is the path of the approved test key file. If E2E_PRIVATE_KEY (the raw PEM) is also set, it
takes precedence over E2E_PRIVATE_KEY_B64. Run this only against the dedicated fixture, and never
print the encoded key.
All four sub-tests must pass:
binary_accessible✓app_token_valid✓org1_main_repo_is_private✓org2_submodule_repo_is_private✓
Note: Installation IDs are discovered dynamically via the GitHub API. No manual configuration needed.
Repository Maintenance
Section titled “Repository Maintenance”The test repositories are static fixtures — they are created once and not modified by CI runs. There is no ephemeral cleanup required.
Do NOT:
- Make the test repositories public (E2E tests will refuse to run and fail with a clear error)
- Add real code or sensitive data to the test repositories
- Grant external collaborators access
If repositories are accidentally made public:
The TestPreflight/org1_main_repo_is_private test will fail with:
SECURITY GATE FAILED: gh-app-auth-test-1/main-repo is PUBLICSet them back to private immediately.
Custom Organization Names
Section titled “Custom Organization Names”If you use different organization names, set them as repository variables (not secrets):
gh variable set E2E_TEST_ORG_1 --body "your-org-1" --repo AmadeusITGroup/gh-app-authgh variable set E2E_TEST_ORG_2 --body "your-org-2" --repo AmadeusITGroup/gh-app-authThen update the test_org_1 / test_org_2 inputs in .github/workflows/release.yml.
Running E2E Tests Locally
Section titled “Running E2E Tests Locally”# Set required environment variablesexport E2E_APP_ID="123456"export E2E_PRIVATE_KEY_B64="$(base64 < "$KEY_FILE" | tr -d '\n')"
# Run all E2E tests (builds binary from source)make test-e2e
# Or run a specific testgo test -v -tags=e2e -run TestAuthentication -timeout=5m ./test/e2e/...
# Run against a locally built binarymake test-e2e-local
# Run against a specific binary (e.g. a downloaded release artifact)export E2E_BINARY_PATH=/path/to/gh-app-authmake test-e2eNote: The E2E tests automatically discover installation IDs for each organization using the GitHub API. Each organization may have a different installation ID.
Measuring E2E Coverage
Section titled “Measuring E2E Coverage”go test -cover cannot measure this suite — the tests exec the binary as a
subprocess, so counters live outside the test process. Use the coverage
wrapper instead, which builds an instrumented binary (go build -cover -coverpkg=./...) and collects counters from every spawned process via
GOCOVERDIR:
# Requires the same E2E_* env vars as the suite itselfsource .env.e2emake test-e2e-coverOutputs:
| File | Contents |
|---|---|
.e2e-covdata/ |
Raw covdata counters (go tool covdata -i=.e2e-covdata …) |
e2e-coverage.out |
textfmt coverprofile (go tool cover -func=e2e-coverage.out) |
e2e-coverage-summary.md |
Per-package markdown table — appended to $GITHUB_STEP_SUMMARY in CI |
All paths are overridable (E2E_COV_DIR, E2E_COV_BINARY, E2E_COV_PROFILE,
E2E_COV_SUMMARY) — see scripts/e2e-coverage.sh.
In CI, .github/workflows/e2e.yml runs this on every PR/push, appends the
summary table to the workflow-run summary, and uploads the covdata + profile
as the e2e-coverage-<os> artifact.
Cost drivers
Section titled “Cost drivers”This document does not quote prices or run times, because both change. What drives the cost of the end-to-end workflow is:
- the number of runs: the workflow runs on pull requests, pushes to
mainand manual dispatch, and the release pipeline gates on it; - the operating systems in the matrix, where macOS and Windows runners are billed at higher multipliers than Linux for private repositories;
- the container job for Fedora, and the time each job spends on retries and network access;
- the runners and secrets being available at all: when repository credentials are unavailable (for example on a fork), the secrets check skips the three operating-system jobs.
Public repositories use standard GitHub-hosted runners at no charge. Check the current GitHub Actions pricing for your plan before estimating.