Skip to content

Commit c511d9a

Browse files
authored
Added integration tests (#1)
1 parent 785c1e2 commit c511d9a

File tree

2 files changed

+45
-11
lines changed

2 files changed

+45
-11
lines changed

.travis.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1+
os: linux
12
language: python
2-
33
dist: xenial
4-
54
cache: pip
65

76
notifications:
87
email: true
98

10-
matrix:
11-
include:
12-
- python: 3.5
13-
- python: 3.6
14-
- python: 3.7
15-
- python: 3.8
9+
matrix:
10+
include:
11+
- python: 3.5
12+
- python: 3.6
13+
- python: 3.7
14+
- python: 3.8
1615

1716
before_install:
1817
- npm install npm@latest -g
@@ -23,9 +22,15 @@ before_install:
2322

2423
install:
2524
- pip install tox-travis
26-
27-
script: tox
28-
25+
- pip install -r requirements.txt
26+
- pip install -r requirements-dev.txt
27+
- pip install .
28+
- python setup.py build
29+
30+
script:
31+
- tox
32+
- pytest test
33+
- ./test-integration.sh
2934

3035
# To enable semantic-release, uncomment these sections.
3136
# before_deploy:

test-integration.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Code Engine Python SDK Integration tests
2+
# Requires the following env. variables (provdied to TravisCI)
3+
# - CE_API_KEY: IBM Cloud API Key
4+
# - CE_PROJECT_ID: GUID of Code Engine project to target
5+
# - CE_PROJECT_REGION: region for API URL
6+
7+
echo "Running integration tests..."
8+
9+
# Install dependencies
10+
pip install kubernetes
11+
12+
# Run example, get exit code
13+
exampleoutput=$(python example/example.py)
14+
exampleexit=$?
15+
if [ $exampleexit -ne 0 ]; then
16+
echo "Integration tests failed with exit code $exampleexit"
17+
echo $exampleoutput
18+
exit $exampleexit
19+
fi
20+
21+
# Check if output is expected
22+
outputcheck="2 configmaps"
23+
if [[ $exampleoutput != *$outputcheck* ]]; then
24+
echo "Intergration test output is incorrect:"
25+
echo "Expected '$exampleoutput' to contain '$outputcheck'"
26+
exit 1
27+
fi
28+
29+
echo "Success!"

0 commit comments

Comments
 (0)