Fix end to end tests
This commit is contained in:
parent
789e37464b
commit
1d27f7e71b
@ -10,19 +10,18 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
import os
|
||||
import unittest
|
||||
import urllib3
|
||||
|
||||
from kubernetes.client.configuration import configuration
|
||||
from kubernetes.client.configuration import Configuration
|
||||
from kubernetes.config import kube_config
|
||||
|
||||
DEFAULT_E2E_HOST = '127.0.0.1'
|
||||
|
||||
|
||||
def get_e2e_configuration():
|
||||
config = copy.copy(configuration)
|
||||
config = Configuration()
|
||||
config.host = None
|
||||
if os.path.exists(
|
||||
os.path.expanduser(kube_config.KUBE_CONFIG_DEFAULT_LOCATION)):
|
||||
|
||||
@ -28,7 +28,7 @@ class TestClientBatch(unittest.TestCase):
|
||||
|
||||
|
||||
def test_job_apis(self):
|
||||
client = api_client.ApiClient(config=self.config)
|
||||
client = api_client.ApiClient(configuration=self.config)
|
||||
api = batch_v1_api.BatchV1Api(client)
|
||||
|
||||
name = 'test-job-' + str(uuid.uuid4())
|
||||
|
||||
@ -21,6 +21,7 @@ from kubernetes.client import api_client
|
||||
from kubernetes.client.apis import core_v1_api
|
||||
from kubernetes.e2e_test import base
|
||||
from kubernetes.stream import stream
|
||||
from kubernetes.stream.ws_client import ERROR_CHANNEL
|
||||
|
||||
|
||||
def short_uuid():
|
||||
@ -35,7 +36,7 @@ class TestClient(unittest.TestCase):
|
||||
cls.config = base.get_e2e_configuration()
|
||||
|
||||
def test_pod_apis(self):
|
||||
client = api_client.ApiClient(config=self.config)
|
||||
client = api_client.ApiClient(configuration=self.config)
|
||||
api = core_v1_api.CoreV1Api(client)
|
||||
|
||||
name = 'busybox-test-' + short_uuid()
|
||||
@ -105,7 +106,7 @@ class TestClient(unittest.TestCase):
|
||||
self.assertEqual("test string 2", line)
|
||||
resp.write_stdin("exit\n")
|
||||
resp.update(timeout=5)
|
||||
line = resp.read_channel(api_client.ws_client.ERROR_CHANNEL)
|
||||
line = resp.read_channel(ERROR_CHANNEL)
|
||||
status = json.loads(line)
|
||||
self.assertEqual(status['status'], 'Success')
|
||||
resp.update(timeout=5)
|
||||
@ -118,7 +119,7 @@ class TestClient(unittest.TestCase):
|
||||
namespace='default')
|
||||
|
||||
def test_service_apis(self):
|
||||
client = api_client.ApiClient(config=self.config)
|
||||
client = api_client.ApiClient(configuration=self.config)
|
||||
api = core_v1_api.CoreV1Api(client)
|
||||
|
||||
name = 'frontend-' + short_uuid()
|
||||
@ -157,7 +158,7 @@ class TestClient(unittest.TestCase):
|
||||
namespace='default')
|
||||
|
||||
def test_replication_controller_apis(self):
|
||||
client = api_client.ApiClient(config=self.config)
|
||||
client = api_client.ApiClient(configuration=self.config)
|
||||
api = core_v1_api.CoreV1Api(client)
|
||||
|
||||
name = 'frontend-' + short_uuid()
|
||||
@ -190,7 +191,7 @@ class TestClient(unittest.TestCase):
|
||||
name=name, body={}, namespace='default')
|
||||
|
||||
def test_configmap_apis(self):
|
||||
client = api_client.ApiClient(config=self.config)
|
||||
client = api_client.ApiClient(configuration=self.config)
|
||||
api = core_v1_api.CoreV1Api(client)
|
||||
|
||||
name = 'test-configmap-' + short_uuid()
|
||||
@ -226,7 +227,7 @@ class TestClient(unittest.TestCase):
|
||||
self.assertEqual([], resp.items)
|
||||
|
||||
def test_node_apis(self):
|
||||
client = api_client.ApiClient(config=self.config)
|
||||
client = api_client.ApiClient(configuration=self.config)
|
||||
api = core_v1_api.CoreV1Api(client)
|
||||
|
||||
for item in api.list_node().items:
|
||||
|
||||
@ -18,7 +18,6 @@ import yaml
|
||||
|
||||
from kubernetes.client import api_client
|
||||
from kubernetes.client.apis import extensions_v1beta1_api
|
||||
from kubernetes.client.configuration import configuration
|
||||
from kubernetes.client.models import v1_delete_options
|
||||
from kubernetes.e2e_test import base
|
||||
|
||||
@ -30,7 +29,7 @@ class TestClientExtensions(unittest.TestCase):
|
||||
cls.config = base.get_e2e_configuration()
|
||||
|
||||
def test_create_deployment(self):
|
||||
client = api_client.ApiClient(config=self.config)
|
||||
client = api_client.ApiClient(configuration=self.config)
|
||||
api = extensions_v1beta1_api.ExtensionsV1beta1Api(client)
|
||||
name = 'nginx-deployment-' + str(uuid.uuid4())
|
||||
deployment = '''apiVersion: extensions/v1beta1
|
||||
@ -60,7 +59,7 @@ spec:
|
||||
resp = api.delete_namespaced_deployment(name, 'default', body=options)
|
||||
|
||||
def test_create_daemonset(self):
|
||||
client = api_client.ApiClient(config=self.config)
|
||||
client = api_client.ApiClient(configuration=self.config)
|
||||
api = extensions_v1beta1_api.ExtensionsV1beta1Api(client)
|
||||
name = 'nginx-app-' + str(uuid.uuid4())
|
||||
daemonset = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user