Skip to content

Commit d45dc77

Browse files
author
Gabriel Monroy
committed
chore(tests): add log_phase helper
chore(tests): use log_phase in test-setup fix(tests): log when testing docs fix(tests): switch test-smoke to log_phase
1 parent cb6715c commit d45dc77

5 files changed

Lines changed: 53 additions & 120 deletions

File tree

tests/bin/test-acceptance.sh

Lines changed: 14 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,48 +17,36 @@ source $THIS_DIR/test-setup.sh
1717
trap cleanup EXIT
1818
trap dump_logs ERR
1919

20-
echo
21-
echo "Running test-acceptance..."
22-
echo
23-
24-
# test building documentation
25-
make -C docs/ test
26-
27-
echo
28-
echo "Building from current source tree..."
29-
echo
20+
log_phase "Building from current source tree"
3021

3122
# build all docker images and client binaries
3223
make build
3324

3425
# use the built client binaries
3526
export PATH=$DEIS_ROOT/deisctl:$DEIS_ROOT/client/dist:$PATH
3627

37-
echo
38-
echo "Running unit and functional tests..."
39-
echo
28+
log_phase "Running documentation tests"
29+
30+
make -C docs/ test
31+
32+
log_phase "Running unit and functional tests"
4033

4134
make test-components
4235

43-
echo
44-
echo "Provisioning 3-node CoreOS..."
45-
echo
36+
log_phase "Provisioning 3-node CoreOS"
4637

4738
export DEIS_NUM_INSTANCES=3
4839
git checkout $DEIS_ROOT/contrib/coreos/user-data
4940
make discovery-url
5041
vagrant up --provider virtualbox
5142

52-
echo
53-
echo "Waiting for etcd/fleet..."
43+
log_phase "Waiting for etcd/fleet"
5444

5545
until deisctl list >/dev/null 2>&1; do
5646
sleep 1
5747
done
5848

59-
echo
60-
echo "Provisioning Deis on old release..."
61-
echo
49+
log_phase "Provisioning Deis on old release"
6250

