
Add script launch_instance.sh for basic instance VM tests. The script tries to deal with a number of failures that have turned up in testing (e.g., services failing to start, instance not launching). The changeset includes three scripts in a new tools directory. 1) To run a test once, use test-once.sh: $ ./tools/test-once.sh scripts/test/launch_instance.sh 2) To restore (and boot) the cluster to an earlier snapshot, use restore-cluster.sh. The argument selects the snapshot used for the controller node VM. To select the most recently used snapshot: $ ./tools/restore-cluster.sh current To select the controller snapshot, "controller_node_installed": $ ./tools/restore-cluster.sh controller_node_installed 3) To run the same test repeatedly, use repeat-test.sh. The test script name is hard-coded (launch_instance.sh). The argument determines whether the cluster is rebuilt for each test or if a snapshot of the cluster is restored. The controller snapshot is hardcoded (controller_node_installed); this particular snapshot is of interest because it does not seem to result in a reliable cluster. Log files are stored in log/test-results. Repeat-test.sh also saves log files from each node's /var/log/upstart to help with analyzing failures. $ ./tools/repeat-test.sh restore After running a number of tests, you can get some simple stats using a command like this: $ grep -h SUM log/test-results/*/test.log|LC_ALL=C sort|uniq -c Co-Author: Pranav Salunke <dguitarbite@gmail.com> Change-Id: I20b7273683b281bf7822ef66e311b955b8c5ec8a
38 lines
955 B
Bash
Executable File
38 lines
955 B
Bash
Executable File
#!/bin/bash
|
|
set -o errexit -o nounset
|
|
TOP_DIR=$(cd "$(dirname "$0")/.." && pwd)
|
|
source "$TOP_DIR/config/paths"
|
|
source "$CONFIG_DIR/deploy.osbash"
|
|
source "$OSBASH_LIB_DIR/functions.host"
|
|
|
|
CONTROLLER_PORT=2230
|
|
NETWORK_PORT=2231
|
|
COMPUTE_PORT=2232
|
|
|
|
function usage {
|
|
echo "Purpose: Get logs from cluster node VMs."
|
|
echo "Usage: $0 [<target_root>]"
|
|
exit 1
|
|
}
|
|
|
|
if [ $# = 0 ]; then
|
|
usage
|
|
else
|
|
RESULTS_DIR=$1
|
|
if [ ! -d "$RESULTS_DIR" ]; then
|
|
echo >&2 "Error: no such directory: $RESULTS_DIR"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
for port in "$CONTROLLER_PORT" "$NETWORK_PORT" "$COMPUTE_PORT"; do
|
|
port_dir=$RESULTS_DIR/$port
|
|
mkdir "$port_dir"
|
|
vm_ssh "$port" "sudo tar cf - -C /var/log upstart" | tar xf - -C "$port_dir"
|
|
done
|
|
|
|
if vm_ssh "$CONTROLLER_PORT" 'ls log/test-*.*' >/dev/null 2>&1; then
|
|
vm_ssh "$CONTROLLER_PORT" 'cd log; tar cf - test-*.*' | tar xf - -C "$RESULTS_DIR"
|
|
vm_ssh "$CONTROLLER_PORT" 'rm log/test-*.*'
|
|
fi
|