Files
replicate/scripts/run-upgrade-tests.sh
zeekay a485f34a14 rebrand: complete litestream -> replicate rename
- All source files, configs, docs, CI renamed
- Binary: replicate (not litestream)
- Config: replicate.yml (litestream.yml as fallback)
- Env: REPLICATE_* (LITESTREAM_* as fallback)
- Socket: /var/run/replicate.sock
- Image: ghcr.io/hanzoai/replicate
- Module: github.com/hanzoai/replicate
- Package name: replicate (Go), replicate-vfs (npm/pip/gem)
- VFS: registered as "replicate", pragmas replicate_*
- C exports: ReplicateVFSRegister, GoReplicate*
- Windows service: Replicate
- Systemd unit: replicate.service
- Upstream attribution preserved (README, upgrade test scripts)
2026-04-09 18:03:37 -07:00

70 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
# Run the v0.3.x → v0.5.x upgrade integration tests locally.
# Downloads the v0.3.13 binary if not already cached, builds the current
# binary, and runs the Go integration test.
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
CACHE_DIR="$ROOT_DIR/.cache/replicate-v3"
V3_BIN="$CACHE_DIR/replicate"
# Detect platform.
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
ARCH="$(uname -m)"
case "$ARCH" in
x86_64) ARCH="amd64" ;;
aarch64) ARCH="arm64" ;;
arm64) ARCH="arm64" ;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac
# Download v0.3.13 binary if not cached.
if [ ! -x "$V3_BIN" ]; then
echo "Downloading upstream Litestream v0.3.13 (${OS}-${ARCH})..."
mkdir -p "$CACHE_DIR"
case "$OS" in
darwin)
ASSET="litestream-v0.3.13-darwin-${ARCH}.zip"
gh release download v0.3.13 --repo benbjohnson/litestream --pattern "$ASSET" --dir "$CACHE_DIR" --clobber
unzip -o "$CACHE_DIR/$ASSET" -d "$CACHE_DIR"
rm -f "$CACHE_DIR/$ASSET"
;;
linux)
ASSET="litestream-v0.3.13-linux-${ARCH}.tar.gz"
gh release download v0.3.13 --repo benbjohnson/litestream --pattern "$ASSET" --dir "$CACHE_DIR" --clobber
tar -xzf "$CACHE_DIR/$ASSET" -C "$CACHE_DIR"
rm -f "$CACHE_DIR/$ASSET"
;;
*)
echo "Unsupported OS: $OS"
exit 1
;;
esac
chmod +x "$V3_BIN"
echo "Cached v0.3.13 binary at $V3_BIN"
else
echo "Using cached v0.3.13 binary at $V3_BIN"
fi
echo "v0.3.13 version: $("$V3_BIN" version)"
# Build current binaries.
echo "Building current binaries..."
cd "$ROOT_DIR"
go build -o bin/replicate ./cmd/replicate
go build -o bin/replicate-test ./cmd/replicate-test
echo "Current version: $(./bin/replicate version)"
# Run upgrade tests.
echo ""
echo "Running upgrade integration tests..."
REPLICATE_V3_BIN="$V3_BIN" CGO_ENABLED=1 \
go test -v -tags=integration -timeout=10m ./tests/integration/... -run=TestUpgrade "$@"