Skip to content

Commit d8e86b8

Browse files
committed
fix(tests): add docs for local testing with s3cmd
1 parent 13c8cae commit d8e86b8

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

docs/contributing/testing.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ individual pieces of Deis, then bring up a Vagrant cluster and test all of them
6969
as a system. They call ``tests/bin/test-setup.sh`` to test for important
7070
environment variables and will exit with a helpful message if any are missing.
7171

72+
The ``test-setup.sh`` script also prepares the testing environment, as well as
73+
tears it down after testing is complete. If there is a test failure, the script
74+
collects verbose component logs, compresses them, and places them in ``$HOME``.
75+
If `s3cmd`_ is installed and configured on the test machine, the script will
76+
instead upload the logs to Amazon S3. This is how the Jenkins CI infrastructure
77+
is configured, so that contributors have access to the logs to see how their
78+
PR failed.
79+
7280
test-integration.sh
7381
^^^^^^^^^^^^^^^^^^^
7482

@@ -155,3 +163,4 @@ variables that can affect the tests' behavior. Here are some important ones:
155163
.. _`source code`: https://github.com/deis/deis
156164
.. _`Docker registry`: https://github.com/docker/docker-registry
157165
.. _`Deis example app`: https://github.com/deis?query=example-
166+
.. _`s3cmd`: http://s3tools.org/s3cmd

tests/bin/test-setup.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function cleanup {
9696
function dump_logs {
9797
log_phase "Error detected, dumping logs"
9898
TIMESTAMP=`date +%Y-%m-%d-%H%M%S`
99-
FAILED_LOGS_DIR=$HOME/jenkins-$TIMESTAMP
99+
FAILED_LOGS_DIR=$HOME/deis-test-failure-$TIMESTAMP
100100
mkdir -p $FAILED_LOGS_DIR
101101
set +e
102102
export FLEETCTL_TUNNEL=$DEISCTL_TUNNEL
@@ -138,14 +138,16 @@ function dump_logs {
138138

139139
# tarball logs
140140
BUCKET=jenkins-failure-logs
141-
FILENAME=$BUCKET-$TIMESTAMP.tar.gz
141+
FILENAME=deis-test-failure-$TIMESTAMP.tar.gz
142142
cd $FAILED_LOGS_DIR && tar -czf $FILENAME *.log && mv $FILENAME .. && cd ..
143143
rm -rf $FAILED_LOGS_DIR
144144
if [ `which s3cmd` ] && [ -f $HOME/.s3cfg ]; then
145145
echo "configured s3cmd found in path. Attempting to upload logs to S3"
146146
s3cmd put $HOME/$FILENAME s3://$BUCKET
147147
rm $HOME/$FILENAME
148-
echo "Logs can be viewed here: https://s3.amazonaws.com/$BUCKET/$FILENAME"
148+
echo "Logs are accessible at https://s3.amazonaws.com/$BUCKET/$FILENAME"
149+
else
150+
echo "Logs are accessible at $HOME/$FILENAME"
149151
fi
150152
exit 1
151153
}

0 commit comments

Comments
 (0)