Skip to content

Commit e9835a7

Browse files
committed
test: Add droplet resize verification to integration tests
- Update integration test to re-run action with larger VPS size - Verify resize is detected and executed successfully - Check actual droplet size via doctl after resize - Test both version upgrade (6.0.4→6.0.5) and resize (1GB→2GB) together - Ensures auto-resize feature works end-to-end
1 parent 0c1d372 commit e9835a7

1 file changed

Lines changed: 71 additions & 57 deletions

File tree

.github/workflows/integration-test.yml

Lines changed: 71 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -244,73 +244,72 @@ jobs:
244244
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
245245
chmod 600 ~/.ssh/id_rsa
246246
247-
- name: Test version upgrade manually
248-
run: |
249-
echo "🔄 Testing Mautic version upgrade from 6.0.4 to 6.0.5..."
250-
VPS_IP="${{ steps.deploy.outputs.vps-ip }}"
251-
252-
if [ -z "$VPS_IP" ]; then
253-
echo "❌ Error: VPS_IP is empty!"
254-
exit 1
255-
fi
256-
257-
echo "📝 Updating Mautic version configuration on VPS: $VPS_IP"
258-
259-
# SSH into VPS and modify the version, then trigger upgrade
260-
ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa root@${VPS_IP} << 'EOF'
261-
cd /var/www
262-
echo "🔍 Current deploy.env contents:"
263-
cat deploy.env
264-
echo ""
265-
echo "🔄 Updating MAUTIC_VERSION to 6.0.5-apache..."
266-
sed -i 's/MAUTIC_VERSION=.*/MAUTIC_VERSION=6.0.5-apache/' deploy.env
267-
echo "✅ Updated deploy.env contents:"
268-
cat deploy.env
269-
echo ""
270-
echo "🚀 Re-running setup script to trigger upgrade detection..."
271-
./setup 2>&1 | tee /var/log/upgrade-test.log
272-
EOF
247+
- name: Test version upgrade and resize via action re-run
248+
id: upgrade
249+
uses: ./
250+
with:
251+
vps-name: ${{ steps.test-name.outputs.test-name }}
252+
vps-size: 's-1vcpu-2gb' # Upgrade from 1GB to 2GB
253+
vps-region: 'nyc1'
254+
email: 'test@mautic-test.local'
255+
mautic-password: ${{ secrets.TEST_MAUTIC_PASSWORD }}
256+
mysql-password: ${{ secrets.TEST_MYSQL_PASSWORD }}
257+
mysql-root-password: ${{ secrets.TEST_MYSQL_ROOT_PASSWORD }}
258+
digitalocean-token: ${{ secrets.DIGITALOCEAN_TOKEN }}
259+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
260+
# Upgrade to newer version
261+
mautic-version: '6.0.5-apache'
262+
plugins: |
263+
https://github.com/chimpino/stripe-plugin/archive/refs/heads/6.x.zip?directory=StripeBundle&token=${{ secrets.CHIMPINO_GITHUB_TOKEN }}
273264
274-
echo "✅ Version upgrade test completed"
265+
- name: Show upgrade and resize results
266+
run: |
267+
echo "🎉 Upgrade and resize completed successfully!"
268+
echo "VPS IP: ${{ steps.upgrade.outputs.vps-ip }}"
269+
echo "Mautic URL: ${{ steps.upgrade.outputs.mautic-url }}"
270+
echo "✅ Mautic 6.0.5 upgrade + resize to 2GB test passed"
275271
276-
- name: Verify upgrade worked
272+
- name: Verify upgrade and resize worked
277273
run: |
278-
echo "🔍 Verifying the upgrade was successful..."
279-
VPS_IP="${{ steps.deploy.outputs.vps-ip }}"
280-
MAUTIC_URL="${{ steps.deploy.outputs.mautic-url }}"
274+
echo "🔍 Verifying the upgrade and resize were successful..."
275+
VPS_IP="${{ steps.upgrade.outputs.vps-ip }}"
276+
MAUTIC_URL="${{ steps.upgrade.outputs.mautic-url }}"
277+
278+
# Setup SSH
279+
mkdir -p ~/.ssh
280+
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
281+
chmod 600 ~/.ssh/id_rsa
281282
282-
# Download upgrade log
283-
scp -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa root@${VPS_IP}:/var/log/upgrade-test.log ./upgrade-test.log || echo "Could not download upgrade log"
283+
# Download deployment log to check for resize
284+
echo "📥 Downloading deployment log..."
285+
scp -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa root@${VPS_IP}:/var/log/setup-dc.log ./upgrade-test.log || echo "Could not download log"
284286
285-
# Check if upgrade was detected
287+
# Check if resize was detected and executed
286288
if [ -f ./upgrade-test.log ]; then
287-
echo "📋 Checking upgrade log for update indicators..."
288-
289-
if grep -q "Version mismatch:" ./upgrade-test.log; then
290-
echo "✅ PASS: Version update was detected"
291-
else
292-
echo "❌ FAIL: Version update was not detected"
293-
echo "📋 Recent log entries:"
294-
tail -20 ./upgrade-test.log
295-
exit 1
296-
fi
297-
298-
if grep -q "Containers recreated successfully" ./upgrade-test.log; then
299-
echo "✅ PASS: Containers were updated successfully"
300-
else
301-
echo "❌ FAIL: Container update failed"
302-
echo "📋 Checking for alternative success indicators..."
303-
if grep -q "Mautic update completed successfully" ./upgrade-test.log; then
304-
echo "✅ PASS: Mautic update completed successfully"
289+
echo "📋 Checking for droplet resize indicators..."
290+
if grep -q "Droplet size mismatch detected" ./upgrade-test.log; then
291+
echo "✅ PASS: Droplet size mismatch was detected"
292+
293+
if grep -q "Droplet resized successfully" ./upgrade-test.log; then
294+
echo "✅ PASS: Droplet resize completed successfully"
305295
else
306-
echo "❌ No success indicators found"
296+
echo "❌ FAIL: Droplet resize did not complete"
297+
echo "📋 Log excerpt:"
298+
grep -A 5 -B 5 "resize" ./upgrade-test.log || echo "No resize info found"
307299
exit 1
308300
fi
301+
else
302+
echo "❌ FAIL: No resize detection found in logs"
303+
echo "📋 Checking deploy.sh log for resize-related messages..."
304+
grep -i "resize\|size\|checking if droplet" ./upgrade-test.log | head -20 || echo "No size-related messages found"
305+
exit 1
309306
fi
307+
else
308+
echo "⚠️ WARNING: Could not retrieve deployment log"
310309
fi
311310
312-
# Verify Mautic is still working after upgrade
313-
echo "🔍 Testing Mautic accessibility after upgrade..."
311+
# Verify Mautic is still working after upgrade and resize
312+
echo "🔍 Testing Mautic accessibility after upgrade and resize..."
314313
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "${MAUTIC_URL}/s/login" 2>/dev/null || echo "000")
315314
echo "📋 HTTP response code: $HTTP_CODE"
316315
@@ -328,17 +327,32 @@ jobs:
328327
echo "❌ FAIL: Container is not running expected version"
329328
exit 1
330329
fi
330+
331+
# Verify droplet was actually resized
332+
echo "🔍 Verifying droplet size via doctl..."
333+
doctl auth init --access-token "${{ secrets.DIGITALOCEAN_TOKEN }}"
334+
ACTUAL_SIZE=$(doctl compute droplet get "${{ steps.test-name.outputs.test-name }}" --format Size --no-header)
335+
echo "📊 Actual droplet size: $ACTUAL_SIZE"
336+
337+
if [ "$ACTUAL_SIZE" = "s-1vcpu-2gb" ]; then
338+
echo "✅ PASS: Droplet is now 2GB"
339+
else
340+
echo "❌ FAIL: Droplet is still $ACTUAL_SIZE (expected s-1vcpu-2gb)"
341+
exit 1
342+
fi
331343
else
332344
echo "❌ FAIL: Mautic is not accessible after upgrade"
333345
exit 1
334346
fi
335347
336-
echo "🎉 All version upgrade validation checks passed!"
348+
echo "🎉 All version upgrade and resize validation checks passed!"
337349
echo "🏁 Integration test completed successfully:"
338-
echo " ✅ Initial deployment with Mautic 6.0.4"
350+
echo " ✅ Initial deployment with Mautic 6.0.4 on 1GB droplet"
351+
echo " ✅ Droplet resized from 1GB to 2GB"
339352
echo " ✅ Version upgrade to 6.0.5 without reinstallation"
340353
echo " ✅ Proper maintenance and migration execution"
341354
echo " ✅ Container version verification"
355+
echo " ✅ Droplet size verification"
342356
343357
- name: Cleanup test droplet
344358
if: always()

0 commit comments

Comments
 (0)