Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix e2e nil point dereference #1221

Merged
merged 5 commits into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
31 changes: 27 additions & 4 deletions tests/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,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 @@ -1385,7 +1393,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 @@ -1445,7 +1461,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 Expand Up @@ -1821,7 +1844,7 @@ func (oa *operatorActions) getComponentPVList(tc *v1alpha1.TidbCluster, componen

listOptions := metav1.ListOptions{
LabelSelector: labels.SelectorFromSet(
label.New().Instance(tcName).Component(component).Labels()).String(),
label.New().Instance(tcName).Component(component).Namespace(ns).Labels()).String(),
}

pvList, err := oa.kubeCli.CoreV1().PersistentVolumes().List(listOptions)
Expand Down