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:
parent
de8a31fa7b
commit
7a1a2b5a67
@ -42,7 +42,7 @@ _EXCEPTIONS_BY_CODE = {
|
|||||||
class Etcd3Client(object):
|
class Etcd3Client(object):
|
||||||
def __init__(self, host='localhost', port=2379, protocol="http",
|
def __init__(self, host='localhost', port=2379, protocol="http",
|
||||||
ca_cert=None, cert_key=None, cert_cert=None, timeout=None,
|
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
|
"""Construct an client to talk to etcd3's grpc-gateway's /v3 HTTP API
|
||||||
|
|
||||||
:param host:
|
:param host:
|
||||||
|
@ -22,17 +22,17 @@ class TestEtcd3Gateway(base.TestCase):
|
|||||||
|
|
||||||
def test_client_default(self):
|
def test_client_default(self):
|
||||||
client = Etcd3Client()
|
client = Etcd3Client()
|
||||||
self.assertEqual("http://localhost:2379/v3beta/lease/grant",
|
self.assertEqual("http://localhost:2379/v3alpha/lease/grant",
|
||||||
client.get_url("/lease/grant"))
|
client.get_url("/lease/grant"))
|
||||||
|
|
||||||
def test_client_ipv4(self):
|
def test_client_ipv4(self):
|
||||||
client = Etcd3Client(host="127.0.0.1")
|
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"))
|
client.get_url("/lease/grant"))
|
||||||
|
|
||||||
def test_client_ipv6(self):
|
def test_client_ipv6(self):
|
||||||
client = Etcd3Client(host="::1")
|
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"))
|
client.get_url("/lease/grant"))
|
||||||
|
|
||||||
def test_client_bad_request(self):
|
def test_client_bad_request(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user