Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable travis to run tests #154

Merged
merged 1 commit into from
Mar 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
language: python
python:
- "2.7"
sudo: required
services:
- docker
env:
global:
- PA_TEST_ONLINE_INSTALLER=true
matrix:
- OTHER_TESTS=true
- PRODUCT_TEST_GROUP=0
- PRODUCT_TEST_GROUP=1
- PRODUCT_TEST_GROUP=2
- PRODUCT_TEST_GROUP=3
- PRODUCT_TEST_GROUP=4
- PRODUCT_TEST_GROUP=5
- PRODUCT_TEST_GROUP=6
- PRODUCT_TEST_GROUP=7
install:
- pip install --upgrade pip==6.1.1
- pip install -r requirements.txt
before-script:
- make docker-images
script:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just pushed #160 so that when we have future infra issues, we don't fail to build the base image for every test case. This means that the base image needs to be built prior to running the test cases. You can do this with make docker-images, I took a quick look at the travis docs, it looks like that should happen in a before-script section so that if it fails we won't try to run the product tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, so now product test execution should take less time, shouldn't it?

- |
if [ -v PRODUCT_TEST_GROUP ]; then
PRODUCT_TESTS=$(find tests/product/ -name '*py' | grep -v __init__ | xargs wc -l | sort -n | head -n -1 | awk '{print $2}' | awk "NR % 8 == $PRODUCT_TEST_GROUP" | tr '\n' ' ')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest combining the last two awk commands into awk "NR % 8 == $PRODUCT_TEST_GROUP { print $2 }", but it's up to you.

tox -e py26 -- -a '!quarantine,!offline_installer' $PRODUCT_TESTS
fi
- |
if [ -v OTHER_TESTS ]; then
make clean lint docs test test-rpm
fi
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[wheel]
universal = 0
[nosetests]
verbosity=3
verbosity=3
6 changes: 5 additions & 1 deletion tests/product/prestoadmin_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ def _build_dist_if_necessary(self, cluster, unique=False):
self._build_installer_in_docker(cluster, unique=unique)
return cluster.get_dist_dir(unique)

def _build_installer_in_docker(self, cluster, online_installer=False,
def _build_installer_in_docker(self, cluster, online_installer=None,
unique=False):
if online_installer is None:
paTestOnlineInstaller = os.environ.get('PA_TEST_ONLINE_INSTALLER')
online_installer = paTestOnlineInstaller is not None

container_name = 'installer'
installer_container = DockerCluster(
container_name, [], DEFAULT_LOCAL_MOUNT_POINT,
Expand Down
2 changes: 1 addition & 1 deletion tests/product/standalone/test_installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_install_from_different_dir(self):
self.cluster.master
)

@attr('smoketest')
@attr('smoketest', 'offline_installer')
@docker_only
def test_install_on_wrong_os_offline_installer(self):
image = 'ubuntu'
Expand Down
2 changes: 1 addition & 1 deletion tests/product/test_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def test_online_installer(self):
dist_dir=self.centos_container.get_dist_dir(unique=True))
self.run_prestoadmin('--help', raise_error=True)

@attr('smoketest')
@attr('smoketest', 'offline_installer')
def test_offline_installer(self):
self.pa_installer._build_installer_in_docker(
self.centos_container, online_installer=False, unique=True)
Expand Down