#!/bin/bash
#------------------------------------------------------------------------------
# Test Suite for Helix Installer
# Calls 'vagrant up' to call the Helix Installer on various OS's,
# and then inspects the installed SDP on each generated VM.
# Usage:
# cd <HelixInstallRoot>/test
### Review env.sh, source if desired, mdoify to change defaults.
# source ./env.sh
# ./run_hi_tests.sh 2>&1 | tee log.run_hi_tests
# Warning: Be prepared to enter password if 'vagrant up' goes interactive while
# doing 'sudo', as it might if you haven't used 'sudo' recently.
# Local Functions
function msg () { echo -e "$*"; }
function pass () { msg "PASS: ${1:-Unknown Passed Test}"; PassCount+=1; }
function fail () { msg "FAIL: ${1:-Unknown Failed Test}"; FailCount+=1; }
function errmsg () { msg "\\nError: ${1-Unknown Error}\\n"; ErrorCount+=1; }
# Variables
declare Version="1.0.1"
declare VagrantCfg="helix_installer_test.json"
declare -i PassCount=0
declare -i FailCount=0
declare -i TestCount=0
declare -i ErrorCount=0
declare -i OverallExitStatus=0
declare -i FullTest=${HIT_FULL:-0}
declare OSList=${HIT_OS_LIST:-ALL}
# Main Program
msg "\\nStarted ${0##*/} v$Version at $(date)."
if [[ "$FullTest" -eq 1 ]]; then
msg "Calling 'vagrant destroy --force' to to blast VMs."
vagrant destroy --force
msg "Calling 'vagrant up' to initiate Helix Installer."
vagrant up
else
msg "Skipping 'vagrant up'."
fi
if [[ $OSList == "ALL" ]]; then
OSList="$(grep :nodename "$VagrantCfg"|cut -d '"' -f 4)"
fi
msg "Operating systems: $OSList"
for os in $OSList; do
host=helix-$os
msg "Host=$host"
msg "Running: vagrant ssh $host -c 'sudo su - perforce -c \"p4 changes -t -m 3\"'"
if vagrant ssh "$host" -c 'sudo su - perforce -c "p4 changes -t -m 3"'; then
pass "Sample Depot is running on $host."
else
fail "Sample Depot is NOT running on $host."
fi
TestCount+=1
msg "Running: vagrant ssh $host -c 'sudo su - perforce -c \"ls -l /p4/common/perl\"'"
if vagrant ssh "$host" -c 'sudo su - perforce -c "ls -l /p4/common/perl"'; then
pass "Perl built on $host."
else
fail "Perl DID NOT build on $host."
fi
TestCount+=1
msg "Running: vagrant ssh $host -c 'sudo su - perforce -c \"ls -l /p4/common/python\"'"
if vagrant ssh "$host" -c 'sudo su - perforce -c "ls -l /p4/common/python"'; then
pass "Python built on $host."
else
fail "Python DID NOT build on $host."
fi
TestCount+=1
done
msg "Summary:\\n Tests Executed:\\t$TestCount\\n Passed:\\t\\t$PassCount\\n Failed:\\t\\t$FailCount\\n Test system errors:\\t\\t$ErrorCount"
if [[ "$TestCount" -ge 0 && "$FailCount" -eq 0 && "$ErrorCount" -eq 0 ]]; then
msg "\\nSUCCESS: All tests passed."
else
msg "\\nFAIL: At least one test failed (or none ran)."
OverallExitStatus=1
fi
msg "That took $((SECONDS/3600)) hours $((SECONDS%3600/60)) minutes $((SECONDS%60)) seconds.\n"
exit "$OverallExitStatus"
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #13 | 27288 | C. Thomas Tyler | Removed old Vagrant Test suite. | ||
| #12 | 27284 | C. Thomas Tyler |
Added Docker test suite to displace Vagrant. Initial version passes with options: hits.sh -o centos7 |
||
| #11 | 26784 | C. Thomas Tyler |
reset_sdp.sh v3.17.0: Made /hx* mount points configurable in settings.cfg, and updated documentation accordingly. Added support for configuring /hxmetadata1 and /hxmetadata2 with different values. Added test coverage for changing /hxdepots from the default. Enhanced test suite. TEST FAIL NOTE: As of this change, tests are succeeding on all platforms except CentOS 6. Failures are in the test suite infrastructure, not related to this change. |
||
| #10 | 26556 | C. Thomas Tyler |
Fixed issue with tests on SSL-enabled servers. Fixed issue with running tests on multiple servers by refactoring the single 'vagrant up' call for all hosts to have a per-host call 'vagrant up <>'. |
||
| #9 | 26405 | C. Thomas Tyler | Automated logging. | ||
| #8 | 26025 | C. Thomas Tyler | Fixed test suite quoting bug. | ||
| #7 | 26021 | C. Thomas Tyler |
Test suite enhancements to better test Configured mode with settings.cfg. |
||
| #6 | 25890 | C. Thomas Tyler |
Enhanced test suite to truly verify that P4Perl and P4Python are usable. |
||
| #5 | 25820 | C. Thomas Tyler |
Enhanced bootstrap test to call Heilx Installer with '-i' to enable testing of scenarios involving newly added files. |
||
| #4 | 25755 | C. Thomas Tyler | Cosmetic output tweak. | ||
| #3 | 25754 | C. Thomas Tyler |
Helix Installer test suite changes: Added new test outcome 'SKIP' to supplement 'PASS'/'FAIL'. Added logic to not bother running P4Perl/P4Python tests if '-fast' is specified in the bootstrap script, as in that case we don't expect those to have been installed. Changed bootstrap method back to '-fast' for now. |
||
| #2 | 25722 | C. Thomas Tyler | Fixed host naming convention issue. | ||
| #1 | 25673 | C. Thomas Tyler |
Added simple test driver and results analysis script. Calls 'vagrant up' to call the Helix Installer on various OS's, and then inspects the installed SDP generated VMs. |