[WIP] Add k8s client.
This commit adds the usage of k8s client and crud operations tests for pods. Change-Id: I033df1a9c4a8ade56c345fb0df767d49263c0c03
This commit is contained in:
parent
891152cecf
commit
4e6f5f0fe6
|
@ -12,6 +12,8 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import kubernetes
|
||||
|
||||
from tempest import config
|
||||
import tempest.test
|
||||
|
||||
|
@ -27,3 +29,10 @@ class BaseKuryrTest(tempest.test.BaseTestCase):
|
|||
super(BaseKuryrTest, cls).skip_checks()
|
||||
if not CONF.service_available.kuryr:
|
||||
raise cls.skipException('Kuryr support is required')
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(BaseKuryrTest, cls).resource_setup()
|
||||
# TODO (dmellado): Config k8s client in a cleaner way
|
||||
kubernetes.config.load_kube_config()
|
||||
cls.k8s_client = kubernetes.client.CoreV1Api()
|
||||
|
|
|
@ -26,6 +26,6 @@ from kuryr_tempest_plugin.tests import base
|
|||
|
||||
class TestKuryr_tempest_plugin(base.BaseKuryrTest):
|
||||
|
||||
@decorators.idempotent_id('8abf6dec-37b9-43ca-95cf-b8ebecda3c8d')
|
||||
@decorators.idempotent_id('14990abd-76b4-476e-add2-321437d8cec5')
|
||||
def test_something(self):
|
||||
pass
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
# Copyright 2017 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from tempest.lib import decorators
|
||||
|
||||
from kuryr_tempest_plugin.tests import base
|
||||
|
||||
|
||||
class PodTest(base.BaseKuryrTest):
|
||||
|
||||
def _list_pods(self):
|
||||
pods = self.k8s_client.list_pod_for_all_namespaces(watch=False)
|
||||
return pods
|
||||
|
||||
@decorators.idempotent_id('f96b40a8-25bc-4ddd-a862-072a2b7b80b8')
|
||||
def test_list_pods(self):
|
||||
pods = self._list_pods()
|
||||
self.assertEmpty(pods.items)
|
Loading…
Reference in New Issue