From 873f3999133a536379df867092e974b8586a5064 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 28 Sep 2021 16:12:56 +0000 Subject: [PATCH 1/4] Added testcases for ingress --- src/KubeLibrary/KubeLibrary.py | 22 +++++++++++++++++++++ testcases/ingress/ingress.robot | 12 ++++++++++++ testcases/ingress/ingress_kw.robot | 31 ++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) diff --git a/src/KubeLibrary/KubeLibrary.py b/src/KubeLibrary/KubeLibrary.py index 0e435245..e4291f89 100755 --- a/src/KubeLibrary/KubeLibrary.py +++ b/src/KubeLibrary/KubeLibrary.py @@ -884,3 +884,25 @@ def filter_endpoints_names(self, endpoints): List of endpoint objects """ return [endpoints.metadata.name for endpoints in endpoints.items] + + def create_ingress_in_namespace(self, namespace, body): + """Creates Ingress in a namespace + Returns created ingress + - ``body``: + Ingress object. + - ``namespace``: + Namespace to check + """ + ret = self.extensionsv1beta1.create_namespaced_ingress(namespace=namespace, body=body) + return ret + + def delete_ingress_in_namespace(self, name, namespace): + """Deletes Ingress in a namespace + Returns V1 status + - ``name``: + Ingress name + - ``namespace``: + Namespace to check + """ + ret = self.extensionsv1beta1.delete_namespaced_ingress(name=name, namespace=namespace) + return ret diff --git a/testcases/ingress/ingress.robot b/testcases/ingress/ingress.robot index fcb0f74d..7b8bce10 100644 --- a/testcases/ingress/ingress.robot +++ b/testcases/ingress/ingress.robot @@ -5,4 +5,16 @@ Resource ./ingress_kw.robot Ingresses by label [Tags] other List ingresses by label kubelib-tests app.kubernetes.io/instance=kubelib-test + +Ingresses in namespace + [Tags] other prerelease + List all ingresses in namespace kubelib-tests + +Working on Ingress + [Tags] other prerelease + List all ingresses in namespace kubelib-tests + Edit obtained ingress my-ingress + Create new ingress in namespace kubelib-tests + Delete created ingress in namespace my-ingress kubelib-tests + diff --git a/testcases/ingress/ingress_kw.robot b/testcases/ingress/ingress_kw.robot index a8d7f989..93fce80e 100644 --- a/testcases/ingress/ingress_kw.robot +++ b/testcases/ingress/ingress_kw.robot @@ -22,3 +22,34 @@ List ingresses by label ... msg=Expected labels do not match. Log Ingress Host Url: ${ingress_details.spec.rules[0].host} console=True END + +List all ingresses in namespace + [Arguments] ${namespace} + @{namespace_ingresses}= Get Ingresses In Namespace ${namespace} + Log \nIngresses in namespace ${namespace}: console=True + Length Should Be ${namespace_ingresses} 1 + FOR ${ingress} IN @{namespace_ingresses} + ${ingress_details}= Get Ingress Details In Namespace ${ingress} ${namespace} + Log ${ingress_details.metadata.name} console=True + Set Global Variable ${ingress_name} ${ingress_details.metadata.name} + Set Global Variable ${ingress} ${ingress_details} + END + +Edit obtained ingress + [Arguments] ${ingress_name} + ${ingress.metadata.name}= Set Variable ${ingress_name} + ${ingress.metadata.resource_version}= Set Variable ${None} + Set Global Variable ${new_ingress} ${ingress} + +Create new ingress in namespace + [Arguments] ${namespace} + Log \nCreate new ingress in namespace ${namespace} console=True + ${new_ing}= Create Ingress In Namespace ${namespace} ${new_ingress} + Log ${new_ing} console=True + +Delete created ingress in namespace + [Arguments] ${ingress_name} ${namespace} + Log \nDelete ingress in namespace ${namespace} console=True + Log ${ingress_name} console=True + ${status}= Delete Ingress In Namespace ${ingress_name} ${namespace} + Log ${status} From 0fc53d8fb63a7a44cd8aa01b01b9ecfd74e76077 Mon Sep 17 00:00:00 2001 From: satish-nubolab <78336217+satish-nubolab@users.noreply.github.com> Date: Wed, 29 Sep 2021 20:14:25 +0530 Subject: [PATCH 2/4] Update .coveragerc --- .coveragerc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.coveragerc b/.coveragerc index fe15406d..91d7a892 100644 --- a/.coveragerc +++ b/.coveragerc @@ -3,4 +3,4 @@ command_line = -m unittest discover source = src/ [report] -fail_under = 82 +fail_under = 81 From 60f257a109b26d177ad8364a6c64033bd150a0f6 Mon Sep 17 00:00:00 2001 From: satish-nubolab <78336217+satish-nubolab@users.noreply.github.com> Date: Wed, 29 Sep 2021 20:19:05 +0530 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a948db72..3950f2fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Keyword for list daemonset [#50](https://github.com/devopsspiral/KubeLibrary/pull/50) by [@satish-nubolab](https://github.com/satish-nubolab) - Keyword for CustomObjectsApi [#54](https://github.com/devopsspiral/KubeLibrary/pull/54) by [@mika-b](https://github.com/mika-b) - Example tests for Ambassador CRDs [#63](https://github.com/devopsspiral/KubeLibrary/pull/63) by [@Nilsty](https://github.com/Nilsty) +- Example tests for Ambassador CRDs [#63](https://github.com/devopsspiral/KubeLibrary/pull/63) by [@Nilsty](https://github.com/Nilsty) +- Keyword for edit ,create and delete ingress [#52]((https://github.com/devopsspiral/KubeLibrary/pull/94) by [@satish-nubolab](https://github.com/satish-nubolab) ### Fixed - Fix for cert validation disabling not being possible for all api clients [#61](https://github.com/devopsspiral/KubeLibrary/pull/61) by [@m-wcislo](https://github.com/m-wcislo) From 27f63dd19f634c3240907a1f495f26b22bab02cd Mon Sep 17 00:00:00 2001 From: satish-nubolab <78336217+satish-nubolab@users.noreply.github.com> Date: Fri, 1 Oct 2021 20:50:01 +0530 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3950f2fa..1848c908 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Keyword for CustomObjectsApi [#54](https://github.com/devopsspiral/KubeLibrary/pull/54) by [@mika-b](https://github.com/mika-b) - Example tests for Ambassador CRDs [#63](https://github.com/devopsspiral/KubeLibrary/pull/63) by [@Nilsty](https://github.com/Nilsty) - Example tests for Ambassador CRDs [#63](https://github.com/devopsspiral/KubeLibrary/pull/63) by [@Nilsty](https://github.com/Nilsty) -- Keyword for edit ,create and delete ingress [#52]((https://github.com/devopsspiral/KubeLibrary/pull/94) by [@satish-nubolab](https://github.com/satish-nubolab) +- Keyword for edit ,create and delete ingress [#95]((https://github.com/devopsspiral/KubeLibrary/pull/94) by [@satish-nubolab](https://github.com/satish-nubolab) ### Fixed - Fix for cert validation disabling not being possible for all api clients [#61](https://github.com/devopsspiral/KubeLibrary/pull/61) by [@m-wcislo](https://github.com/m-wcislo)