diff --git a/.github/workflows/test-write-program-buffer.yaml b/.github/workflows/test-write-program-buffer.yaml index 667a064..34caa12 100644 --- a/.github/workflows/test-write-program-buffer.yaml +++ b/.github/workflows/test-write-program-buffer.yaml @@ -20,6 +20,7 @@ jobs: integration: name: ${{ matrix.scenario }} (solana ${{ matrix.solana-version }}) runs-on: ubuntu-latest + timeout-minutes: 10 strategy: fail-fast: false matrix: diff --git a/start-test-validator/action.yaml b/start-test-validator/action.yaml index 1531310..31889eb 100644 --- a/start-test-validator/action.yaml +++ b/start-test-validator/action.yaml @@ -34,7 +34,6 @@ runs: LEDGER_DIR="${RUNNER_TEMP:-/tmp}/test-ledger" fi - rm -rf "$LEDGER_DIR" solana-test-validator --reset --quiet --ledger "$LEDGER_DIR" > "${RUNNER_TEMP:-/tmp}/validator-stdout.log" 2>&1 & echo "Validator started with PID $!" diff --git a/write-program-buffer/tests/integration/assert-authority.sh b/write-program-buffer/tests/integration/assert-authority.sh index 7d1251a..d24e036 100755 --- a/write-program-buffer/tests/integration/assert-authority.sh +++ b/write-program-buffer/tests/integration/assert-authority.sh @@ -12,6 +12,8 @@ fail() { [ -n "${BUFFER:-}" ] || fail "action did not output a buffer address" [ -n "${BUFFER_AUTHORITY:-}" ] || fail "BUFFER_AUTHORITY env not set" [ -n "${DEPLOYER:-}" ] || fail "DEPLOYER env not set" +[ -n "${PROGRAM_ID:-}" ] || fail "PROGRAM_ID env not set" +[ -n "${PRE_LEN:-}" ] || fail "PRE_LEN env not set" BUFFER_INFO=$(solana program show "$BUFFER" -u "$RPC_URL") echo "$BUFFER_INFO" @@ -20,9 +22,13 @@ AUTHORITY=$(echo "$BUFFER_INFO" | grep "Authority:" | awk '{print $2}' || true) [ "$AUTHORITY" = "$BUFFER_AUTHORITY" ] || fail "buffer authority is $AUTHORITY, expected $BUFFER_AUTHORITY" [ "$AUTHORITY" != "$DEPLOYER" ] || fail "buffer authority still equals the deployer" +POST_LEN=$(solana program show "$PROGRAM_ID" -u "$RPC_URL" | grep "Data Length:" | sed -E 's/.*Data Length: ([0-9]+).*/\1/' | cut -d ' ' -f1 || true) +[ -n "$POST_LEN" ] || fail "could not read data length of program $PROGRAM_ID" +[ "$POST_LEN" -eq "$PRE_LEN" ] || fail "program was resized from $PRE_LEN to $POST_LEN bytes, expected no resize" + DUMP="$(mktemp)" solana program dump "$BUFFER" "$DUMP" -u "$RPC_URL" || fail "could not dump buffer $BUFFER" cmp -s "$ARTIFACT" "$DUMP" || fail "buffer contents differ from artifact" rm -f "$DUMP" -echo "Authority transfer assertions passed" +echo "Authority transfer assertions passed: program stayed at $PRE_LEN bytes" diff --git a/write-program-buffer/tests/integration/prepare-authority.sh b/write-program-buffer/tests/integration/prepare-authority.sh index d840aae..a14e696 100755 --- a/write-program-buffer/tests/integration/prepare-authority.sh +++ b/write-program-buffer/tests/integration/prepare-authority.sh @@ -28,12 +28,19 @@ solana program deploy "$FIXTURES_DIR/program-small.so" \ -u "$RPC_URL" -k "$SCENARIO_DIR/deployer.json" \ --commitment confirmed +PRE_LEN=$(solana program show "$PROGRAM_ID" -u "$RPC_URL" | grep "Data Length:" | sed -E 's/.*Data Length: ([0-9]+).*/\1/' | cut -d ' ' -f1 || true) +if [ -z "$PRE_LEN" ]; then + echo "Could not read deployed program size" >&2 + exit 1 +fi + cp "$FIXTURES_DIR/program-small.so" target/deploy/fixture-authority.so -echo "Prepared authority scenario: deployer=$DEPLOYER program-id=$PROGRAM_ID authority-target=$AUTHORITY_TARGET" +echo "Prepared authority scenario: deployer=$DEPLOYER program-id=$PROGRAM_ID authority-target=$AUTHORITY_TARGET pre-len=$PRE_LEN" { echo "keypair=$(cat "$SCENARIO_DIR/deployer.json")" echo "deployer=$DEPLOYER" echo "program-id=$PROGRAM_ID" echo "buffer-authority=$AUTHORITY_TARGET" + echo "pre-len=$PRE_LEN" } >> "$GITHUB_OUTPUT"