test(github/repository): add hub e2e test coverage - #261
Conversation
Adds `modules/github/repository/e2e/` so the module is smoke-tested end to end: the test builds the BBD from source (build-from-source mode), orders a workspace-level building block that creates a private repository named with the run's name_suffix, and asserts the run SUCCEEDED plus the four repository outputs (name, full name, html url, clone url). `archive_repo_on_destroy` is set to false so teardown deletes the repository instead of archiving it — a scheduled smoke test must not accumulate archived repositories in the owning organization. Also declares `requiresBackplane: false` on the building block: the GitHub App credentials are supplied as static inputs by the platform team, so there is nothing cloud-side for a backplane to provision. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Scorecard Check
📊 meshstack-hub Module Scorecard
📋 Per-Module Category SummaryScore per category per building block.
Core Structure — some checks failingBasic module file structure and documentation — applies to 1 modules
Core Structure — Summary
Integration — ✅ all passingmeshstack_integration.tf conventions — applies to 1 modules
Integration — Summary
Azure Backplane — not applicableAzure UAMI-based automation principal conventions — applies to 0 modules No applicable modules. STACKIT Backplane — not applicableSTACKIT WIF-based automation principal conventions — applies to 0 modules No applicable modules. Testing — ✅ all passingEnd-to-end test coverage — applies to 1 modules
Testing — Summary
|
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
CI evidence for the permission blockerA scheduled-suite run against this branch gets all the way through BBD creation, building block ordering, and into the Terraform apply — then fails on the one API call that needs a permission the fixture App does not have: Everything around it is healthy: the BBD built from this branch, the building block was ordered against the right workspace-level target, and teardown was clean — no What is missingThe App backing the fixture credentials has:
Installation scope: selected repositories. Creating a repository needs org-level OptionsA. Widen the existing fixture App on B. Dedicated fixture organization (recommended) — a throwaway GitHub org with its own App holding Under option B the fixture wiring gains a second credential set (the existing one still serves the workflow-based test, which needs a real repository in My recommendation is B. Handing a scheduled, hourly-ish job org-wide Marking this PR draft until that decision is made. |
Adds
modules/github/repository/e2e/— the module previously scored 0% on the scorecard's Testing category.What the test does
bbd_version_ref == null): sources../to build the BBD, wiring thegithubobject fromtest_context.fixtures.github.target_type), sotarget_ref = { kind = "meshWorkspace", name = <workspace> }.smoke-test-github-repository-<name_suffix>so concurrent runs cannot collide.status.status == "SUCCEEDED"first, then all four real outputs —repo_name,repo_full_name,repo_html_url,repo_git_clone_url— viajsondecode(...).Cleanup
archive_repo_on_destroyis set tofalse. The BBD default istrue, which would leave one archived repository behind per run — unacceptable for a test that runs on a schedule.Also
requiresBackplane: falseis declared inbuildingblock/README.md. This module needs no cloud-side setup: the GitHub App credentials (org, app id, installation id, PEM key) are supplied as static inputs by the platform team.Scorecard
github/repositoryTesting: 0% → 100% (overall 🟢 90%).The e2e code is complete and correct, but the test cannot pass yet: the GitHub App backing the test fixtures has
actions:write, contents:write, metadata:read, workflows:writeand is installed on selected repositories. Creating a repository requires org-leveladministration: write, which the app does not have at all. Deleting the repository on teardown needs the same permission.Granting org-wide
administration: writeto a credential used by a scheduled test is a meaningful blast-radius increase (that permission allows renaming, transferring, and deleting any repository in the org), and repository creation in the mainmeshcloudorg would add audit noise, apply org rulesets to throwaway repos, and risk name collisions.Recommendation: point this test's fixtures at a dedicated throwaway GitHub organization with its own App, rather than widening the existing app's permissions on
meshcloud. See the discussion thread for details.