Repository navigation
test(version-management): add e2e integration tests for plugin check-versions and upgrade - #231
Conversation
…versions and upgrade - Add e2e-tests/plugin-version-management.test.ts verifying plugin check-versions and upgrade lifecycle - Test version mismatch detection, remediation output, and --json structured output - Test non-destructive --dry-run and --skip-install upgrade modes - Test full upgrade with package manager install and lockfile synchronization - Test multi-step version upgrade lifecycle across releases (1.8 -> 2.0 -> 2.1) - Test dynamic plugin export of an upgraded plugin fixture - Test offline and air-gapped auditing and upgrading via --manifest-file and RHDH_OFFLINE=true - Register versions:lint alias for check-versions in src/commands/index.ts - Enrich runCommand Error with stdout, stderr, code, and signal properties Assisted-By: opencode Signed-off-by: Stan Lewis <gashcrumb@gmail.com> rh-pre-commit.version: 2.4.0 rh-pre-commit.check-secrets: ENABLED
…xport-build - Move runExpectingFailure into e2e-tests/support/plugin-export-build.ts - Share runExpectingFailure across plugin-dev.test.ts and plugin-version-management.test.ts - Resolve SonarCloud code duplication quality gate failure Assisted-By: opencode Signed-off-by: Stan Lewis <gashcrumb@gmail.com> rh-pre-commit.version: 2.4.0 rh-pre-commit.check-secrets: ENABLED
|
/fs-review |
|
🤖 Review · Commit: |
- Disable immutable installs (YARN_ENABLE_IMMUTABLE_INSTALLS=false) during upgrade's yarn install step - Allow Yarn Berry to update yarn.lock when running under CI=true or PR workflows - Pass YARN_ENABLE_IMMUTABLE_INSTALLS=false in e2e version management upgrade test Assisted-By: opencode Signed-off-by: Stan Lewis <gashcrumb@gmail.com> rh-pre-commit.version: 2.4.0 rh-pre-commit.check-secrets: ENABLED
|
/fs-review |
|
🤖 Finished Review · ✅ Success · Started 6:46 PM UTC · Completed 7:11 PM UTC Commit: Runtime: claude · Model: sonnet → claude-sonnet-4-6 · Effort: high · Cost: $4.32 |
|
Risk Assessment: moderate (2/5) DetailsPrimarily a test-addition PR with two small production changes; large blast-radius classification is the dominant risk signal but is offset by high test file ratio, no protected or security-sensitive paths, and a well-scoped, easily reversible change set. |
ReviewFindingsMedium
Low
Next steps:
|
There was a problem hiding this comment.
Note: The following review comments could not be posted on the diff (GitHub returned 422) and are included here instead:
e2e-tests/plugin-version-management.test.ts(file-level): Line 469 · [low] test-correctness
The offlineDir fixture in beforeAll does not include a backstage.json file. syncBackstageJson silently skips when the file is absent, leaving the backstage.json sync path untested in offline mode. No assertion fails, but the gap is silent.
Suggested fix: Add a backstage.json to the offline fixture and assert parsedUpgrade.updatedFiles includes backstage.json after upgrade.
- Remove unused RunCommandOptions import in plugin-dev.test.ts - Restore test isolation with afterEach hook in dependency upgrading suite - Pin multi-step upgrade lifecycle tests to RHDH_OFFLINE=true - Add backstage.json to offline test fixture and assert version synchronization - Revert global YARN_ENABLE_IMMUTABLE_INSTALLS mutation in upgrade command Assisted-By: opencode Signed-off-by: Stan Lewis <gashcrumb@gmail.com> rh-pre-commit.version: 2.4.0 rh-pre-commit.check-secrets: ENABLED
- Verify lockfile synchronization in full upgrade test and restore baseline yarn.lock in afterEach - Provide local manifest fixtures for multi-step 1.8 -> 2.0 -> 2.1 lifecycle test and tighten 2.1 assertions - Test real plugin skew, upgrade with package manager install, and dynamic export supported-versions matching Assisted-By: opencode Signed-off-by: Stan Lewis <gashcrumb@gmail.com> rh-pre-commit.version: 2.4.0 rh-pre-commit.check-secrets: ENABLED
|



Summary
Adds an automated end-to-end integration test suite (
e2e-tests/plugin-version-management.test.ts) coveringrhdh-cli plugin check-versionsandrhdh-cli plugin upgradeacross real plugin file structures, fulfilling the E2E testing requirements of RHIDP-16669.Key Coverage
plugin check-versions& aliasversions:lint):Run rhdh-cli plugin upgrade 2.1.0) and structured--jsonoutput (valid: false,status: "mismatch").versions:lintalias insrc/commands/index.ts.plugin upgrade& aliasversions:bump):--dry-run: Verifies table diff output while ensuringpackage.jsonandbackstage.jsonremain untouched on disk.--skip-install: Verifiespackage.jsonandbackstage.jsonupdate to target manifest versions without triggering package manager install.yarn install) updatingyarn.lock.yarn tsc,yarn build, andrhdh-cli plugin exportrun cleanly on the upgraded plugin, generatingdist-dynamic/package.jsonwith matchingbackstage.supported-versionsand zero version conflicts.check-versionsandupgradewith--manifest-file <path>andRHDH_OFFLINE=truewithout external network calls.e2e-tests/support/plugin-export-build.ts):ErrorfromrunCommandwithstdout,stderr,code, andsignalproperties for robust error assertions.Follow-up documentation refactoring across all on-ramp workflows (
plugin new,plugin dev,plugin check-versions,plugin upgrade) will be delivered in a subsequent PR.