diff --git a/test/pytest/test_resources.py b/test/pytest/test_resources.py index 8ee1e36a333ad78c48837c0de2915980e77e06f9..da174c9aaa1c992b2c1ddafd4c606f854a5b0a49 100644 --- a/test/pytest/test_resources.py +++ b/test/pytest/test_resources.py @@ -18,7 +18,20 @@ import pytest # Helper functions def check_resource(api, api_group, api_version, plural, name, namespace): - """Returns status contition for resource in given namespace""" + """Returns status contition for resource in given namespace + + :param api: The api object used to query the custom objects + :param api_group: The api group used to query the custom objects + :type api_group: str + :param api_version: The api version used to query the custom objects + :type api_version: str + :param plural: The custom resource's plural name + :type plural: str + :param name: The custom object's name + :type name: str + :param name: The custom object's namespace + :type namespace: str + """ if not namespace: namespace='flux-system' print(f'Resource "{name}" in namespace "{namespace}" ' @@ -52,6 +65,18 @@ def check_custom_objects(api, api_group, api_version, plural, name, namespace='f We can't get a list of custom objects from all namespaces, so we have to iterate over all namespaces. See https://github.com/kubernetes-client/python/issues/1377 + + :param api: The api object used to query the custom objects + :param api_group: The api group used to query the custom objects + :type api_group: str + :param api_version: The api version used to query the custom objects + :type api_version: str + :param plural: The custom resource's plural name + :type plural: str + :param name: The custom object's name + :type name: str + :param name: The custom object's namespace + :type namespace: str """ failed = 0 @@ -96,11 +121,19 @@ def check_custom_objects(api, api_group, api_version, plural, name, namespace='f def check_all_pods_running(pods): """ - Loop through all the pods in an API result. + Loop through all the given V1Pods list. If a pod does not have an element `status.phase` with the value "Running", return False. Otherwise, returns True. - :param kubernetes.V1Pod[] pods: list of V1Pod elements to check + Parameters + ---------- + pods: kubernetes.V1Pod[] + List of V1Pod elements to check + + Returns + ------- + bool + """ ret = True for pod in pods: