10
10
# License for the specific language governing permissions and limitations
11
11
# under the License.
12
12
13
+ import http .client
13
14
import os
14
15
import unittest
15
- import urllib3
16
16
17
17
from kubernetes_asyncio .client .configuration import Configuration
18
18
from kubernetes_asyncio .config import kube_config
@@ -29,16 +29,17 @@ def get_e2e_configuration():
29
29
else :
30
30
print ('Unable to load config from %s' %
31
31
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' ) ]:
34
34
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 )
37
38
config .verify_ssl = False
38
- urllib3 .disable_warnings ()
39
39
break
40
- except urllib3 . exceptions . HTTPError :
40
+ except ConnectionRefusedError :
41
41
pass
42
+
42
43
if config .host is None :
43
44
raise unittest .SkipTest ('Unable to find a running Kubernetes instance' )
44
45
print ('Running test against : %s' % config .host )
0 commit comments