test(core): DB-backed end-to-end test for the native add-on importer (#3425) #3477

Merged
mfreeman451 merged 2 commits from feat/native-addon-importer-db-test into staging 2026-05-31 23:35:58 +00:00
Owner

What

DB-backed end-to-end coverage of ServiceRadar.Plugins.NativeAddonImporter.import_entry/4 (build-signing §4) — the AddonPackage persist path the merged pure-unit suite (#3476) could only inject around.

The test verifies the per-arch ed25519 signatures, mirrors (faked), and creates a real staged AddonPackage, asserting:

  • the persisted artifacts map keyed "os/arch" => {object_key, sha256, signature} (exactly what AgentConfigGenerator.select_addon_artifact/3 reads);
  • the kind/delivery/supervision atoms + binary + source_release_tag;
  • it re-reads back out of Postgres (Ash.get);
  • a bad per-arch signature fails closed and persists nothing (:by_addon_id[]).

@moduletag :integration.

Verified

Ran against an srql-fixtures scratch CNPG database (per the srql-fixtures-db-tests skill): created a scratch DB, applied the branch migrations, then mix test --include integration2 tests, 0 failures. Scratch DB dropped afterward; no secrets printed.

🤖 Generated with Claude Code

## What DB-backed end-to-end coverage of `ServiceRadar.Plugins.NativeAddonImporter.import_entry/4` (build-signing §4) — the `AddonPackage` persist path the merged pure-unit suite (#3476) could only inject around. The test verifies the per-arch ed25519 signatures, mirrors (faked), and creates a **real staged `AddonPackage`**, asserting: - the persisted `artifacts` map keyed `"os/arch" => {object_key, sha256, signature}` (exactly what `AgentConfigGenerator.select_addon_artifact/3` reads); - the `kind`/`delivery`/`supervision` atoms + `binary` + `source_release_tag`; - it re-reads back out of Postgres (`Ash.get`); - a **bad per-arch signature fails closed and persists nothing** (`:by_addon_id` → `[]`). `@moduletag :integration`. ## Verified Ran against an **srql-fixtures scratch CNPG database** (per the `srql-fixtures-db-tests` skill): created a scratch DB, applied the branch migrations, then `mix test --include integration` → **2 tests, 0 failures**. Scratch DB dropped afterward; no secrets printed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
test(core): DB-backed end-to-end test for the native add-on importer (#3425)
Some checks failed
Secret Scan / gitleaks (pull_request) Successful in 53s
Golang Tests / test-go (push) Successful in 1m18s
lint / lint (pull_request) Successful in 1m53s
lint / lint (push) Successful in 2m24s
Elixir Quality / Elixir Quality (pull_request) Failing after 13m49s
CI / build (pull_request) Failing after 14m48s
599e7bc761
Covers the AddonPackage persist path the pure unit suite injects around
(build-signing §4). `NativeAddonImporter.import_entry/4` verifies the per-arch
ed25519 signatures, mirrors (faked), and creates a real staged AddonPackage; the
test asserts the persisted `artifacts` map (keyed "os/arch" -> object_key/sha256/
signature, the shape AgentConfigGenerator reads), the kind/delivery/supervision
atoms, the source release tag, and that it re-reads back out of Postgres — plus
that a bad per-arch signature fails closed and persists nothing
(`:by_addon_id` returns []).

`@moduletag :integration`. Verified against an srql-fixtures scratch CNPG
database (per the srql-fixtures-db-tests skill): branch migrations applied, then
`mix test --include integration` = 2 tests, 0 failures; scratch DB dropped after.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mfreeman451 left a comment

lgtm

lgtm
style(core): mix format the native add-on importer DB test (#3425)
Some checks failed
lint / lint (push) Successful in 1m21s
Secret Scan / gitleaks (pull_request) Successful in 59s
lint / lint (pull_request) Successful in 2m28s
Golang Tests / test-go (push) Successful in 2m37s
CI / build (pull_request) Failing after 15m47s
Elixir Quality / Elixir Quality (pull_request) Failing after 22m33s
e6ee99f620
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
carverauto/serviceradar!3477
No description provided.