Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: e2e tests use apps/v1 api #85

Merged
merged 2 commits into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion examples/nginx-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,30 @@

from kubernetes_asyncio.client import api_client
from kubernetes_asyncio import utils
from kubernetes_asyncio.client.api import extensions_v1beta1_api
from kubernetes_asyncio.client.api import apps_v1_api
from kubernetes_asyncio.client.models import v1_delete_options
from kubernetes_asyncio.e2e_test import base


class TestClientExtensions(asynctest.TestCase):
class TestClientApi(asynctest.TestCase):

@classmethod
def setUpClass(cls):
cls.config = base.get_e2e_configuration()

async def test_create_deployment(self):
client = api_client.ApiClient(configuration=self.config)
api = extensions_v1beta1_api.ExtensionsV1beta1Api(client)
api = apps_v1_api.AppsV1Api(client)
name = 'nginx-deployment-' + str(uuid.uuid4())
deployment = '''apiVersion: extensions/v1beta1
deployment = '''apiVersion: apps/v1
kind: Deployment
metadata:
name: %s
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
Expand All @@ -64,15 +67,18 @@ async def test_create_deployment(self):

async def test_create_deployment_from_yaml_file(self):
client = api_client.ApiClient(configuration=self.config)
api = extensions_v1beta1_api.ExtensionsV1beta1Api(client)
api = apps_v1_api.AppsV1Api(client)
name = 'nginx-deployment-' + str(uuid.uuid4())
tempfile = 'temp.yaml'
deployment = '''apiVersion: extensions/v1beta1
deployment = '''apiVersion: apps/v1
kind: Deployment
metadata:
name: %s
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
Expand All @@ -96,16 +102,19 @@ async def test_create_deployment_from_yaml_file(self):

async def test_create_daemonset(self):
client = api_client.ApiClient(configuration=self.config)
api = extensions_v1beta1_api.ExtensionsV1beta1Api(client)
api = apps_v1_api.AppsV1Api(client)
name = 'nginx-app-' + str(uuid.uuid4())
daemonset = {
'apiVersion': 'extensions/v1beta1',
'apiVersion': 'apps/v1',
'kind': 'DaemonSet',
'metadata': {
'labels': {'app': 'nginx'},
'name': '%s' % name,
'name': name,
},
'spec': {
'selector': {
'matchLabels': {'app': 'nginx'}
},
'template': {
'metadata': {
'labels': {'app': 'nginx'},
Expand Down
2 changes: 1 addition & 1 deletion kubernetes_asyncio/utils/create_from_yaml_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async def test_create_from_yaml(self):

# simple check for api call
self.assertEqual(api_client.call_api.call_args[0][0],
'/apis/extensions/v1beta1/namespaces/{namespace}/deployments')
'/apis/apps/v1/namespaces/{namespace}/deployments')


if __name__ == '__main__':
Expand Down