From cbfaf2affba8afd7269df5bf05baafd7e412ab53 Mon Sep 17 00:00:00 2001 From: Ganga Mahesh Siddem Date: Thu, 21 Oct 2021 16:27:40 -0700 Subject: [PATCH 1/4] wip --- test/e2e/src/common/constants.py | 3 +++ test/e2e/src/common/kubernetes_pod_utility.py | 6 +++--- test/e2e/src/tests/test_ds_workflows.py | 2 +- test/e2e/src/tests/test_resource_status.py | 6 ++++++ test/e2e/src/tests/test_rs_workflows.py | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/test/e2e/src/common/constants.py b/test/e2e/src/common/constants.py index 392b10554..c557a1c91 100644 --- a/test/e2e/src/common/constants.py +++ b/test/e2e/src/common/constants.py @@ -40,6 +40,9 @@ TIMEOUT = 300 +# omsagent main container name +OMSAGENT_MAIN_CONTAINER_NAME = 'omsagent' + # WAIT TIME BEFORE READING THE AGENT LOGS AGENT_WAIT_TIME_SECS = "180" # Azure Monitor for Container Extension related diff --git a/test/e2e/src/common/kubernetes_pod_utility.py b/test/e2e/src/common/kubernetes_pod_utility.py index 27345fae7..d70f443f0 100644 --- a/test/e2e/src/common/kubernetes_pod_utility.py +++ b/test/e2e/src/common/kubernetes_pod_utility.py @@ -20,12 +20,12 @@ def get_pod_list(api_instance, namespace, label_selector=""): pytest.fail("Error occurred when retrieving pod information: " + str(e)) # get the content of the log file in the container via exec -def get_log_file_content(api_instance, namespace, podName, logfilePath): +def get_log_file_content(api_instance, namespace, podName, containerName, logfilePath): try: exec_command = ['tar','cf', '-', logfilePath] - return stream(api_instance.connect_get_namespaced_pod_exec, podName, namespace, command=exec_command, stderr=True, stdin=False, stdout=True, tty=False) + return stream(api_instance.connect_get_namespaced_pod_exec, podName, namespace, command=exec_command, container=containerName, stderr=True, stdin=False, stdout=True, tty=False) except Exception as e: - pytest.fail("Error occurred when retrieving log file content: " + str(e)) + pytest.fail("Error occurred when retrieving log file content: " + str(e)) # Function that watches events corresponding to pods in the given namespace and passes the events to a callback function def watch_pod_status(api_instance, namespace, timeout, callback=None): diff --git a/test/e2e/src/tests/test_ds_workflows.py b/test/e2e/src/tests/test_ds_workflows.py index 731957788..e6d651e49 100755 --- a/test/e2e/src/tests/test_ds_workflows.py +++ b/test/e2e/src/tests/test_ds_workflows.py @@ -51,7 +51,7 @@ def test_ds_workflows(env_dict): for podItem in pod_list.items: podName = podItem.metadata.name logcontent = get_log_file_content( - api_instance, constants.AGENT_RESOURCES_NAMESPACE, podName, agentLogPath) + api_instance, constants.AGENT_RESOURCES_NAMESPACE, podName, constants.OMSAGENT_MAIN_CONTAINER_NAME, agentLogPath) if not logcontent: pytest.fail("logcontent should not be null or empty for pod: " + podName) loglines = logcontent.split("\n") diff --git a/test/e2e/src/tests/test_resource_status.py b/test/e2e/src/tests/test_resource_status.py index f2b5569e9..d16f5b31b 100755 --- a/test/e2e/src/tests/test_resource_status.py +++ b/test/e2e/src/tests/test_resource_status.py @@ -1,5 +1,6 @@ import pytest import constants +import time from kubernetes import client, config from results_utility import append_result_output @@ -21,6 +22,11 @@ def test_resource_status(env_dict): except Exception as e: pytest.fail("Error loading the in-cluster config: " + str(e)) + waitTimeSeconds = env_dict['AGENT_WAIT_TIME_SECS'] + print("start: waiting for seconds: {} for agent pods to get to the running state".format(waitTimeSeconds)) + time.sleep(int(waitTimeSeconds)) + print("complete: waiting for seconds: {} for agent pods to get to the running stated".format(waitTimeSeconds)) + # checking the deployment status check_kubernetes_deployment_status( constants.AGENT_RESOURCES_NAMESPACE, constants.AGENT_DEPLOYMENT_NAME, env_dict['TEST_AGENT_LOG_FILE']) diff --git a/test/e2e/src/tests/test_rs_workflows.py b/test/e2e/src/tests/test_rs_workflows.py index 36ec05867..993286209 100755 --- a/test/e2e/src/tests/test_rs_workflows.py +++ b/test/e2e/src/tests/test_rs_workflows.py @@ -49,7 +49,7 @@ def test_rs_workflows(env_dict): agentLogPath = constants.AGENT_OMSAGENT_LOG_PATH logcontent = get_log_file_content( - api_instance, constants.AGENT_RESOURCES_NAMESPACE, rspodName, agentLogPath) + api_instance, constants.AGENT_RESOURCES_NAMESPACE, rspodName, constants.OMSAGENT_MAIN_CONTAINER_NAME, agentLogPath) if not logcontent: pytest.fail("logcontent should not be null or empty for rs pod: {}".format(rspodName)) loglines = logcontent.split("\n") From ee4fd3c8cfdeb498f7b56721f57f5f5f5c6b9e93 Mon Sep 17 00:00:00 2001 From: Ganga Mahesh Siddem Date: Thu, 21 Oct 2021 17:06:17 -0700 Subject: [PATCH 2/4] test updates --- test/e2e/conformance.yaml | 2 +- test/e2e/src/core/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/conformance.yaml b/test/e2e/conformance.yaml index ff790e690..71e40a6a2 100644 --- a/test/e2e/conformance.yaml +++ b/test/e2e/conformance.yaml @@ -3,7 +3,7 @@ sonobuoy-config: plugin-name: azure-arc-ci-conformance result-format: junit spec: - image: mcr.microsoft.com/azuremonitor/containerinsights/cidev:ciconftest08142021 + image: mcr.microsoft.com/azuremonitor/containerinsights/cidev:ciconftest10202021 imagePullPolicy: Always name: plugin resources: {} diff --git a/test/e2e/src/core/Dockerfile b/test/e2e/src/core/Dockerfile index cd85aee40..52bcd7cf8 100644 --- a/test/e2e/src/core/Dockerfile +++ b/test/e2e/src/core/Dockerfile @@ -6,7 +6,7 @@ RUN curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | && helm version RUN apt-get update && apt-get -y upgrade && \ - apt-get -f -y install curl apt-transport-https lsb-release gnupg python3-pip python-pip && \ + apt-get -f -y install curl apt-transport-https lsb-release gnupg python3-pip && \ curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.asc.gpg && \ CLI_REPO=$(lsb_release -cs) && \ echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ ${CLI_REPO} main" \ From 914839844a321d52f9bcc391cc6a7c63156c3ffa Mon Sep 17 00:00:00 2001 From: Ganga Mahesh Siddem Date: Thu, 21 Oct 2021 17:21:36 -0700 Subject: [PATCH 3/4] fix pr feedback --- test/e2e/src/tests/test_rs_workflows.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/e2e/src/tests/test_rs_workflows.py b/test/e2e/src/tests/test_rs_workflows.py index 993286209..6a29dcc73 100755 --- a/test/e2e/src/tests/test_rs_workflows.py +++ b/test/e2e/src/tests/test_rs_workflows.py @@ -39,9 +39,7 @@ def test_rs_workflows(env_dict): waitTimeSeconds = env_dict['AGENT_WAIT_TIME_SECS'] - print("start: waiting for seconds: {} for agent workflows to get emitted".format(waitTimeSeconds)) time.sleep(int(waitTimeSeconds)) - print("complete: waiting for seconds: {} for agent workflows to get emitted".format(waitTimeSeconds)) isOMSBaseAgent = env_dict.get('USING_OMSAGENT_BASE_AGENT') agentLogPath = constants.AGENT_FLUENTD_LOG_PATH From de63e4f6d22eda54186ab553838bb27d9a61f849 Mon Sep 17 00:00:00 2001 From: Ganga Mahesh Siddem Date: Thu, 21 Oct 2021 17:23:25 -0700 Subject: [PATCH 4/4] fix pr feedback --- test/e2e/src/tests/test_resource_status.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/e2e/src/tests/test_resource_status.py b/test/e2e/src/tests/test_resource_status.py index d16f5b31b..c240cbcf2 100755 --- a/test/e2e/src/tests/test_resource_status.py +++ b/test/e2e/src/tests/test_resource_status.py @@ -23,9 +23,7 @@ def test_resource_status(env_dict): pytest.fail("Error loading the in-cluster config: " + str(e)) waitTimeSeconds = env_dict['AGENT_WAIT_TIME_SECS'] - print("start: waiting for seconds: {} for agent pods to get to the running state".format(waitTimeSeconds)) time.sleep(int(waitTimeSeconds)) - print("complete: waiting for seconds: {} for agent pods to get to the running stated".format(waitTimeSeconds)) # checking the deployment status check_kubernetes_deployment_status(