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

Commit f135475

Browse files
committed
Run tests on Ubuntu 16.04.
This commit also switches us from coveralls to codecov.
1 parent 72c71de commit f135475

6 files changed

Lines changed: 52 additions & 20 deletions

File tree

.travis.yml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
language: python
2-
python: "2.7"
3-
install:
4-
- "pip install coveralls"
5-
- "make test.install_elasticsearch"
6-
cache: pip
7-
# Use docker for builds
8-
sudo: false
9-
before_script:
10-
- make test.run_elasticsearch
11-
# Recommended by Travis in order to make sure ElasticSearch
12-
# actually starts up. See # https://docs.travis-ci.com/user/database-setup/#ElasticSearch
13-
- sleep 10
2+
python:
3+
- "2.7"
4+
5+
services:
6+
- docker
7+
sudo: required
8+
9+
before_install:
10+
- docker-compose -f .travis/docker-compose-travis.yml up -d
11+
1412
script:
15-
- make validate
16-
- git fetch origin master:refs/remotes/origin/master # https://github.com/edx/diff-cover#troubleshooting
17-
- make diff.report
13+
- docker exec analytics_api_testing /edx/app/analytics_api/analytics_api/.travis/run_tests.sh
14+
1815
after_success:
19-
- coveralls
20-
- bash ./scripts/build-stats-to-datadog.sh
16+
- pip install -U codecov
17+
- docker exec analytics_api_testing /edx/app/analytics_api/analytics_api/.travis/run_coverage.sh
18+
- codecov

.travis/docker-compose-travis.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: "2"
2+
3+
services:
4+
analytics_api:
5+
image: edxops/analytics_api:latest
6+
container_name: analytics_api_testing
7+
volumes:
8+
- ..:/edx/app/analytics_api/analytics_api
9+
command: tail -f /dev/null
10+
environment:
11+
ELASTICSEARCH_LEARNERS_HOST: 'http://es:9200/'
12+
# Pull these from the host environment.
13+
TRAVIS_BRANCH:
14+
TRAVIS_PULL_REQUEST:
15+
DATADOG_API_KEY:
16+
depends_on:
17+
- "es"
18+
es:
19+
image: elasticsearch:1.5.2
20+
container_name: es

.travis/run_coverage.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash -xe
2+
. /edx/app/analytics_api/venvs/analytics_api/bin/activate
3+
4+
cd /edx/app/analytics_api/analytics_api
5+
6+
make diff.report
7+
coverage xml
8+
bash ./scripts/build-stats-to-datadog.sh

.travis/run_tests.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash -xe
2+
. /edx/app/analytics_api/venvs/analytics_api/bin/activate
3+
4+
cd /edx/app/analytics_api/analytics_api
5+
6+
make validate

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,5 @@ will make your contribution more likely to be accepted.
9191

9292
.. |build-status| image:: https://travis-ci.org/edx/edx-analytics-data-api.svg?branch=master
9393
:target: https://travis-ci.org/edx/edx-analytics-data-api
94-
.. |coverage-status| image:: https://coveralls.io/repos/edx/edx-analytics-data-api/badge.png?branch=master
95-
:target: https://coveralls.io/r/edx/edx-analytics-data-api?branch=master
94+
.. |coverage-status| image:: https://img.shields.io/codecov/c/github/edx/edx-analytics-data-api/master.svg
95+
:target: https://codecov.io/gh/edx/edx-analytics-data-api

analyticsdataserver/settings/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
2727

2828
# Default elasticsearch port when running locally
29-
ELASTICSEARCH_LEARNERS_HOST = 'http://localhost:9223/'
29+
ELASTICSEARCH_LEARNERS_HOST = environ.get("ELASTICSEARCH_LEARNERS_HOST", 'http://localhost:9223/')
3030
ELASTICSEARCH_LEARNERS_INDEX = 'roster_test'
3131
ELASTICSEARCH_LEARNERS_UPDATE_INDEX = 'index_update_test'
3232

0 commit comments

Comments
 (0)