test: cloudflare artifacts roundtrip smoketest#4
Merged
Conversation
Realigns the Artifacts test-support adapter with the documented REST
API and adds a live smoketest tagged `:cloudflare`.
Adapter (`test/support/cloudflare_artifacts.ex`):
- `create_repo!/2` now returns the bootstrap `{remote, token, ...}`
the API hands back, instead of throwing it away.
- `mint_token!` → `create_token!/3` to mirror upstream naming, fixed
to `POST /tokens` (the previous `/repos/:name/tokens` 404'd) and to
parse `result.plaintext` rather than `result.token`.
- Adds `revoke_token!/1`.
- Documents the required permissions: `Artifacts Read` + `Artifacts Write`.
Smoketest (`test/exgit/cloudflare_artifacts_roundtrip_test.exs`):
- Test 1: exgit push → exgit lazy-clone → byte equality. Proves our
transport round-trips random content.
- Test 2 (`:real_git`): exgit push → real `git clone` + `git fsck`.
Proves Cloudflare stores valid git, readable by a third-party client.
Both tests opt-in via `mix test --include cloudflare`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drops the REST control plane (create_repo / delete_repo) from the test-support adapter. The smoketest now runs against a persistent repo, with both the wire URL and token injected via env: * CF_ARTIFACT_REMOTE — full git wire URL * CF_ARTIFACT_TOKEN — long-lived repo-scoped token (art_v1_) Both are loaded from .env locally and from CI secrets. Hardcoding neither the URL (account ID) nor the token in source. Each test still uses a unique branch name to avoid stomping across runs against the shared repo. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two fixes for the live-network cloudflare smoketest: 1. Drop `:real_git` from the second test. ExUnit's tag logic treats include as overriding exclude, so `mix test --include real_git` (used by the extended-tiers step) was pulling in the cloudflare test even though `:cloudflare` is on the default exclude list. The test then immediately raised "CF_ARTIFACT_REMOTE not set" because no secrets were injected into that step. The `:cloudflare` module tag is a sufficient gate; opting in implies `git` on PATH. 2. Add a dedicated CI step that runs `mix test --only cloudflare` with `CF_ARTIFACT_REMOTE` and `CF_ARTIFACT_TOKEN` injected from secrets. Gated push-to-main + primary matrix only, mirroring how `:github_private` is handled — these secrets aren't available on fork PRs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exgit.Test.CloudflareArtifactsadapter with the documented REST API:create_repo!/2now returns the bootstrap{remote, token, ...},mint_token!→create_token!/3(mirrors upstream naming, hits the correctPOST /tokensendpoint, parsesresult.plaintext), addsrevoke_token!/1.:cloudflarethat pushes a random blob viaExgit.push, verifies it two ways, then deletes the repo.Artifacts Read+Artifacts Write).What the smoketest proves
:real_git) — push thengit clonewith the real binary plusgit fsck --full. Proves Cloudflare stores valid git that a third-party client can read, not exgit-flavoured bytes.Test plan
mix test --include cloudflare --include real_git test/exgit/cloudflare_artifacts_roundtrip_test.exs— 2 tests, 0 failures.mix test --warnings-as-errors(default suite) — 729 tests, 0 failures.mix format,mix compile --warnings-as-errors,MIX_ENV=dev mix credo --strict— all clean.🤖 Generated with Claude Code