Files
nupst/test/manualdocker/02-test-v3-to-v4-migration.sh

73 lines
1.8 KiB
Bash
Raw Normal View History

#!/bin/bash
#
# Test migration from v3 to v4
# Run this after 01-setup-v3-container.sh
#
set -e
CONTAINER_NAME="nupst-test-v3"
echo "================================================"
echo " NUPST v3 → v4 Migration Test"
echo "================================================"
echo ""
# Check if container exists
if ! docker ps --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
echo "❌ Container ${CONTAINER_NAME} is not running"
echo "Run ./01-setup-v3-container.sh first"
exit 1
fi
echo "→ Checking current NUPST status..."
docker exec ${CONTAINER_NAME} systemctl status nupst --no-pager || true
echo ""
echo "→ Checking current version..."
docker exec ${CONTAINER_NAME} nupst --version
echo ""
echo "→ Stopping v3 service..."
docker exec ${CONTAINER_NAME} systemctl stop nupst
echo ""
echo "→ Pulling latest v4 code from migration/deno-v4 branch..."
docker exec ${CONTAINER_NAME} bash -c "
cd /opt/nupst
git fetch origin
# Reset any local changes made by install.sh
git reset --hard HEAD
git clean -fd
git checkout migration/deno-v4
git pull origin migration/deno-v4
echo 'Now on:'
git log -1 --oneline
"
echo "→ Running install.sh (should auto-detect v3 and migrate)..."
docker exec ${CONTAINER_NAME} bash -c "
cd /opt/nupst
bash install.sh -y
"
echo "→ Checking service status after migration..."
docker exec ${CONTAINER_NAME} systemctl status nupst --no-pager || true
echo ""
echo "→ Checking new version..."
docker exec ${CONTAINER_NAME} nupst --version
echo ""
echo "→ Testing service commands..."
docker exec ${CONTAINER_NAME} nupst service status || true
echo ""
echo "================================================"
echo " ✓ Migration Test Complete"
echo "================================================"
echo ""
echo "Check logs with:"
echo " docker exec ${CONTAINER_NAME} nupst service logs"
echo ""