phoebus_os/installer/tests/test_opencode.sh
Phoebus 38214ea9e7 chore: import Phoebus OS installer and Rust migration
Initial public import of the proven Bash installer (installer/) and the production Rust workspace (installer-rs/). The reference ISO, build output and local agent transcripts are gitignored.

Verified: installer/tests/run_tests.sh and cargo test --workspace both pass.
2026-09-20 02:07:33 -07:00

25 lines
1 KiB
Bash

#!/usr/bin/env bash
# shellcheck shell=bash
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
TEST_NAME="test_opencode"
phoebus_test_setup
url="$(opencode_manifest_get x86_64 url)"
sha="$(opencode_manifest_get x86_64 sha256)"
assert_contains "$url" "opencode-linux-x64.tar.gz" "manifest has x86_64 url"
assert_eq "64" "${#sha}" "manifest sha256 is 64 hex chars"
assert_eq "v1.18.31" "$(opencode_version_manifest)" "manifest pins a version"
# checksum verification
f="$STATE_DIR/artifact"
printf 'hello phoebus\n' >"$f"
good="$(sha256sum "$f" | awk '{print $1}')"
assert_success "correct checksum accepted" opencode_checksum_ok "$f" "$good"
assert_failure "wrong checksum rejected" opencode_checksum_ok "$f" "deadbeef"
assert_failure "placeholder checksum rejected" opencode_checksum_ok "$f" "0000000000000000000000000000000000000000000000000000000000000000"
assert_failure "empty checksum rejected" opencode_checksum_ok "$f" ""
# unknown arch has no usable entry
assert_failure "unknown arch refused" opencode_manifest_get sparc url
phoebus_test_report