ci: add integration tests for write-program-buffer#24
Conversation
Greptile SummaryThis PR adds end-to-end integration tests for the
Confidence Score: 5/5Safe to merge — this is a new test infrastructure addition with no changes to production action logic. All changes are additive test scaffolding: a new workflow, a new composite action, fixture binaries, and prepare/assert shell scripts. None of the existing action code is modified. The scenario coverage is thorough and the fixture invariants are validated at both build time (rebuild.sh) and run time (prepare scripts). The one finding is a fragile CLI error-message match in assert-fresh.sh that could cause a false test failure after a Solana CLI upgrade, but does not affect production behaviour. write-program-buffer/tests/integration/assert-fresh.sh — the program-absence check greps for a hardcoded CLI string; consider switching to an exit-code check. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant GHA as GitHub Actions (matrix)
participant SetupAll as setup-all
participant Validator as start-test-validator
participant Prepare as prepare-scenario.sh
participant Action as write-program-buffer
participant Assert as assert-scenario.sh
GHA->>SetupAll: install Solana CLI (v4.1.2)
GHA->>Validator: start solana-test-validator
Validator-->>GHA: rpc-url, ledger-dir
GHA->>Prepare: deploy fixture, airdrop SOL
Prepare-->>GHA: program-id, keypair, buffer-authority, pre-len
GHA->>Action: program-id, program artifact, rpc-url, keypair, buffer-authority-address
Note over Action: extend ProgramData if needed,<br/>write buffer, optionally transfer authority
Action-->>GHA: buffer address
GHA->>Assert: BUFFER, PROGRAM_ID, DEPLOYER, BUFFER_AUTHORITY, PRE_LEN
Note over Assert: check Data Length growth,<br/>dump & cmp buffer vs artifact,<br/>verify authority on-chain
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant GHA as GitHub Actions (matrix)
participant SetupAll as setup-all
participant Validator as start-test-validator
participant Prepare as prepare-scenario.sh
participant Action as write-program-buffer
participant Assert as assert-scenario.sh
GHA->>SetupAll: install Solana CLI (v4.1.2)
GHA->>Validator: start solana-test-validator
Validator-->>GHA: rpc-url, ledger-dir
GHA->>Prepare: deploy fixture, airdrop SOL
Prepare-->>GHA: program-id, keypair, buffer-authority, pre-len
GHA->>Action: program-id, program artifact, rpc-url, keypair, buffer-authority-address
Note over Action: extend ProgramData if needed,<br/>write buffer, optionally transfer authority
Action-->>GHA: buffer address
GHA->>Assert: BUFFER, PROGRAM_ID, DEPLOYER, BUFFER_AUTHORITY, PRE_LEN
Note over Assert: check Data Length growth,<br/>dump & cmp buffer vs artifact,<br/>verify authority on-chain
Reviews (3): Last reviewed commit: "fix: review findings (#5)" | Re-trigger Greptile |
|
@Woody4618 lmk if this is a direction you're okay with (absolutely no problem if you prefer not to) |
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)