From b04559f99da8c86c3510d4ad4b8f55607bf3876e Mon Sep 17 00:00:00 2001 From: onlymellb Date: Tue, 26 Nov 2019 11:49:49 +0800 Subject: [PATCH] Automated cherry pick of #1221: fix e2e nil point dereference (#1226) * fix e2e nil point dereference * fix CI * fix the judgment condition of ci script --- ci/pingcap_tidb_operator_build_kind.groovy | 4 +-- tests/actions.go | 29 +++++++++++++++++++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/ci/pingcap_tidb_operator_build_kind.groovy b/ci/pingcap_tidb_operator_build_kind.groovy index 9e41436b8c..1fc6b6efb3 100644 --- a/ci/pingcap_tidb_operator_build_kind.groovy +++ b/ci/pingcap_tidb_operator_build_kind.groovy @@ -140,7 +140,7 @@ def call(BUILD_BRANCH, CREDENTIALS_ID, CODECOV_CREDENTIALS_ID) { } } - if ( BUILD_BRANCH !=~ /[a-z0-9]{40}/) { + if ( !(BUILD_BRANCH ==~ /[a-z0-9]{40}/) ) { stage('upload tidb-operator binary and charts'){ //upload binary and charts sh """ @@ -177,7 +177,7 @@ def call(BUILD_BRANCH, CREDENTIALS_ID, CODECOV_CREDENTIALS_ID) { return } - if ( BUILD_BRANCH !=~ /[a-z0-9]{40}/ ){ + if ( !(BUILD_BRANCH ==~ /[a-z0-9]{40}/) ){ slackmsg = "${slackmsg}" + "\n" + "Binary Download URL:" + "\n" + "${UCLOUD_OSS_URL}/builds/pingcap/operator/${GITHASH}/centos7/tidb-operator.tar.gz" diff --git a/tests/actions.go b/tests/actions.go index cd0d96a8a2..1fcbe7225c 100644 --- a/tests/actions.go +++ b/tests/actions.go @@ -1165,7 +1165,15 @@ func (oa *operatorActions) pdMembersReadyFn(tc *v1alpha1.TidbCluster) (bool, err ns, pdSetName, pdSet.Status.ReadyReplicas, pdSet.Status.Replicas) return false, nil } - if c, ok := getMemberContainer(oa.kubeCli, ns, pdSetName); !ok || tc.Spec.PD.Image != c.Image { + + c, found := getMemberContainer(oa.kubeCli, ns, pdSetName) + if !found { + glog.Infof("statefulset: %s/%s not found containers[name=pd] or pod %s-0", + ns, pdSetName, pdSetName) + return false, nil + } + + if tc.Spec.PD.Image != c.Image { glog.Infof("statefulset: %s/%s .spec.template.spec.containers[name=pd].image(%s) != %s", ns, pdSetName, c.Image, tc.Spec.PD.Image) return false, nil @@ -1230,7 +1238,15 @@ func (oa *operatorActions) tikvMembersReadyFn(tc *v1alpha1.TidbCluster) (bool, e ns, tikvSetName, tikvSet.Status.ReadyReplicas, tikvSet.Status.Replicas) return false, nil } - if c, ok := getMemberContainer(oa.kubeCli, ns, tikvSetName); !ok || tc.Spec.TiKV.Image != c.Image { + + c, found := getMemberContainer(oa.kubeCli, ns, tikvSetName) + if !found { + glog.Infof("statefulset: %s/%s not found containers[name=tikv] or pod %s-0", + ns, tikvSetName, tikvSetName) + return false, nil + } + + if tc.Spec.TiKV.Image != c.Image { glog.Infof("statefulset: %s/%s .spec.template.spec.containers[name=tikv].image(%s) != %s", ns, tikvSetName, c.Image, tc.Spec.TiKV.Image) return false, nil @@ -1290,7 +1306,14 @@ func (oa *operatorActions) tidbMembersReadyFn(tc *v1alpha1.TidbCluster) (bool, e return false, nil } - if c, ok := getMemberContainer(oa.kubeCli, ns, tidbSetName); !ok || tc.Spec.TiDB.Image != c.Image { + c, found := getMemberContainer(oa.kubeCli, ns, tidbSetName) + if !found { + glog.Infof("statefulset: %s/%s not found containers[name=tidb] or pod %s-0", + ns, tidbSetName, tidbSetName) + return false, nil + } + + if tc.Spec.TiDB.Image != c.Image { glog.Infof("statefulset: %s/%s .spec.template.spec.containers[name=tidb].image(%s) != %s", ns, tidbSetName, c.Image, tc.Spec.TiDB.Image) return false, nil