#!/usr/bin/env bats # Tests for scripts/release.sh (REQ-097: cross-build amd64, asset verification). # Hermetic: tests the tarball naming and cross-build logic without # publishing a release. The full release flow requires GITEA_TOKEN + tea # and is tested in CI. load test_helper @test "release.sh exists and is executable" { [ -f "$SCRIPTS_DIR/release.sh" ] [ -x "$SCRIPTS_DIR/release.sh" ] } @test "release.sh --help or usage shows required tools" { # release.sh doesn't have a --help flag; the header comment is the # usage. Verify the script is syntactically valid. run bash -n "$SCRIPTS_DIR/release.sh" assert_status 0 "$status" } @test "release.sh cross-builds linux-amd64 regardless of host arch" { # Verify the script contains the cross-build command (D-193, REQ-097). # We check the source rather than running it (which requires go + tea). run grep -c "GOOS=linux GOARCH=amd64" "$SCRIPTS_DIR/release.sh" [ "$status" -eq 0 ] [ "$output" -ge 1 ] } @test "release.sh hardcodes linux-amd64 tarball name" { # The tarball name must be linux-amd64 (not host-arch-dependent). run grep -c "orca-\${VERSION}-linux-amd64.tar.gz" "$SCRIPTS_DIR/release.sh" [ "$status" -eq 0 ] [ "$output" -ge 1 ] } @test "release.sh has post-create asset verification (C-21)" { # Verify the script contains the asset verification logic. run grep -c "verifying asset" "$SCRIPTS_DIR/release.sh" [ "$status" -eq 0 ] [ "$output" -ge 1 ] run grep -c "verify_asset" "$SCRIPTS_DIR/release.sh" [ "$status" -eq 0 ] [ "$output" -ge 1 ] }