From d4277a620c5cfe04206499bed51fa616f5d4fcf9 Mon Sep 17 00:00:00 2001 From: Brandon Myers Date: Fri, 7 Sep 2018 14:41:58 -0500 Subject: [PATCH] Convert travis tests to use docker container --- .travis.yml | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 14e6873e..0c412773 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,21 @@ -language: python -python: - - '2.7.11' -before_install: - - ES_VERSION=5.6.7; curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}.deb && sudo dpkg -i --force-confnew elasticsearch-${ES_VERSION}.deb && sudo service elasticsearch restart - - sudo ln -fs /usr/share/zoneinfo/UTC /etc/localtime - - sudo dpkg-reconfigure --frontend noninteractive tzdata +sudo: required services: - - rabbitmq + - docker +branches: + # Restrict push builds to only master + only: + - master +before_install: + # Fail immediately on any error + - set -e install: - - "pip install -r requirements.txt" - - "pip install -r tests/requirements_tests.txt" + # Build containers + - docker-compose -f tests/docker-compose.yml -p mozdef build before_script: - - sleep 5 - - export BOTO_CONFIG=/dev/null + # Start up resources needed for tests + - docker-compose -f tests/docker-compose.yml -p mozdef up -d + # Give some time for Elasticsearch to start up + - sleep 10 script: - - py.test --delete_indexes --delete_queues tests + # Run unit tests + - docker run -it --network=mozdef_default mozdef_tester bash -c "source /opt/mozdef/envs/python/bin/activate && py.test --delete_indexes --delete_queues tests" \ No newline at end of file