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/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/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" \ 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..c240cbcf2 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,9 @@ 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'] + time.sleep(int(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..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 @@ -49,7 +47,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")