diff --git a/.trivyignore b/.trivyignore index ecbeae6839..fc204a2414 100644 --- a/.trivyignore +++ b/.trivyignore @@ -1 +1,2 @@ CVE-2023-39325 +CVE-2023-44487 diff --git a/hack/verify-examples.sh b/hack/verify-examples.sh index 8d66d4ae05..ce9dddd7ff 100755 --- a/hack/verify-examples.sh +++ b/hack/verify-examples.sh @@ -30,9 +30,9 @@ rollout_and_wait() { APPNAME=$(kubectl apply -f $1 | grep -E "^(:?daemonset|deployment|statefulset|pod)" | awk '{printf $1}') if [[ -n $(expr "${APPNAME}" : "\(daemonset\|deployment\|statefulset\)" || true) ]]; then - kubectl rollout status $APPNAME --watch --timeout=5m + kubectl rollout status $APPNAME --watch --timeout=10m else - kubectl wait "${APPNAME}" --for condition=ready --timeout=5m + kubectl wait "${APPNAME}" --for condition=ready --timeout=10m fi } @@ -63,4 +63,4 @@ for EXAMPLE in "${EXAMPLES[@]}"; do rollout_and_wait $EXAMPLE done -echo "deployment examples running completed." \ No newline at end of file +echo "deployment examples running completed." diff --git a/test/e2e/dynamic_provisioning_test.go b/test/e2e/dynamic_provisioning_test.go index bef075a957..a1be4837d4 100644 --- a/test/e2e/dynamic_provisioning_test.go +++ b/test/e2e/dynamic_provisioning_test.go @@ -1322,10 +1322,11 @@ var _ = ginkgo.Describe("Dynamic Provisioning", func() { // print azure file driver logs before driver restart azurefileLog := testCmd{ - command: "bash", - args: []string{"test/utils/azurefile_log.sh"}, - startLog: "===================azurefile log (before restart)===================", - endLog: "====================================================================", + command: "bash", + args: []string{"test/utils/azurefile_log.sh"}, + startLog: "===================azurefile log (before restart)===================", + endLog: "====================================================================", + ignoreError: true, } execTestCmd([]testCmd{azurefileLog}) diff --git a/test/e2e/suite_test.go b/test/e2e/suite_test.go index d638b4b210..65f0b24620 100644 --- a/test/e2e/suite_test.go +++ b/test/e2e/suite_test.go @@ -66,10 +66,11 @@ var ( ) type testCmd struct { - command string - args []string - startLog string - endLog string + command string + args []string + startLog string + endLog string + ignoreError bool } var _ = ginkgo.BeforeSuite(func(ctx ginkgo.SpecContext) { @@ -181,10 +182,11 @@ var _ = ginkgo.AfterSuite(func(ctx ginkgo.SpecContext) { execTestCmd([]testCmd{createExampleDeployment}) azurefileLog := testCmd{ - command: "bash", - args: []string{"test/utils/azurefile_log.sh"}, - startLog: "===================azurefile log===================", - endLog: "===================================================", + command: "bash", + args: []string{"test/utils/azurefile_log.sh"}, + startLog: "===================azurefile log===================", + endLog: "===================================================", + ignoreError: true, } e2eTeardown := testCmd{ command: "make", @@ -258,7 +260,12 @@ func execTestCmd(cmds []testCmd) { cmdSh.Stdout = os.Stdout cmdSh.Stderr = os.Stderr err = cmdSh.Run() - gomega.Expect(err).NotTo(gomega.HaveOccurred()) + if err != nil { + log.Println(err) + if !cmd.ignoreError { + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + } + } log.Println(cmd.endLog) } } diff --git a/test/utils/azurefile_log.sh b/test/utils/azurefile_log.sh index 7197ee069e..94b3f0a3b7 100755 --- a/test/utils/azurefile_log.sh +++ b/test/utils/azurefile_log.sh @@ -23,6 +23,13 @@ if [[ "$#" -gt 0 ]]; then DRIVER=$1 fi +cleanup() { + echo "hit unexpected error during log print, exit 0" + exit 0 +} + +trap cleanup ERR + echo "print out all nodes status ..." kubectl get nodes -o wide echo "======================================================================================" @@ -63,7 +70,12 @@ kubectl get pods -n${NS} -l${LABEL} \ | awk 'NR>1 {print $1}' \ | xargs -I {} bash -c "echo 'dumping logs for ${NS}/{}/${DRIVER}' && kubectl logs {} -c${CONTAINER} -n${NS}" -#echo "print out cloudprovider_azure metrics ..." -#echo "======================================================================================" -#ip=`kubectl get svc csi-${DRIVER}-controller -n kube-system | awk '{print $4}'` -#curl http://$ip:29614/metrics +echo "======================================================================================" +ip=`kubectl get svc csi-${DRIVER}-controller -n kube-system | awk '{print $4}'` +if echo "$ip" | grep -q "\."; then + echo "print out cloudprovider_azure metrics ..." + curl http://$ip:29614/metrics +else + echo "csi-$DRIVER-controller service ip is empty" + kubectl get svc csi-$DRIVER-controller -n kube-system +fi