Restore previous endpoint default (v3alpha)

v3beta endpoints are available since etcd 3.3 while current
platforms (Ubuntu Bionic, Focal; CentOS 8) provide 3.2.
Also, not to annoy existing clients and be a good SemVer citizen,
let's switch the default to its previous value.
It's configurable so new users can still switch it to use v3beta
(or v3 with 3.4).

Fixes #41
This commit is contained in:
Radosław Piliszek 2020-08-13 17:55:33 +02:00 committed by Davanum Srinivas
parent de8a31fa7b
commit 7a1a2b5a67
2 changed files with 4 additions and 4 deletions

View File

@ -42,7 +42,7 @@ _EXCEPTIONS_BY_CODE = {
class Etcd3Client(object):
def __init__(self, host='localhost', port=2379, protocol="http",
ca_cert=None, cert_key=None, cert_cert=None, timeout=None,
api_path='/v3beta/'):
api_path='/v3alpha/'):
"""Construct an client to talk to etcd3's grpc-gateway's /v3 HTTP API
:param host:

View File

@ -22,17 +22,17 @@ class TestEtcd3Gateway(base.TestCase):
def test_client_default(self):
client = Etcd3Client()
self.assertEqual("http://localhost:2379/v3beta/lease/grant",
self.assertEqual("http://localhost:2379/v3alpha/lease/grant",
client.get_url("/lease/grant"))
def test_client_ipv4(self):
client = Etcd3Client(host="127.0.0.1")
self.assertEqual("http://127.0.0.1:2379/v3beta/lease/grant",
self.assertEqual("http://127.0.0.1:2379/v3alpha/lease/grant",
client.get_url("/lease/grant"))
def test_client_ipv6(self):
client = Etcd3Client(host="::1")
self.assertEqual("http://[::1]:2379/v3beta/lease/grant",
self.assertEqual("http://[::1]:2379/v3alpha/lease/grant",
client.get_url("/lease/grant"))
def test_client_bad_request(self):