From 8d3604540bb1eefc36da8d412caf8c072872dc6e Mon Sep 17 00:00:00 2001 From: Todd Malsbary Date: Thu, 17 Jun 2021 17:06:58 -0700 Subject: Fix jq null error in tests The specific error is: jq: error (at :1232): null (null) cannot be parsed as a number Issue-ID: MULTICLOUD-1361 Signed-off-by: Todd Malsbary Change-Id: I1821e5002260cd65ac467756753e2a2ffa01a4ce --- kud/tests/qat.sh | 2 +- kud/tests/sriov-network.sh | 2 +- kud/tests/sriov.sh | 2 +- kud/tests/topology-manager.sh | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'kud') diff --git a/kud/tests/qat.sh b/kud/tests/qat.sh index 11fb6ca0..98c0bb72 100755 --- a/kud/tests/qat.sh +++ b/kud/tests/qat.sh @@ -10,7 +10,7 @@ set -o pipefail -qat_capable_nodes=$(kubectl get nodes -o json | jq -r '.items[] | select((.status.capacity."qat.intel.com/cy2_dc2"|tonumber)>=1) | .metadata.name') +qat_capable_nodes=$(kubectl get nodes -o json | jq -r '.items[] | select((.status.capacity."qat.intel.com/cy2_dc2"!=null) and ((.status.capacity."qat.intel.com/cy2_dc2"|tonumber)>=1)) | .metadata.name') if [ -z "$qat_capable_nodes" ]; then echo "This test case cannot run. QAT device unavailable." QAT_ENABLED=False diff --git a/kud/tests/sriov-network.sh b/kud/tests/sriov-network.sh index 3191c2f3..db1613be 100755 --- a/kud/tests/sriov-network.sh +++ b/kud/tests/sriov-network.sh @@ -10,7 +10,7 @@ set -o pipefail -sriov_capable_nodes=$(kubectl get nodes -o json | jq -r '.items[] | select((.status.capacity."intel.com/intel_sriov_nic"|tonumber)>=2) | .metadata.name') +sriov_capable_nodes=$(kubectl get nodes -o json | jq -r '.items[] | select((.status.capacity."intel.com/intel_sriov_nic"!=null) and ((.status.capacity."intel.com/intel_sriov_nic"|tonumber)>=2)) | .metadata.name') if [ -z "$sriov_capable_nodes" ]; then echo "SRIOV test case cannot run on the cluster." exit 0 diff --git a/kud/tests/sriov.sh b/kud/tests/sriov.sh index 7aa97f0c..a44aba04 100755 --- a/kud/tests/sriov.sh +++ b/kud/tests/sriov.sh @@ -10,7 +10,7 @@ set -o pipefail -sriov_capable_nodes=$(kubectl get nodes -o json | jq -r '.items[] | select((.status.capacity."intel.com/intel_sriov_700"|tonumber)>=2) | .metadata.name') +sriov_capable_nodes=$(kubectl get nodes -o json | jq -r '.items[] | select((.status.capacity."intel.com/intel_sriov_700"!=null) and ((.status.capacity."intel.com/intel_sriov_700"|tonumber)>=2)) | .metadata.name') if [ -z "$sriov_capable_nodes" ]; then echo "SRIOV test case cannot run on the cluster." exit 0 diff --git a/kud/tests/topology-manager.sh b/kud/tests/topology-manager.sh index 5c9f900d..77656d39 100755 --- a/kud/tests/topology-manager.sh +++ b/kud/tests/topology-manager.sh @@ -15,8 +15,8 @@ set -o pipefail source _common.sh source _functions.sh -adaptors="X710 XL710 X722" -if [[ $(lspci | grep -c "Ethernet .* \(${adaptors// /\\|}\)") == "0" ]]; then +sriov_capable_nodes=$(kubectl get nodes -o json | jq -r '.items[] | select((.status.capacity."intel.com/intel_sriov_700"!=null) and ((.status.capacity."intel.com/intel_sriov_700"|tonumber)>=2)) | .metadata.name') +if [ -z "$sriov_capable_nodes" ]; then echo "Ethernet adaptor version is not set. Topology manager test case cannot run on this machine" exit 0 else -- cgit 1.2.3-korg