Skip to content

Commit

Permalink
all namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
paigerube14 committed Nov 29, 2023
1 parent a280036 commit 5ec069a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/krkn_lib/tests/test_krkn_kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,25 @@ def test_get_kubeconfig_path(self):
test_kubeconfig = test.read()
self.assertEqual(test_kubeconfig, kubeconfig_str)


def test_list_all_namespaces(self):
# test list all namespaces
result = self.lib_k8s.list_all_namespaces()
self.assertTrue(len(result) > 1)
# test filter by label
result = self.lib_k8s.list_all_namespaces(
"kubernetes.io/metadata.name=default"
)
print('result type' + str(type(result)))
self.assertTrue(len(result) == 1)
self.assertIn("default", result)

# test unexisting filter
result = self.lib_k8s.list_namespaces(
"k8s.io/metadata.name=donotexist"
)
self.assertTrue(len(result) == 0)

def test_list_namespaces(self):
# test all namespaces
result = self.lib_k8s.list_namespaces()
Expand Down

0 comments on commit 5ec069a

Please sign in to comment.