Skip to content

Commit a1cc532

Browse files
committed
Wget presto rpm before running tests
1 parent d2d1593 commit a1cc532

File tree

3 files changed

+8
-25
lines changed

3 files changed

+8
-25
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ install:
2727
- pip install -r requirements.txt
2828
before_script:
2929
- make docker-images
30+
- make presto-server-rpm.rpm
3031
script:
3132
- |
3233
if [ -v PRODUCT_TEST_GROUP_SA_BARE ]; then

Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ help:
1313
@echo "clean-test - remove test and coverage artifacts"
1414
@echo "clean-docs - remove doc artifacts"
1515
@echo "lint - check style with flake8"
16+
@echo "get-presto-rpm - download the presto rpm"
1617
@echo "smoke - run tests annotated with attr smoke using nosetests"
1718
@echo "test - run tests quickly with Python 2.6 and 2.7"
1819
@echo "test-all - run tests on every Python version with tox. Specify TEST_SUITE env variable to run only a given suite."
@@ -72,6 +73,9 @@ clean-docs:
7273
lint:
7374
flake8 prestoadmin packaging tests
7475

76+
presto-server-rpm.rpm:
77+
wget 'https://repository.sonatype.org/service/local/artifact/maven/content?r=central-proxy&g=com.facebook.presto&a=presto-server-rpm&e=rpm&v=RELEASE' -O $@
78+
7579
smoke: clean-test docker-images
7680
tox -e py26 -- -a smoketest,'!quarantine'
7781

tests/product/standalone/presto_installer.py

+3-25
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import fnmatch
2020
import os
21-
import urllib
2221

2322
import prestoadmin
2423

@@ -102,27 +101,10 @@ def copy_presto_rpm_to_master(self, cluster=None):
102101
cluster = self.testcase.cluster
103102

104103
rpm_path = os.path.join(self.rpm_dir, self.rpm_name)
105-
try:
106-
cluster.copy_to_host(rpm_path, cluster.master)
107-
self._check_if_corrupted_rpm(self.rpm_name, cluster)
108-
except OSError:
109-
print 'Downloading RPM again'
110-
# try to download the RPM again if it's corrupt (but only once)
111-
StandalonePrestoInstaller._download_rpm()
112-
cluster.copy_to_host(rpm_path, cluster.master)
113-
self._check_if_corrupted_rpm(self.rpm_name, cluster)
104+
cluster.copy_to_host(rpm_path, cluster.master)
105+
self._check_if_corrupted_rpm(self.rpm_name, cluster)
114106
return self.rpm_name
115107

116-
@staticmethod
117-
def _download_rpm():
118-
rpm_filename = 'presto-server-rpm.rpm'
119-
rpm_path = os.path.join(prestoadmin.main_dir,
120-
rpm_filename)
121-
urllib.urlretrieve(
122-
'http://search.maven.org/remotecontent?filepath=com/facebook/presto/'
123-
'presto-server-rpm/0.148/presto-server-rpm-0.148.rpm', rpm_path)
124-
return rpm_filename
125-
126108
@staticmethod
127109
def _detect_presto_rpm():
128110
"""
@@ -136,11 +118,7 @@ def _detect_presto_rpm():
136118
# are multiple RPMs, the last one is probably the latest
137119
rpm_name = sorted(rpm_names)[-1]
138120
else:
139-
try:
140-
rpm_name = StandalonePrestoInstaller._download_rpm()
141-
except:
142-
# retry once
143-
rpm_name = StandalonePrestoInstaller._download_rpm()
121+
raise OSError(1, 'Presto RPM not detected.')
144122

145123
return prestoadmin.main_dir, rpm_name
146124

0 commit comments

Comments
 (0)