Skip to content

Commit fb68f98

Browse files
authored
Merge pull request #20 from tomplus/feat/remove-synclib
feat: replace urllib3 by http.client in e2e initializer
2 parents 0cdaf21 + ed4d09a commit fb68f98

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

kubernetes_asyncio/e2e_test/base.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
# License for the specific language governing permissions and limitations
1111
# under the License.
1212

13+
import http.client
1314
import os
1415
import unittest
15-
import urllib3
1616

1717
from kubernetes_asyncio.client.configuration import Configuration
1818
from kubernetes_asyncio.config import kube_config
@@ -29,16 +29,17 @@ def get_e2e_configuration():
2929
else:
3030
print('Unable to load config from %s' %
3131
kube_config.KUBE_CONFIG_DEFAULT_LOCATION)
32-
for url in ['https://%s:8443' % DEFAULT_E2E_HOST,
33-
'http://%s:8080' % DEFAULT_E2E_HOST]:
32+
for proto, host, port in [('https', DEFAULT_E2E_HOST, '8443'),
33+
('http', DEFAULT_E2E_HOST, '8080')]:
3434
try:
35-
urllib3.PoolManager().request('GET', url)
36-
config.host = url
35+
print('Testing:', proto, host, port)
36+
http.client.HTTPConnection(host, port).request('GET', '/')
37+
config.host = "{}://{}:{}".format(proto, host, port)
3738
config.verify_ssl = False
38-
urllib3.disable_warnings()
3939
break
40-
except urllib3.exceptions.HTTPError:
40+
except ConnectionRefusedError:
4141
pass
42+
4243
if config.host is None:
4344
raise unittest.SkipTest('Unable to find a running Kubernetes instance')
4445
print('Running test against : %s' % config.host)

0 commit comments

Comments
 (0)