#!/bin/bash
# Tests the SDP - basic tests
declare -i ExitCode=0
/p4/reset_sdp.sh
sudo ln -f -s /sdp/Server/test/test_SDP.py /p4/test_SDP.py
sudo ln -f -s /sdp/Server/test/test_Upgrade.py /p4/test_Upgrade.py
if ! python3 /p4/test_SDP.py --version 24.2; then
tail /tmp/SDPTest.log
exit 1
fi
if ! python3 /p4/test_Upgrade.py; then
tail /tmp/UpgradeSDPTest.log
exit 1
fi
#------------------------------------------------------------------------------
# To test extraction of custom logic during SDP upgrade, inject some custom
# logic pre-upgrade. Later, we'll test both the extraction and the post-
# extraction shell environment load order.
echo -e "### MAKE LOCAL CHANGES HERE\\nexport TEST_MESSAGE=Life\\n" >> /p4/common/bin/p4_vars
echo -e "### MAKE LOCAL CHANGES HERE\\nexport TEST_MESSAGE+=\" is Good\"\\n" >> /p4/common/config/p4_1.vars
echo -e "export DO_PARALLEL_CHECKPOINTS=6" >> /p4/common/config/p4_1.vars
#------------------------------------------------------------------------------
# Test SDP Upgrade
# This steps are pulled from the 'Upgrading the SDP' section of the SDP
# Guide.
echo Testing the SDP Upgrade Procedure
cd /hxdepots
[[ -d downloads ]] || mkdir downloads
cd downloads
[[ -d new ]] && mv new old.$(date +'%Y%m%d-%H%M')
[[ -e sdp.Unix.tgz ]] && mv sdp.Unix.tgz sdp.Unix.old.$(date +'%Y%m%d-%H%M%S')
curl -s -k -O https://swarm.workshop.perforce.com/projects/perforce-software-sdp/download/downloads/sdp.Unix.tgz
mkdir new
cd new
tar -xzf ../sdp.Unix.tgz
rsync -a /hxdepots/sdp/ /hxdepots/downloads/new/sdp
cd /hxdepots/downloads/new/sdp/Server/Unix/p4/common/sdp_upgrade
if ./sdp_upgrade.sh -y > /tmp/sdp_upgrade.log 2>&1; then
echo SDP Upgrade OK.
else
echo SDP Upgrade FAILED.
tail /tmp/sdp_upgrade.log
exit 1
fi
#------------------------------------------------------------------------------
# Call verify_sdp.sh after the SDP upgrade.
echo Calling verify_sdp.sh after the SDP Upgrade.
if /p4/common/bin/verify_sdp.sh 1 > /tmp/post_upgrade_verify.log 2>&1; then
echo SDP Post-Upgrade Verify Completed OK.
else
echo SDP Post-Upgrade Verify FAILED.
tail /tmp/post_upgrade_verify.log
exit 1
fi
#------------------------------------------------------------------------------
# Test extraction of custom logic after SDP upgrade.
for c in p4_vars.local p4_1.vars.local; do
if [[ -r "/p4/common/site/config/$c" ]]; then
echo "Found expected post-upgrade extracted file: $c"
else
echo "FAILED: Missing expected post-upgrade extracted file: $c"
ExitCode=1
fi
done
source /p4/common/bin/p4_vars 1
Output=$(echo $TEST_MESSAGE)
if [[ "$Output" == *"Life is Good"* ]]; then
echo "Post-upgrade Test Message is as expected: $Output"
else
echo "FAILED: Post-upgrade Test Message is not as expected: $Output"
ExitCode=1
fi
#------------------------------------------------------------------------------
# Test parallel checkpoint feature post-upgrade.
live_checkpoint.sh 1
if grep -q 'root -Z -N 6 -jcpm' /p4/1/logs/checkpoint.log; then
echo "Verified: Multifile P4D 2023.1+ parallel checkpoint attempted."
if grep -q 'End p4_1 Checkpoint' /p4/1/logs/checkpoint.log; then
echo "Verified: Multifile P4D 2023.1+ parallel checkpoint succeeded."
else
echo "FAILED: Multifile parallel checkpoint was not successful."
ExitCode=1
fi
else
echo "FAILED: Multifile parallel checkpoint not attempted."
ExitCode=1
fi
exit "$ExitCode"
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #10 | 31513 | C. Thomas Tyler |
Removed parallel checkpoint test from test_sdp.sh. This test was done in a way specific to the 2023.2 release when multi-file parallel checkpoints were new, and before the Battle School QA Test Suite was in place. Parallel checkpoint functionality now has far better coverage and is better tested in the Battle School QA test suite. We can safely drop this old basic test from the Docker test suite without loss of test coverage. |
||
| #9 | 31421 | C. Thomas Tyler |
Adapted test suite to new version of backup_functions.sh with that now passes '-v track=-1' on p4d commands to reduce excessive noise during checkpoint operations. |
||
| #8 | 31034 | C. Thomas Tyler | Added version parameter. | ||
| #7 | 29594 | C. Thomas Tyler | Adjusted test for r23.1 multifile parallel checkpoint. | ||
| #6 | 28850 | C. Thomas Tyler |
Test suite tweaks: * Added command line usage notes in scripts. * Enhanced comand line processing. * Added aliases for building on Rocky Linux 8. #review-28851 |
||
| #5 | 28377 | C. Thomas Tyler |
Added test for correct extraction of custom logic during SDP ugprade. This test also ensure correct load order for the shell environment. #review-28378 |
||
| #4 | 28252 | C. Thomas Tyler | Enahced test suite: verify_sdp.sh runs after testing sdp_ugprade.sh. | ||
| #3 | 28232 | C. Thomas Tyler | Added test for sdp_upgrade.sh. | ||
| #2 | 25554 | Robert Cowham | Automated tests for calling upgrade.sh | ||
| #1 | 25258 | Robert Cowham |
Rework the containers in preparation for multi container testing mkrep changes: Remove -c cfg option which was unused anyway Converted tabs to spaces Fixed logic error causing forwarding replicas to bail due to unsupported p4d version Standby servers require ReplicatingFrom field Add seconds to log file name (useful for testing to avoid overwriting files) |