6351
function set_release {
6452
deisctl config $1 set image=deis/$1:$2
@@ -75,27 +63,19 @@ deisctl scale router=3
7563
deisctl start router@1 router@2 router@3
7664
time deisctl start platform
7765

78-
echo
79-
echo "Running smoke tests..."
80-
echo
66+
log_phase "Running smoke tests"
8167

8268
time make test-smoke
8369

84-
echo
85-
echo "Publishing new release..."
86-
echo
70+
log_phase "Publishing new release"
8771

8872
time make release
8973

90-
echo
91-
echo "Updating channel with new release..."
92-
echo
74+
log_phase "Updating channel with new release"
9375

9476
updateservicectl channel update --app-id=${APP_ID} --channel=${CHANNEL} --version=${BUILD_TAG} --publish=true
9577

96-
echo
97-
echo "Waiting for upgrade to complete..."
98-
echo
78+
log_phase "Waiting for upgrade to complete"
9979

10080
deisctl config platform channel=${CHANNEL} autoupdate=true
10181

@@ -116,8 +96,6 @@ wait_for_update deis-3 &
11696
update3=$!
11797
wait update1 update2 update3
11898

119-
echo
120-
echo "Running end-to-end integration test..."
121-
echo
99+
log_phase "Running end-to-end integration test"
122100

123101
time make test-integration

tests/bin/test-integration.sh

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,62 +17,47 @@ source $THIS_DIR/test-setup.sh
1717
trap cleanup EXIT
1818
trap dump_logs ERR
1919

20-
echo
21-
echo "Running test-integration..."
22-
echo
23-
24-
# test building documentation
25-
make -C docs/ test
26-
27-
echo
28-
echo "Building from current source tree..."
29-
echo
20+
log_phase "Building from current source tree"
3021

3122
# build all docker images and client binaries
3223
make build
3324

3425
# use the built client binaries
3526
export PATH=$DEIS_ROOT/deisctl:$DEIS_ROOT/client/dist:$PATH
3627

37-
echo
38-
echo "Running unit and functional tests..."
39-
echo
28+
log_phase "Running documentation tests"
29+
30+
# test building documentation
31+
make -C docs/ test
32+
33+
log_phase "Running unit and functional tests"
4034

4135
make test-components
4236

43-
echo
44-
echo "Provisioning 3-node CoreOS..."
45-
echo
37+
log_phase "Provisioning 3-node CoreOS"
4638

4739
export DEIS_NUM_INSTANCES=3
4840
git checkout $DEIS_ROOT/contrib/coreos/user-data
4941
make discovery-url
5042
vagrant up --provider virtualbox
5143

52-
echo
53-
echo "Waiting for etcd/fleet..."
44+
log_phase "Waiting for etcd/fleet"
5445

5546
until deisctl list >/dev/null 2>&1; do
5647
sleep 1
5748
done
5849

59-
echo
60-
echo "Publishing release from source tree..."
61-
echo
50+
log_phase "Publishing release from source tree"
6251

6352
make dev-release
6453

65-
echo
66-
echo "Provisioning Deis..."
67-
echo
54+
log_phase "Provisioning Deis"
6855

6956
deisctl install platform
7057
deisctl scale router=3
7158
deisctl start router@1 router@2 router@3
7259
time deisctl start platform
7360

74-
echo
75-
echo "Running integration suite..."
76-
echo
61+
log_phase "Running integration suite"
7762

7863
time make test-integration

tests/bin/test-nightly.sh

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@ source $THIS_DIR/test-setup.sh
1818
trap cleanup EXIT
1919
trap dump_logs ERR
2020

21-
echo
22-
echo "Running test-nightly on $DEIS_TEST_APP..."
23-
echo
21+
log_phase "Running test-nightly on $DEIS_TEST_APP"
2422

25-
echo
26-
echo "Installing clients..."
27-
echo
23+
log_phase "Installing clients"
2824

2925
# FIXME: switch to deis CLI install from website
3026
cd $DEIS_ROOT/client
@@ -34,35 +30,28 @@ cd $THIS_DIR
3430
# install latest deisctl from the website
3531
curl -sSL http://deis.io/deisctl/install.sh | sudo sh
3632

37-
echo
38-
echo "Provisioning 3-node CoreOS..."
39-
echo
33+
log_phase "Provisioning 3-node CoreOS"
4034

4135
export DEIS_NUM_INSTANCES=3
4236
git checkout contrib/coreos/user-data
4337
make discovery-url
4438
vagrant up --provider virtualbox
4539

46-
echo
47-
echo "Waiting for etcd/fleet..."
40+
log_phase "Waiting for etcd/fleet"
4841

4942
until deisctl list >/dev/null 2>&1; do
5043
sleep 1
5144
done
5245

53-
echo
54-
echo "Provisioning Deis..."
55-
echo
46+
log_phase "Provisioning Deis"
5647

5748
# provision deis from master using :latest
5849
deisctl install platform
5950
deisctl scale router=3
6051
deisctl start router@1 router@2 router@3
6152
time deisctl start platform
6253

63-
echo
64-
echo "Running integration tests..."
65-
echo
54+
log_phase "Running integration tests"
6655

6756
# run the full integration suite
6857
time make test-integration

tests/bin/test-setup.sh

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
#
33
# Prepares the process environment to run a test
44

5-
echo
6-
echo "Preparing test environment..."
7-
echo
5+
function log_phase {
6+
echo
7+
echo ">>> $1 <<<"
8+
echo
9+
}
10+
11+
log_phase "Preparing test environment"
812

913
# use GOPATH to determine project root
1014
export DEIS_ROOT=${GOPATH?}/src/github.com/deis/deis
@@ -64,22 +68,16 @@ vagrant destroy --force
6468

6569
# wipe out all vagrants & deis virtualboxen
6670
function cleanup {
67-
echo
68-
echo "Cleaning up..."
69-
echo
71+
log_phase "Cleaning up"
7072
set +e
7173
${GOPATH}/src/github.com/deis/deis/tests/bin/destroy-all-vagrants.sh
7274
VBoxManage list vms | grep deis | sed -n -e 's/^.* {\(.*\)}/\1/p' | xargs -L1 -I {} VBoxManage unregistervm {} --delete
7375
vagrant global-status --prune
74-
echo
75-
echo "Test run complete."
76-
echo
76+
log_phase "Test run complete"
7777
}
7878

7979
function dump_logs {
80-
echo
81-
echo "Error detected, dumping logs..."
82-
echo
80+
log_phase "Error detected, dumping logs"
8381
set +e
8482
export FLEETCTL_TUNNEL=$DEISCTL_TUNNEL
8583
set -x

tests/bin/test-smoke.sh

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,63 +17,46 @@ source $THIS_DIR/test-setup.sh
1717
trap cleanup EXIT
1818
trap dump_logs ERR
1919

20-
echo
21-
echo "Running test-smoke..."
22-
echo
23-
24-
# test building documentation
25-
make -C docs/ test
26-
27-
echo
28-
echo "Building from current source tree..."
29-
echo
20+
log_phase "Building from current source tree"
3021

3122
# build all docker images and client binaries
3223
make build
3324

3425
# use the built client binaries
3526
export PATH=$DEIS_ROOT/deisctl:$DEIS_ROOT/client/dist:$PATH
3627

37-
echo
38-
echo "Running unit and functional tests..."
39-
echo
28+
log_phase "Running test-smoke"
29+
30+
make -C docs/ test
31+
32+
log_phase "Running unit and functional tests"
4033

4134
make test-components
4235

43-
echo
44-
echo "Provisioning 3-node CoreOS..."
45-
echo
36+
log_phase "Provisioning 3-node CoreOS"
4637

4738
export DEIS_NUM_INSTANCES=3
4839
git checkout $DEIS_ROOT/contrib/coreos/user-data
4940
make discovery-url
5041
vagrant up --provider virtualbox
5142

52-
echo
53-
echo "Waiting for etcd/fleet..."
54-
echo
43+
log_phase "Waiting for etcd/fleet"
5544

5645
until deisctl list >/dev/null 2>&1; do
5746
sleep 1
5847
done
5948

60-
echo
61-
echo "Publishing release from source tree..."
62-
echo
49+
log_phase "Publishing release from source tree"
6350

6451
make dev-release
6552

66-
echo
67-
echo "Provisioning Deis..."
68-
echo
53+
log_phase "Provisioning Deis"
6954

7055
time deisctl install platform
7156
deisctl scale router=3
7257
deisctl start router@1 router@2 router@3
7358
time deisctl start platform
7459

75-
echo
76-
echo "Starting smoke tests..."
77-
echo
60+
log_phase "Starting smoke tests"
7861

7962
time make test-smoke

0 commit comments

Comments
 (0)