aviemzur commented on a change in pull request #72: URL: https://github.com/apache/incubator-liminal/pull/72#discussion_r754867434
########## File path: tests/liminal/kubernetes/test_volume_util.py ########## @@ -0,0 +1,66 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +import sys +import unittest + +from kubernetes import config +from liminal.kubernetes import volume_util + +try: + config.load_kube_config() +except Exception: + msg = "Kubernetes is not running\n" + sys.stdout.write(f"INFO: {msg}") + +class TestKubernetesVolume(unittest.TestCase): + def setUp(self) -> None: + self.config = { + 'volumes': [ + { + 'volume': 'gettingstartedvol-test', + 'claim_name': 'gettingstartedvol-test-pvc', + 'local': { + 'path': '.' + } + } + ] + } + + def test_volume_config(self): + volumes_config = volume_util.get_volume_configs(self.config, ".") + self.assertEqual( + str(self.config['volumes'][0]), + str(volumes_config[0])) + + def test_create_volume(self): + self._create_volumes() + matching_volumes = volume_util._list_persistent_volumes(self.config['volumes'][0]['volume']) + self.assertTrue(self.config['volumes'][0]['volume'] in matching_volumes[0]['metadata']['name'], + self.config['volumes'][0]['claim_name'] in matching_volumes[0]['spec']['claim_ref']['name']) + + def test_delete_volume(self): + self._delete_volumes() Review comment: Please add a call to create at the beginning of this test ########## File path: tests/liminal/kubernetes/test_volume_util.py ########## @@ -0,0 +1,66 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +import sys +import unittest + +from kubernetes import config +from liminal.kubernetes import volume_util + +try: + config.load_kube_config() +except Exception: + msg = "Kubernetes is not running\n" + sys.stdout.write(f"INFO: {msg}") + +class TestKubernetesVolume(unittest.TestCase): + def setUp(self) -> None: + self.config = { + 'volumes': [ + { + 'volume': 'gettingstartedvol-test', + 'claim_name': 'gettingstartedvol-test-pvc', + 'local': { + 'path': '.' + } + } + ] + } + + def test_volume_config(self): + volumes_config = volume_util.get_volume_configs(self.config, ".") + self.assertEqual( + str(self.config['volumes'][0]), + str(volumes_config[0])) + + def test_create_volume(self): + self._create_volumes() Review comment: Please add a call to delete at the beginning of this test -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@liminal.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org