diff --git a/.travis.yml b/.travis.yml index 22f9eeb..e060fab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,18 +1,17 @@ +os: linux language: python - dist: xenial - cache: pip notifications: email: true - matrix: - include: - - python: 3.5 - - python: 3.6 - - python: 3.7 - - python: 3.8 +matrix: + include: + - python: 3.5 + - python: 3.6 + - python: 3.7 + - python: 3.8 before_install: - npm install npm@latest -g @@ -23,9 +22,15 @@ before_install: install: - pip install tox-travis - -script: tox - +- pip install -r requirements.txt +- pip install -r requirements-dev.txt +- pip install . +- python setup.py build + +script: +- tox +- pytest test +- ./test-integration.sh # To enable semantic-release, uncomment these sections. # before_deploy: diff --git a/test-integration.sh b/test-integration.sh new file mode 100755 index 0000000..a636808 --- /dev/null +++ b/test-integration.sh @@ -0,0 +1,29 @@ +# Code Engine Python SDK Integration tests +# Requires the following env. variables (provdied to TravisCI) +# - CE_API_KEY: IBM Cloud API Key +# - CE_PROJECT_ID: GUID of Code Engine project to target +# - CE_PROJECT_REGION: region for API URL + +echo "Running integration tests..." + +# Install dependencies +pip install kubernetes + +# Run example, get exit code +exampleoutput=$(python example/example.py) +exampleexit=$? +if [ $exampleexit -ne 0 ]; then + echo "Integration tests failed with exit code $exampleexit" + echo $exampleoutput + exit $exampleexit +fi + +# Check if output is expected +outputcheck="2 configmaps" +if [[ $exampleoutput != *$outputcheck* ]]; then + echo "Intergration test output is incorrect:" + echo "Expected '$exampleoutput' to contain '$outputcheck'" + exit 1 +fi + +echo "Success!" \ No newline at end of file