From 41d295fa115e58797aee0f9f8cea857521edb4c7 Mon Sep 17 00:00:00 2001 From: dbudziwojski Date: Sun, 13 Aug 2023 16:52:44 -0700 Subject: [PATCH 1/5] Add Failed Pod - Container Pending Test --- e2e/test-specs.yml | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/e2e/test-specs.yml b/e2e/test-specs.yml index f00804acb..f5d695e59 100644 --- a/e2e/test-specs.yml +++ b/e2e/test-specs.yml @@ -65,7 +65,49 @@ scenarios: - helm delete ${SCENARIO_TAG}-resources -n nr-${SCENARIO_TAG} - helm delete ${SCENARIO_TAG} -n nr-${SCENARIO_TAG} tests: - nrqls: [] + nrqls: +# START Failed Pod - Container Pending + - query: "FROM Metric SELECT latest(if(k8s.pod.isReady = 1, 'True', 'False')) as 'Ready' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Ready" + value: False + - query: "FROM Metric SELECT latest(if(k8s.pod.isScheduled = 1, 'True', 'False')) as 'Scheduled' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Scheduled" + value: False + - query: "FROM Metric SELECT average(k8s.container.cpuUsedCores) AS 'CPU usage (cores)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "CPU usage (cores)" + value: nil + - query: "FROM Metric SELECT average(k8s.container.cpuCoresUtilization) / 100 AS 'CPU utilization (%)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "CPU utilization (%)" + value: nil + - query: "FROM Metric SELECT sum(k8s.container.cpuCfsThrottledPeriodsDelta) / sum(k8s.container.cpuCfsPeriodsDelta) AS 'CPU throttling (%)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "CPU throttling (%)" + value: nil + - query: "FROM Metric SELECT average(k8s.container.memoryWorkingSetBytes) AS 'Memory usage (bytes)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Memory usage (bytes)" + value: nil + - query: "FROM Metric SELECT average(k8s.container.memoryWorkingSetUtilization) / 100 AS 'Memory utilization (%)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Memory utilization (%)" + value: nil + - query: "SELECT max(k8s.container.fsUsedBytes) AS 'Filesystem usage (bytes)' FROM Metric WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Filesystem usage (bytes)" + value: nil + - query: "SELECT max(k8s.container.fsUsedPercent) / 100 AS 'Filesystem utilization (%)' FROM Metric WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Filesystem utilization (%)" + value: nil + - query: "FROM Metric SELECT sum(k8s.container.restartCountDelta) AS 'Restart count' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Restart count" + value: 0 +# END Failed Pod - Container Pending entities: [] metrics: - source: "k8s.yml" From a4371c833d81b0fb7ce58820d8efe0d18ed186a3 Mon Sep 17 00:00:00 2001 From: dbudziwojski Date: Fri, 18 Aug 2023 13:41:41 -0700 Subject: [PATCH 2/5] Add missing test. --- e2e/test-specs.yml | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/e2e/test-specs.yml b/e2e/test-specs.yml index f5d695e59..fc6b6c2ec 100644 --- a/e2e/test-specs.yml +++ b/e2e/test-specs.yml @@ -17,7 +17,49 @@ scenarios: - helm delete ${SCENARIO_TAG}-resources -n nr-${SCENARIO_TAG} - helm delete ${SCENARIO_TAG} -n nr-${SCENARIO_TAG} tests: - nrqls: [] + nrqls: +# START Failed Pod - Container Pending + - query: "FROM Metric SELECT latest(if(k8s.pod.isReady = 1, 'True', 'False')) as 'Ready' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Ready" + value: False + - query: "FROM Metric SELECT latest(if(k8s.pod.isScheduled = 1, 'True', 'False')) as 'Scheduled' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Scheduled" + value: False + - query: "FROM Metric SELECT average(k8s.container.cpuUsedCores) AS 'CPU usage (cores)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "CPU usage (cores)" + value: nil + - query: "FROM Metric SELECT average(k8s.container.cpuCoresUtilization) / 100 AS 'CPU utilization (%)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "CPU utilization (%)" + value: nil + - query: "FROM Metric SELECT sum(k8s.container.cpuCfsThrottledPeriodsDelta) / sum(k8s.container.cpuCfsPeriodsDelta) AS 'CPU throttling (%)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "CPU throttling (%)" + value: nil + - query: "FROM Metric SELECT average(k8s.container.memoryWorkingSetBytes) AS 'Memory usage (bytes)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Memory usage (bytes)" + value: nil + - query: "FROM Metric SELECT average(k8s.container.memoryWorkingSetUtilization) / 100 AS 'Memory utilization (%)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Memory utilization (%)" + value: nil + - query: "SELECT max(k8s.container.fsUsedBytes) AS 'Filesystem usage (bytes)' FROM Metric WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Filesystem usage (bytes)" + value: nil + - query: "SELECT max(k8s.container.fsUsedPercent) / 100 AS 'Filesystem utilization (%)' FROM Metric WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Filesystem utilization (%)" + value: nil + - query: "FROM Metric SELECT sum(k8s.container.restartCountDelta) AS 'Restart count' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Restart count" + value: 0 +# END Failed Pod - Container Pending entities: [] metrics: - source: "k8s.yml" From 94878e667fc4237648889cd85d1eb19f6cc8e80a Mon Sep 17 00:00:00 2001 From: Svetlana Brennan <50715937+svetlanabrennan@users.noreply.github.com> Date: Tue, 7 Nov 2023 10:13:21 -0600 Subject: [PATCH 3/5] Update nrql tests --- e2e/test-specs.yml | 60 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 9 deletions(-) diff --git a/e2e/test-specs.yml b/e2e/test-specs.yml index fc6b6c2ec..79caa2d00 100644 --- a/e2e/test-specs.yml +++ b/e2e/test-specs.yml @@ -27,6 +27,26 @@ scenarios: expected_results: - key: "Scheduled" value: False + - query: "FROM Metric SELECT min(k8s.pod.isReady) as 'Ready' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Ready" + value: 0 + - query: "FROM Metric SELECT min(k8s.pod.isScheduled) as 'Scheduled' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Scheduled" + value: 0 + - query: "FROM Metric SELECT average(k8s.pod.netRxBytesPerSecond) / 1000 AS 'Received KBps' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Received KBps" + value: nil + - query: "FROM Metric SELECT average(k8s.pod.netTxBytesPerSecond) / 1000 AS 'Transmitted KBps', average(k8s.pod.netErrorsPerSecond) AS 'Errors / sec' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Transmitted KBps" + value: nil + - query: "FROM Metric SELECT average(k8s.pod.netErrorsPerSecond) AS 'Errors / sec' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Errors / sec" + value: nil - query: "FROM Metric SELECT average(k8s.container.cpuUsedCores) AS 'CPU usage (cores)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" expected_results: - key: "CPU usage (cores)" @@ -35,10 +55,11 @@ scenarios: expected_results: - key: "CPU utilization (%)" value: nil - - query: "FROM Metric SELECT sum(k8s.container.cpuCfsThrottledPeriodsDelta) / sum(k8s.container.cpuCfsPeriodsDelta) AS 'CPU throttling (%)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "CPU throttling (%)" - value: nil + # commenting out this test - this test is flaky - sometimes it's nil and sometimes it has a positive value + # - query: "FROM Metric SELECT sum(k8s.container.cpuCfsThrottledPeriodsDelta) / sum(k8s.container.cpuCfsPeriodsDelta) AS 'CPU throttling (%)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + # expected_results: + # - key: "CPU throttling (%)" + # value: nil - query: "FROM Metric SELECT average(k8s.container.memoryWorkingSetBytes) AS 'Memory usage (bytes)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" expected_results: - key: "Memory usage (bytes)" @@ -99,7 +120,7 @@ scenarios: before: - helm dependency update ../charts/internal/e2e-resources - helm dependency update ../charts/newrelic-infrastructure - - function ver { printf $((10#$(printf "%03d%03d" $(echo "$1" | tr '.' ' ')))); } && K8S_VERSION=$(kubectl version 2>&1 | grep 'Server Version' | awk -F' v' '{ print $2; }' | awk -F. '{ print $1"."$2; }') && if [[ $(ver $K8S_VERSION) -gt $(ver "1.22") ]]; then KSM_IMAGE_VERSION="v2.10.0"; else KSM_IMAGE_VERSION="v2.6.0"; fi && echo "Will use KSM image version ${KSM_IMAGE_VERSION}" && helm upgrade --install ${SCENARIO_TAG}-resources -n nr-${SCENARIO_TAG} --create-namespace ../charts/internal/e2e-resources --set persistentVolume.enabled=true --set kube-state-metrics.image.tag=${KSM_IMAGE_VERSION} + - function ver { printf $((10#$(printf "%03d%03d" $(echo "$1" | tr '.' ' ')))); } && K8S_VERSION=$(kubectl version 2>&1 | grep 'Server Version' | awk -F' v' '{ print $2; }' | awk -F. '{ print $1"."$2; }') && if [[ $(ver $K8S_VERSION) -gt $(ver "1.22") ]]; then KSM_IMAGE_VERSION="v2.10.0"; else KSM_IMAGE_VERSION="v2.6.0"; fi && echo "Will use KSM image version ${KSM_IMAGE_VERSION}" && helm upgrade --install ${SCENARIO_TAG}-resources -n nr-${SCENARIO_TAG} --create-namespace ../charts/internal/e2e-resources --set persistentVolume.enabled=true --set kube-state-metrics.image.tag=${KSM_IMAGE_VERSION} - helm upgrade --install ${SCENARIO_TAG} -n nr-${SCENARIO_TAG} --create-namespace ../charts/newrelic-infrastructure --values e2e-values.yml --set global.licenseKey=${LICENSE_KEY} --set global.cluster=${SCENARIO_TAG} --set privileged=false after: - kubectl logs -l app.kubernetes.io/name=newrelic-infrastructure -n nr-${SCENARIO_TAG} --all-containers --prefix=true @@ -117,6 +138,26 @@ scenarios: expected_results: - key: "Scheduled" value: False + - query: "FROM Metric SELECT min(k8s.pod.isReady) as 'Ready' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Ready" + value: 0 + - query: "FROM Metric SELECT min(k8s.pod.isScheduled) as 'Scheduled' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Scheduled" + value: 0 + - query: "FROM Metric SELECT average(k8s.pod.netRxBytesPerSecond) / 1000 AS 'Received KBps' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Received KBps" + value: nil + - query: "FROM Metric SELECT average(k8s.pod.netTxBytesPerSecond) / 1000 AS 'Transmitted KBps', average(k8s.pod.netErrorsPerSecond) AS 'Errors / sec' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Transmitted KBps" + value: nil + - query: "FROM Metric SELECT average(k8s.pod.netErrorsPerSecond) AS 'Errors / sec' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + expected_results: + - key: "Errors / sec" + value: nil - query: "FROM Metric SELECT average(k8s.container.cpuUsedCores) AS 'CPU usage (cores)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" expected_results: - key: "CPU usage (cores)" @@ -125,10 +166,11 @@ scenarios: expected_results: - key: "CPU utilization (%)" value: nil - - query: "FROM Metric SELECT sum(k8s.container.cpuCfsThrottledPeriodsDelta) / sum(k8s.container.cpuCfsPeriodsDelta) AS 'CPU throttling (%)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "CPU throttling (%)" - value: nil + # commenting out this test - this test is flaky - sometimes it's nil and sometimes it has a positive value + # - query: "FROM Metric SELECT sum(k8s.container.cpuCfsThrottledPeriodsDelta) / sum(k8s.container.cpuCfsPeriodsDelta) AS 'CPU throttling (%)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + # expected_results: + # - key: "CPU throttling (%)" + # value: nil - query: "FROM Metric SELECT average(k8s.container.memoryWorkingSetBytes) AS 'Memory usage (bytes)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" expected_results: - key: "Memory usage (bytes)" From ccc891dc5eefe20088fac03722f928ea4b295f59 Mon Sep 17 00:00:00 2001 From: Svetlana Brennan <50715937+svetlanabrennan@users.noreply.github.com> Date: Tue, 7 Nov 2023 10:25:12 -0600 Subject: [PATCH 4/5] Add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cee04da84..f999de579 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### enhancement - Update E2E resources by @juanjjaramillo in [#926](https://github.com/newrelic/nri-kubernetes/pull/926) +- Add failed pod container pending e2e tests in [#849](https://github.com/newrelic/nri-kubernetes/pull/849) ## v3.19.0 - 2023-11-06 From f38a30fd883fb2c4c703be17f447ec13960688b4 Mon Sep 17 00:00:00 2001 From: Juan Jose Jaramillo Date: Thu, 9 Nov 2023 11:51:38 -0800 Subject: [PATCH 5/5] feat: Review queries and add new queries --- e2e/test-specs.yml | 124 ++++++++------------------------------------- 1 file changed, 21 insertions(+), 103 deletions(-) diff --git a/e2e/test-specs.yml b/e2e/test-specs.yml index 79caa2d00..0cb749296 100644 --- a/e2e/test-specs.yml +++ b/e2e/test-specs.yml @@ -19,67 +19,26 @@ scenarios: tests: nrqls: # START Failed Pod - Container Pending - - query: "FROM Metric SELECT latest(if(k8s.pod.isReady = 1, 'True', 'False')) as 'Ready' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + - query: "FROM Metric SELECT latest(if(k8s.pod.isReady = 1, 'True', 'False')) as 'Ready' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" expected_results: - key: "Ready" value: False - - query: "FROM Metric SELECT latest(if(k8s.pod.isScheduled = 1, 'True', 'False')) as 'Scheduled' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + - query: "FROM Metric SELECT latest(if(k8s.pod.isScheduled = 1, 'True', 'False')) as 'Scheduled' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" expected_results: - key: "Scheduled" value: False - - query: "FROM Metric SELECT min(k8s.pod.isReady) as 'Ready' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + - query: "FROM Metric SELECT latest(k8s.pod.createdAt) as 'Created At' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" expected_results: - - key: "Ready" - value: 0 - - query: "FROM Metric SELECT min(k8s.pod.isScheduled) as 'Scheduled' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "Scheduled" - value: 0 - - query: "FROM Metric SELECT average(k8s.pod.netRxBytesPerSecond) / 1000 AS 'Received KBps' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "Received KBps" - value: nil - - query: "FROM Metric SELECT average(k8s.pod.netTxBytesPerSecond) / 1000 AS 'Transmitted KBps', average(k8s.pod.netErrorsPerSecond) AS 'Errors / sec' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "Transmitted KBps" - value: nil - - query: "FROM Metric SELECT average(k8s.pod.netErrorsPerSecond) AS 'Errors / sec' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "Errors / sec" - value: nil - - query: "FROM Metric SELECT average(k8s.container.cpuUsedCores) AS 'CPU usage (cores)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "CPU usage (cores)" - value: nil - - query: "FROM Metric SELECT average(k8s.container.cpuCoresUtilization) / 100 AS 'CPU utilization (%)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + - key: "Created At" + lowerBoundedValue: 0.0 + - query: "FROM Metric SELECT latest(k8s.nodeName) as 'Node Name' WHERE metricName = 'k8s.pod.createdAt' AND k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" expected_results: - - key: "CPU utilization (%)" - value: nil - # commenting out this test - this test is flaky - sometimes it's nil and sometimes it has a positive value - # - query: "FROM Metric SELECT sum(k8s.container.cpuCfsThrottledPeriodsDelta) / sum(k8s.container.cpuCfsPeriodsDelta) AS 'CPU throttling (%)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - # expected_results: - # - key: "CPU throttling (%)" - # value: nil - - query: "FROM Metric SELECT average(k8s.container.memoryWorkingSetBytes) AS 'Memory usage (bytes)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "Memory usage (bytes)" - value: nil - - query: "FROM Metric SELECT average(k8s.container.memoryWorkingSetUtilization) / 100 AS 'Memory utilization (%)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "Memory utilization (%)" - value: nil - - query: "SELECT max(k8s.container.fsUsedBytes) AS 'Filesystem usage (bytes)' FROM Metric WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "Filesystem usage (bytes)" - value: nil - - query: "SELECT max(k8s.container.fsUsedPercent) / 100 AS 'Filesystem utilization (%)' FROM Metric WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "Filesystem utilization (%)" - value: nil - - query: "FROM Metric SELECT sum(k8s.container.restartCountDelta) AS 'Restart count' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + - key: "Node Name" + value: "" + - query: "FROM Metric SELECT max(k8s.container.restartCountDelta) AS 'Restart count' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" expected_results: - key: "Restart count" - value: 0 + value: nil # END Failed Pod - Container Pending entities: [] metrics: @@ -120,7 +79,7 @@ scenarios: before: - helm dependency update ../charts/internal/e2e-resources - helm dependency update ../charts/newrelic-infrastructure - - function ver { printf $((10#$(printf "%03d%03d" $(echo "$1" | tr '.' ' ')))); } && K8S_VERSION=$(kubectl version 2>&1 | grep 'Server Version' | awk -F' v' '{ print $2; }' | awk -F. '{ print $1"."$2; }') && if [[ $(ver $K8S_VERSION) -gt $(ver "1.22") ]]; then KSM_IMAGE_VERSION="v2.10.0"; else KSM_IMAGE_VERSION="v2.6.0"; fi && echo "Will use KSM image version ${KSM_IMAGE_VERSION}" && helm upgrade --install ${SCENARIO_TAG}-resources -n nr-${SCENARIO_TAG} --create-namespace ../charts/internal/e2e-resources --set persistentVolume.enabled=true --set kube-state-metrics.image.tag=${KSM_IMAGE_VERSION} + - function ver { printf $((10#$(printf "%03d%03d" $(echo "$1" | tr '.' ' ')))); } && K8S_VERSION=$(kubectl version 2>&1 | grep 'Server Version' | awk -F' v' '{ print $2; }' | awk -F. '{ print $1"."$2; }') && if [[ $(ver $K8S_VERSION) -gt $(ver "1.22") ]]; then KSM_IMAGE_VERSION="v2.10.0"; else KSM_IMAGE_VERSION="v2.6.0"; fi && echo "Will use KSM image version ${KSM_IMAGE_VERSION}" && helm upgrade --install ${SCENARIO_TAG}-resources -n nr-${SCENARIO_TAG} --create-namespace ../charts/internal/e2e-resources --set persistentVolume.enabled=true --set kube-state-metrics.image.tag=${KSM_IMAGE_VERSION} - helm upgrade --install ${SCENARIO_TAG} -n nr-${SCENARIO_TAG} --create-namespace ../charts/newrelic-infrastructure --values e2e-values.yml --set global.licenseKey=${LICENSE_KEY} --set global.cluster=${SCENARIO_TAG} --set privileged=false after: - kubectl logs -l app.kubernetes.io/name=newrelic-infrastructure -n nr-${SCENARIO_TAG} --all-containers --prefix=true @@ -130,67 +89,26 @@ scenarios: tests: nrqls: # START Failed Pod - Container Pending - - query: "FROM Metric SELECT latest(if(k8s.pod.isReady = 1, 'True', 'False')) as 'Ready' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + - query: "FROM Metric SELECT latest(if(k8s.pod.isReady = 1, 'True', 'False')) as 'Ready' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" expected_results: - key: "Ready" value: False - - query: "FROM Metric SELECT latest(if(k8s.pod.isScheduled = 1, 'True', 'False')) as 'Scheduled' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + - query: "FROM Metric SELECT latest(if(k8s.pod.isScheduled = 1, 'True', 'False')) as 'Scheduled' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" expected_results: - key: "Scheduled" value: False - - query: "FROM Metric SELECT min(k8s.pod.isReady) as 'Ready' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + - query: "FROM Metric SELECT latest(k8s.pod.createdAt) as 'Created At' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" expected_results: - - key: "Ready" - value: 0 - - query: "FROM Metric SELECT min(k8s.pod.isScheduled) as 'Scheduled' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "Scheduled" - value: 0 - - query: "FROM Metric SELECT average(k8s.pod.netRxBytesPerSecond) / 1000 AS 'Received KBps' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + - key: "Created At" + lowerBoundedValue: 0.0 + - query: "FROM Metric SELECT latest(k8s.nodeName) as 'Node Name' WHERE metricName = 'k8s.pod.createdAt' AND k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" expected_results: - - key: "Received KBps" - value: nil - - query: "FROM Metric SELECT average(k8s.pod.netTxBytesPerSecond) / 1000 AS 'Transmitted KBps', average(k8s.pod.netErrorsPerSecond) AS 'Errors / sec' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "Transmitted KBps" - value: nil - - query: "FROM Metric SELECT average(k8s.pod.netErrorsPerSecond) AS 'Errors / sec' WHERE k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "Errors / sec" - value: nil - - query: "FROM Metric SELECT average(k8s.container.cpuUsedCores) AS 'CPU usage (cores)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "CPU usage (cores)" - value: nil - - query: "FROM Metric SELECT average(k8s.container.cpuCoresUtilization) / 100 AS 'CPU utilization (%)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "CPU utilization (%)" - value: nil - # commenting out this test - this test is flaky - sometimes it's nil and sometimes it has a positive value - # - query: "FROM Metric SELECT sum(k8s.container.cpuCfsThrottledPeriodsDelta) / sum(k8s.container.cpuCfsPeriodsDelta) AS 'CPU throttling (%)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - # expected_results: - # - key: "CPU throttling (%)" - # value: nil - - query: "FROM Metric SELECT average(k8s.container.memoryWorkingSetBytes) AS 'Memory usage (bytes)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "Memory usage (bytes)" - value: nil - - query: "FROM Metric SELECT average(k8s.container.memoryWorkingSetUtilization) / 100 AS 'Memory utilization (%)' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "Memory utilization (%)" - value: nil - - query: "SELECT max(k8s.container.fsUsedBytes) AS 'Filesystem usage (bytes)' FROM Metric WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "Filesystem usage (bytes)" - value: nil - - query: "SELECT max(k8s.container.fsUsedPercent) / 100 AS 'Filesystem utilization (%)' FROM Metric WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" - expected_results: - - key: "Filesystem utilization (%)" - value: nil - - query: "FROM Metric SELECT sum(k8s.container.restartCountDelta) AS 'Restart count' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" + - key: "Node Name" + value: "" + - query: "FROM Metric SELECT max(k8s.container.restartCountDelta) AS 'Restart count' WHERE k8s.namespaceName = 'nr-${SCENARIO_TAG}' AND k8s.podName = '${SCENARIO_TAG}-resources-container-pending'" expected_results: - key: "Restart count" - value: 0 + value: nil # END Failed Pod - Container Pending entities: [] metrics: