Skip to content

Commit

Permalink
fix some code
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaojingchen committed Apr 30, 2019
1 parent c87cbff commit 852625f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions tests/failover.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ func (oa *operatorActions) CheckOneApiserverDownOrDie(operatorConfig *OperatorCo
affectedPods := map[string]*corev1.Pod{}
apiserverPod, err := GetApiserverPod(oa.kubeCli, faultNode)
if err != nil {
panic(fmt.Errorf("can't find apiserver in node:%s", faultNode))
slack.NotifyAndPanic(fmt.Errorf("can't find apiserver in node:%s", faultNode))
}
if apiserverPod != nil {
affectedPods[apiserverPod.GetName()] = apiserverPod
Expand All @@ -498,7 +498,7 @@ func (oa *operatorActions) CheckOneApiserverDownOrDie(operatorConfig *OperatorCo
}
dnsPod, err := GetDnsPod(oa.kubeCli, faultNode)
if err != nil {
panic(fmt.Errorf("can't find controller-manager in node:%s", faultNode))
slack.NotifyAndPanic(fmt.Errorf("can't find controller-manager in node:%s", faultNode))
}
if dnsPod != nil {
affectedPods[dnsPod.GetName()] = dnsPod
Expand All @@ -525,7 +525,7 @@ func (oa *operatorActions) CheckOneApiserverDownOrDie(operatorConfig *OperatorCo

func (oa *operatorActions) CheckK8sAvailableOrDie(excludeNodes map[string]string, excludePods map[string]*corev1.Pod) {
if err := oa.CheckK8sAvailable(excludeNodes, excludePods); err != nil {
panic(err)
slack.NotifyAndPanic(err)
}
}

Expand Down
8 changes: 4 additions & 4 deletions tests/fault.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (fa *faultTriggerActions) StopETCD(nodes ...string) error {

func (fa *faultTriggerActions) StopETCDOrDie(nodes ...string) {
if err := fa.StopETCD(nodes...); err != nil {
panic(err)
slack.NotifyAndPanic(err)
}
}

Expand All @@ -239,7 +239,7 @@ func (fa *faultTriggerActions) StartETCD(nodes ...string) error {

func (fa *faultTriggerActions) StartETCDOrDie(nodes ...string) {
if err := fa.StartETCD(nodes...); err != nil {
panic(err)
slack.NotifyAndPanic(err)
}
}

Expand Down Expand Up @@ -290,7 +290,7 @@ func (fa *faultTriggerActions) StopKubeAPIServer(node string) error {

func (fa *faultTriggerActions) StopKubeAPIServerOrDie(node string) {
if err := fa.StopKubeAPIServer(node); err != nil {
panic(err)
slack.NotifyAndPanic(err)
}
}

Expand All @@ -301,7 +301,7 @@ func (fa *faultTriggerActions) StartKubeAPIServer(node string) error {

func (fa *faultTriggerActions) StartKubeAPIServerOrDie(node string) {
if err := fa.StartKubeAPIServer(node); err != nil {
panic(err)
slack.NotifyAndPanic(err)
}
}

Expand Down
4 changes: 3 additions & 1 deletion tests/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import (
"math/rand"
"time"

"github.com/pingcap/tidb-operator/tests/slack"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
Expand All @@ -32,7 +34,7 @@ func KeepOrDie(interval time.Duration, period time.Duration, fun func() error) {
}
err := fun()
if err != nil {
panic(err)
slack.NotifyAndPanic(err)
}
time.Sleep(interval)
}
Expand Down

0 comments on commit 852625f

Please sign in to comment.