@@ -26,13 +26,10 @@ class TestClient(unittest.TestCase):
2626
2727 @classmethod
2828 def setUpClass (cls ):
29- cls .API_URL = 'http://127.0.0.1:8080/'
30- cls .config = configuration
29+ cls .config = base .get_e2e_configuration ()
3130
32- @unittest .skipUnless (
33- base .is_k8s_running (), "Kubernetes is not available" )
3431 def test_pod_apis (self ):
35- client = api_client .ApiClient (self . API_URL , config = self .config )
32+ client = api_client .ApiClient (config = self .config )
3633 api = core_v1_api .CoreV1Api (client )
3734
3835 name = 'busybox-test-' + str (uuid .uuid4 ())
@@ -79,16 +76,22 @@ def test_pod_apis(self):
7976 print ('EXEC response : %s' % resp )
8077 self .assertEqual (3 , len (resp .splitlines ()))
8178
79+ exec_command = 'uptime'
80+ resp = api .connect_post_namespaced_pod_exec (name , 'default' ,
81+ command = exec_command ,
82+ stderr = False , stdin = False ,
83+ stdout = True , tty = False )
84+ print ('EXEC response : %s' % resp )
85+ self .assertEqual (1 , len (resp .splitlines ()))
86+
8287 number_of_pods = len (api .list_pod_for_all_namespaces ().items )
8388 self .assertTrue (number_of_pods > 0 )
8489
8590 resp = api .delete_namespaced_pod (name = name , body = {},
8691 namespace = 'default' )
8792
88- @unittest .skipUnless (
89- base .is_k8s_running (), "Kubernetes is not available" )
9093 def test_service_apis (self ):
91- client = api_client .ApiClient (self . API_URL , config = self .config )
94+ client = api_client .ApiClient (config = self .config )
9295 api = core_v1_api .CoreV1Api (client )
9396
9497 name = 'frontend-' + str (uuid .uuid4 ())
@@ -126,10 +129,8 @@ def test_service_apis(self):
126129 resp = api .delete_namespaced_service (name = name ,
127130 namespace = 'default' )
128131
129- @unittest .skipUnless (
130- base .is_k8s_running (), "Kubernetes is not available" )
131132 def test_replication_controller_apis (self ):
132- client = api_client .ApiClient (self . API_URL , config = self .config )
133+ client = api_client .ApiClient (config = self .config )
133134 api = core_v1_api .CoreV1Api (client )
134135
135136 name = 'frontend-' + str (uuid .uuid4 ())
@@ -161,10 +162,8 @@ def test_replication_controller_apis(self):
161162 resp = api .delete_namespaced_replication_controller (
162163 name = name , body = {}, namespace = 'default' )
163164
164- @unittest .skipUnless (
165- base .is_k8s_running (), "Kubernetes is not available" )
166165 def test_configmap_apis (self ):
167- client = api_client .ApiClient (self . API_URL , config = self .config )
166+ client = api_client .ApiClient (config = self .config )
168167 api = core_v1_api .CoreV1Api (client )
169168
170169 name = 'test-configmap-' + str (uuid .uuid4 ())
@@ -199,21 +198,11 @@ def test_configmap_apis(self):
199198 resp = api .list_namespaced_config_map ('kube-system' , pretty = True )
200199 self .assertEqual ([], resp .items )
201200
202- @unittest .skipUnless (
203- base .is_k8s_running (), "Kubernetes is not available" )
204201 def test_node_apis (self ):
205- client = api_client .ApiClient (self . API_URL , config = self .config )
202+ client = api_client .ApiClient (config = self .config )
206203 api = core_v1_api .CoreV1Api (client )
207204
208205 for item in api .list_node ().items :
209206 node = api .read_node (name = item .metadata .name )
210207 self .assertTrue (len (node .metadata .labels ) > 0 )
211- self .assertTrue (isinstance (node .metadata .labels , dict ))
212-
213-
214- class TestClientSSL (TestClient ):
215-
216- @classmethod
217- def setUpClass (cls ):
218- cls .API_URL = 'https://127.0.0.1:8443/'
219- cls .config = base .setSSLConfiguration ()
208+ self .assertTrue (isinstance (node .metadata .labels , dict ))
0 commit comments