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

shorten etcd wait_for_line (~3.4 compatibility) #121

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ before_install:
- wget https://archive.apache.org/dist/kafka/2.6.0/kafka_2.12-2.6.0.tgz -O /opt/kafka.tar.gz
- tar -xzf /opt/kafka.tar.gz -C /opt
- ln -s /opt/kafka_2.12-2.6.0 /opt/kafka
- wget https://github.com/etcd-io/etcd/releases/download/v3.4.3/etcd-v3.4.3-linux-amd64.tar.gz -O /opt/etcd.tar.gz
- sudo tar -zxf /opt/etcd.tar.gz -C /opt
- sudo ln -s /opt/etcd-v3.4.3-linux-amd64/etcd /usr/local/bin/etcd
- sudo ln -s /opt/etcd-v3.4.3-linux-amd64/etcdctl /usr/local/bin/etcdctl
install:
# The install requirements in travis virtualenv that will be cached
- pip install tox-travis .[test,ceph]
Expand Down
4 changes: 2 additions & 2 deletions pifpaf/drivers/etcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _setUp(self):
for i, (peer_url, client_url)
in enumerate(http_urls)),
"--initial-cluster-state", "new",
], wait_for_line="listening for client requests on")
], wait_for_line="client requests on")

endpoints = ",".join(client_url
for peer_url, client_url in http_urls)
Expand All @@ -81,7 +81,7 @@ def _setUp(self):
"--listen-peer-urls", peer_url,
"--listen-client-urls", client_url,
"--advertise-client-urls", client_url],
wait_for_line="listening for client requests on")
wait_for_line="client requests on")
endpoints = client_url

self.putenv("ETCD_PORT", str(self.port))
Expand Down
6 changes: 3 additions & 3 deletions pifpaf/tests/test_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def setUp(self):
)

def _run(self, cmd):
self.assertEqual(0, os.system(cmd + " >/dev/null 2>&1"))
self.assertEqual(0, os.system(cmd))

def _do_test_stuck(self, cmd):
d = drivers.Driver(debug=True)
Expand Down Expand Up @@ -129,7 +129,7 @@ def test_etcd(self):
self.assertEqual(str(port), os.getenv("PIFPAF_ETCD_PORT"))
r = requests.get("http://localhost:%d/version" % port)
self.assertEqual(200, r.status_code)
self._run("etcdctl cluster-health")
self._run("etcdctl endpoint health")

@testtools.skipUnless(spawn.find_executable("etcd"),
"etcd not found")
Expand All @@ -143,7 +143,7 @@ def test_etcd_cluster(self):
self.assertEqual(str(port), os.getenv("PIFPAF_ETCD_PORT"))
r = requests.get("http://localhost:%d/version" % port)
self.assertEqual(200, r.status_code)
self._run("etcdctl cluster-health")
self._run("etcdctl endpoint health")

@testtools.skipUnless(spawn.find_executable("consul"),
"consul not found")
Expand Down