Skip to content

Commit

Permalink
Merge pull request #27 from epoch8/add_travis
Browse files Browse the repository at this point in the history
Add travis
  • Loading branch information
elephantum committed Nov 19, 2018
2 parents 3cc24d5 + 936457e commit d3b91ee
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
32 changes: 32 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
sudo: false

services:
- docker

# Docker-compose setup
# https://docs.travis-ci.com/user/docker/
env:
global:
- DOCKER_COMPOSE_VERSION=1.9.0
- INTEGRATION_TEST_SCRIPT=test_metrics_up.sh

before_install:
- sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
- chmod +x tests/test_metrics_up.sh


script:
# Test Airflow 1.8 with Python 2
- cd tests/airflow1.8-py2 && docker-compose up -d
- ${TRAVIS_BUILD_DIR}/tests/${INTEGRATION_TEST_SCRIPT}
- docker-compose down

# Test Airflow 1.9 with Python 3
- mkdir ${TRAVIS_BUILD_DIR}/tests/airflow1.9-py3/airflow/logs
- chmod -R 777 ${TRAVIS_BUILD_DIR}/tests/airflow1.9-py3/airflow/logs
- cd ${TRAVIS_BUILD_DIR}/tests/airflow1.9-py3 && docker-compose up -d
- ${TRAVIS_BUILD_DIR}/tests/${INTEGRATION_TEST_SCRIPT}
- docker-compose down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog
All notable changes to this project will be documented in this file.

## 0.4.2 - 2018-11-13

- [#13](https://github.com/epoch8/airflow-exporter/pull/20): Added test script and travis file by @hydrosquall
- [#13](https://github.com/epoch8/airflow-exporter/pull/27): fix run test in travis @cleverCat

## 0.4.1 - 2018-11-13

- Fix [#24](https://github.com/epoch8/airflow-exporter/issues/24): Unsupported mime-type by @szyn
Expand Down
1 change: 0 additions & 1 deletion tests/airflow1.8-py2/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
version: '2'


services:

exporter_postgresql:
Expand Down
19 changes: 19 additions & 0 deletions tests/test_metrics_up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Integration test that
# 1. Waits for Airflow to come up within 60 seconds
# 2. Ensures the Metrics endpoint returned a valid response
# Depends on Curl

AIRFLOW_SLEEP_DURATION=90 # Number of seconds to wait for airflow to start
ADMIN_ENDPOINT="http://localhost:8080/admin/"
METRICS_ENDPOINT="http://localhost:8080/admin/metrics/"

# Return nonzero status code if endpoint does not return 200
CURL_FLAGS="--show-error --fail"

echo "Waiting ${AIRFLOW_SLEEP_DURATION} seconds for Airflow to start before pinging"
sleep ${AIRFLOW_SLEEP_DURATION}
curl ${CURL_FLAGS} --silent --output /dev/null ${ADMIN_ENDPOINT} && echo 'Admin console is up'
curl ${CURL_FLAGS} ${METRICS_ENDPOINT}

# TODO: validate the contents of the CURLed data

0 comments on commit d3b91ee

Please sign in to comment.