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

Fix etcd v3.4 cluster works #135

Merged
merged 1 commit into from
May 20, 2021
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
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.13/etcd-v3.4.13-linux-amd64.tar.gz -O /opt/etcd.tar.gz
- tar -zxf /opt/etcd.tar.gz -C /opt
- ln -s /opt/etcd-v3.4.13-linux-amd64/etcd /opt/etcd
- ln -s /opt/etcd-v3.4.13-linux-amd64/etcdctl /opt/etcdctl
install:
# The install requirements in travis virtualenv that will be cached
- pip install tox-travis .[test,ceph]
Expand Down
6 changes: 4 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="listening for peers on")

endpoints = ",".join(client_url
for peer_url, client_url in http_urls)
Expand All @@ -81,11 +81,13 @@ 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="ready to serve client requests")
endpoints = client_url

self.putenv("ETCD_PORT", str(self.port))
self.putenv("ETCD_PEER_PORT", str(self.peer_port))
self.putenv("HTTP_URL", "http://localhost:%d" % self.port)
self.putenv("URL", "etcd://localhost:%d" % self.port)
self.putenv("ETCDCTL_ENDPOINTS", endpoints, True)
self.putenv("ETCDCTL_API", "3", True)
self._exec(["etcdctl", "endpoint", "health"])
8 changes: 6 additions & 2 deletions pifpaf/tests/test_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ def test_elasticsearch(self):

@testtools.skipUnless(spawn.find_executable("etcd"),
"etcd not found")
@testtools.skipUnless(spawn.find_executable("etcdctl"),
"etcdctl not found")
def test_etcd(self):
port = 4005
peer_port = 4006
Expand All @@ -129,10 +131,12 @@ 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")
@testtools.skipUnless(spawn.find_executable("etcdctl"),
"etcdctl not found")
def test_etcd_cluster(self):
port = 4007
peer_port = 4008
Expand All @@ -143,7 +147,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