ci: add integration tests for write-program-buffer - #24
Conversation
Greptile SummaryThis PR adds a full integration test suite for the
Confidence Score: 5/5Safe to merge — all five test scenarios are logically sound, fixture invariants are validated at build time, and the new start-test-validator action is a thin, well-guarded wrapper. The prepare/assert pairing is consistent across all scenarios, size-band checks in both rebuild.sh and the prepare scripts guard against fixture drift, and the slot-advance waits are applied only where program extension is involved. The only fragility is the hardcoded CLI error string in assert-fresh.sh, which is stable while the Solana version stays pinned. Files Needing Attention: assert-fresh.sh — the program-absence check depends on a specific Solana CLI error message string that would silently invert on a version bump. Important Files Changed
Sequence DiagramsequenceDiagram
participant CI as GitHub Actions Runner
participant V as solana-test-validator
participant Chain as On-chain State
CI->>CI: checkout + setup-all (install Solana CLI)
CI->>V: start-test-validator (--reset, background)
V-->>CI: rpc-url + ledger-dir outputs
CI->>CI: "prepare-{scenario}.sh (keygen, airdrop, optional deploy/extend)"
CI->>V: solana airdrop / program deploy / program extend
V-->>Chain: lamports + ProgramData account
CI->>CI: outputs: keypair, program-id, pre-len, buffer-authority
CI->>CI: write-program-buffer action
CI->>V: create buffer, write bytes
note over CI,V: if needed: extend program account
V-->>Chain: buffer account + optional program resize + optional authority
CI-->>CI: output: buffer address
CI->>CI: "assert-{scenario}.sh"
CI->>V: solana program show (POST_LEN)
CI->>V: solana program dump (buffer to tmpfile)
CI->>CI: cmp artifact vs dump
CI->>CI: check authority / program existence / size delta
note over CI: On failure: tail validator-stdout.log + validator.log
Reviews (4): Last reviewed commit: "fix: address 2nd round of reviews (#6)" | Re-trigger Greptile |
|
@Woody4618 lmk if this is a direction you're okay with (absolutely no problem if you prefer not to) |
dev-jodee
left a comment
There was a problem hiding this comment.
looks good, couple of questions
| echo "keypair=$(cat "$SCENARIO_DIR/deployer.json")" | ||
| echo "deployer=$DEPLOYER" | ||
| echo "program-id=$PROGRAM_ID" | ||
| echo "buffer-authority=$DEPLOYER" |
There was a problem hiding this comment.
Should we have deployer and buffer-auth be the same keypair? or sohuld it be different
There was a problem hiding this comment.
You mean so we can test that buffer-auth stays with the deployer on initial deployment? i.e. to exercise a test for this if?:
- name: Transfer buffer authority
if: steps.check-program.outputs.exists == 'true'No strong opinion. I feel this is okay given that these are not unit tests that cover every detail
When I worked on the program extension fix for the
write-proram-bufferaction last week (#22), it would’ve been great to have automated tests running in the CI to increase confidence in the solution. I was trialing a few test scenarios and a way of testing this against a local solana validator. I think this could be helpful for future changes.These are the scenarios tested for the write-program-buffer action (the workflow has a path filter, so they don’t run on changes to the other actions):
buffer-authority-address: buffer authority transferred on-chain, no resizeTest fixtures are prebuilt binaries, reproducible byte-for-byte from
tests/fixtures/program/viarebuild.sh. Also extractsstart-test-validatoras a reusable action (not documented yet, lmk if you’d like that added as part of the public set of actions)