Skip to content

Commit

Permalink
Automated cherry pick of #1221: fix e2e nil point dereference (#1226)
Browse files Browse the repository at this point in the history
* fix e2e nil point dereference

* fix CI

* fix the judgment condition of ci script
  • Loading branch information
onlymellb authored and aylei committed Nov 26, 2019
1 parent 3e4908e commit b04559f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ci/pingcap_tidb_operator_build_kind.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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 """
Expand Down Expand Up @@ -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"
Expand Down
29 changes: 26 additions & 3 deletions tests/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b04559f

Please sign in to comment.