Skip to content

test(e2e): add live end-to-end test suite for the jh CLI#43

Merged
thelonewolf1603 merged 9 commits into
mainfrom
nd/jh-cli-e2e-tests
Jun 17, 2026
Merged

test(e2e): add live end-to-end test suite for the jh CLI#43
thelonewolf1603 merged 9 commits into
mainfrom
nd/jh-cli-e2e-tests

Conversation

@thelonewolf1603

@thelonewolf1603 thelonewolf1603 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Add an e2e-tagged Go test suite under e2e/ that builds the jh binary and runs its read/GET commands against a live JuliaHub instance (nightly by default). One file per command category; entity-specific commands (dataset, registry, project) list first and drive the detail command off the first entry. Tests assert real behaviour and skip on backend gaps (missing perms, absent endpoints, disallowed queries, timeouts) while still failing on genuine CLI defects.

Auth is file-based: the harness writes a throwaway ~/.juliahub in an isolated HOME from env-supplied tokens, so the CLI's auth path is unchanged. Build-tag gated so go test ./... is unaffected; CI compile-checks it.

Also fix admin group list: /app/config/groups returns groups bucketed by category, not a top-level array — parse the object, flatten, sort by id.

https://github.com/JuliaComputing/JuliaHub/issues/22754

thelonewolf1603 and others added 4 commits June 8, 2026 06:21
Add an `e2e`-tagged Go test suite under e2e/ that builds the jh binary and
runs its read/GET commands against a live JuliaHub instance (the platform
nightly instance by default). One file per command category; commands that
need a specific entity (dataset, registry, project) list first and drive the
detail command off the first entry. Tests assert real behaviour and skip
gracefully on backend gaps (missing perms, absent endpoints, disallowed
queries, timeouts) while still failing on genuine CLI defects.

Authentication is purely file-based: the harness materializes a throwaway
~/.juliahub in an isolated HOME from credentials supplied via env vars, so the
CLI's auth path is exercised unchanged and a real login is never touched. The
suite is build-tag gated so `go test ./...` is unaffected; CI compile-checks it.

Also fix `admin group list`, which failed to parse the /app/config/groups
response: the endpoint returns groups bucketed by category
({"juliahub":{"groups":[...]},"site":{"groups":[...]}}) but the code expected a
top-level array. Parse the categorized object, flatten, and sort by id.

Includes e2e/ci/ glue (composite action + example job) for wiring the suite
into the JuliaHub platform nightly CI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add e2e/scan_test.go for `jh scan`: a deterministic input-validation test
(missing manifest) plus a submit→status→results lifecycle that uploads a sample
Manifest.toml with --no-wait, then drives `scan status`/`scan results` off the
server-assigned run_uuid. Skips when the static-analysis endpoint is absent on
the instance (404). Adds an errorLine() harness helper for clearer skip
diagnostics.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Self-review cleanup of the e2e suite:

- Split the 459-line harness_test.go: run machinery stays in harness_test.go;
  assertions, output parsers, and backend-gap/skip helpers move to
  helpers_test.go.
- Unify the duplicated packageBackendGap/scanBackendGap into a single
  backendGap() helper; use the clearer errorLine() in their skip messages.
- Fix a temp-dir leak: the freshly built binary's dir is now removed on exit.
- Drop the write-only result.err field and the dead expectedName var.
- Remove the duplicated e2e/ci/ CI snippets; the canonical wiring lives in the
  JuliaHub repo. Fold a concise "Running in CI" section into e2e/README.md.
- Add a Makefile (make e2e / e2e-fast / e2e-compile / check) so developers
  don't have to remember the -tags e2e invocations; e2e-fast skips the slow
  project-list tests (~14s vs ~70s).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@thelonewolf1603 thelonewolf1603 requested a review from a team June 8, 2026 10:55
@vdayanand

Copy link
Copy Markdown
Member

Here is the coverage report. We should improve it either in this or future

File Coverage Untested
main.go 40.2% write subcommand wiring (add/update/delete paths)
git.go 0% everything: cloneProject, pushProject, gitCredentialGet, isJuliaHubURL, helper setup
registries.go 18.3% createRegistry, updateRegistry, submitRegistry, pollRegistrySaveStatus, setRegistrator, permission set/remove
datasets.go 35.2% uploadDataset, createNewDataset, uploadToExistingDataset
credentials.go 15.5% all of add/update/delete for token, ssh, github-app
packages.go 28.9% * package backend unavailable on nightly, under-reports
run.go 0% createJuliaAuthFile, setupJuliaCredentials, runJulia
update.go / julia.go 0% self-update, julia install
landing.go 24.8% setLandingPage, removeLandingPage

@thelonewolf1603

Copy link
Copy Markdown
Contributor Author

@vdayanand one if the reasons for this coverage report is much of the post/delete flows are not e2e tested, i refrained from that as it is being tested against nightly and didnt want to have dangling data in the instance from each test run

@thelonewolf1603 thelonewolf1603 merged commit bd28d8c into main Jun 17, 2026
1 check passed
@thelonewolf1603 thelonewolf1603 deleted the nd/jh-cli-e2e-tests branch June 17, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants