Skip to content
This repository was archived by the owner on Jul 18, 2024. It is now read-only.

Commit 97a26bb

Browse files
committed
add travis tests
1 parent b6b9ffc commit 97a26bb

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed

.travis.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
##############################################################################
2+
# Copyright 2017 IBM Corporation
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
##############################################################################
15+
language: bash
16+
sudo: true
17+
18+
script:
19+
- ./travis-test.sh

travis-test.sh

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
3+
##############################################################################
4+
# Copyright 2017 IBM Corporation
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
##############################################################################
17+
set -e
18+
19+
OPEN_WHISK_BIN=/home/ubuntu/bin
20+
LINK=https://openwhisk.ng.bluemix.net/cli/go/download/linux/amd64/wsk
21+
22+
echo "Downloading OpenWhisk CLI from '$LINK'...\n"
23+
curl -O $LINK
24+
chmod u+x wsk
25+
export PATH=$PATH:`pwd`
26+
27+
echo "Configuring CLI from apihost and API key\n"
28+
wsk property set --apihost openwhisk.ng.bluemix.net --auth $OPEN_WHISK_KEY #OPEN_WHISK_KEY defined in travis-ci console
29+
30+
echo "Configure local.env"
31+
touch local.env #Configurations defined in travis-ci console
32+
33+
echo "installing jq for bash json parsing"
34+
sudo apt-get install jq
35+
36+
echo "Deploying wsk actions, etc."
37+
./deploy.sh --install
38+
39+
echo "Waiting for triggers/actions to finish installing (sleep 5)"
40+
sleep 5
41+
42+
echo "Publishing a kafka message"
43+
./kafka_publish.sh
44+
45+
echo "Waiting for triggers/actions to finish executing(sleep 5)"
46+
sleep 5
47+
48+
echo "Consuming kafka out-topic queue"
49+
KAFKA_MESSAGE=`./kafka_consume.sh | tail -3 | head -1`
50+
echo "consumed message: $KAFKA_MESSAGE"
51+
52+
MSG_AGENT=`echo $KAFKA_MESSAGE | jq -r '.agent'`
53+
if [[ $MSG_AGENT == "OpenWhisk action" ]]
54+
then
55+
echo "Found the message we were expecting"
56+
else
57+
echo "Something went wrong"
58+
echo "Uninstalling wsk actions, etc."
59+
./deploy.sh --uninstall
60+
exit -1
61+
fi
62+
63+
echo "Uninstalling wsk actions, etc."
64+
./deploy.sh --uninstall

0 commit comments

Comments
 (0)