|
|
@@ -18,36 +18,68 @@ import (
|
|
|
"time"
|
|
|
|
|
|
"github.com/coreos/etcd/tools/functional-tester/rpcpb"
|
|
|
+
|
|
|
+ "go.uber.org/zap"
|
|
|
)
|
|
|
|
|
|
type failureNoFailWithStress failureByFunc
|
|
|
|
|
|
-func (f *failureNoFailWithStress) Inject(clus *Cluster) error { return nil }
|
|
|
-func (f *failureNoFailWithStress) Recover(clus *Cluster) error { return nil }
|
|
|
-func (f *failureNoFailWithStress) FailureCase() rpcpb.FailureCase { return f.failureCase }
|
|
|
+func (f *failureNoFailWithStress) Inject(clus *Cluster) error {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+func (f *failureNoFailWithStress) Recover(clus *Cluster) error {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+func (f *failureNoFailWithStress) FailureCase() rpcpb.FailureCase {
|
|
|
+ return f.failureCase
|
|
|
+}
|
|
|
|
|
|
-func newFailureNoFailWithStress() Failure {
|
|
|
+func newFailureNoFailWithStress(clus *Cluster) Failure {
|
|
|
f := &failureNoFailWithStress{
|
|
|
failureCase: rpcpb.FailureCase_NO_FAIL_WITH_STRESS,
|
|
|
}
|
|
|
return &failureDelay{
|
|
|
Failure: f,
|
|
|
- delayDuration: 5 * time.Second,
|
|
|
+ delayDuration: clus.GetFailureDelayDuration(),
|
|
|
}
|
|
|
}
|
|
|
|
|
|
type failureNoFailWithNoStressForLiveness failureByFunc
|
|
|
|
|
|
-func (f *failureNoFailWithNoStressForLiveness) Inject(clus *Cluster) error { return nil }
|
|
|
-func (f *failureNoFailWithNoStressForLiveness) Recover(clus *Cluster) error { return nil }
|
|
|
-func (f *failureNoFailWithNoStressForLiveness) FailureCase() rpcpb.FailureCase { return f.failureCase }
|
|
|
+func (f *failureNoFailWithNoStressForLiveness) Inject(clus *Cluster) error {
|
|
|
+ clus.lg.Info(
|
|
|
+ "extra delay for liveness mode with no stresser",
|
|
|
+ zap.Int("round", clus.rd),
|
|
|
+ zap.Int("case", clus.cs),
|
|
|
+ zap.String("desc", f.Desc()),
|
|
|
+ )
|
|
|
+ time.Sleep(clus.GetFailureDelayDuration())
|
|
|
+
|
|
|
+ clus.lg.Info(
|
|
|
+ "wait health in liveness mode",
|
|
|
+ zap.Int("round", clus.rd),
|
|
|
+ zap.Int("case", clus.cs),
|
|
|
+ zap.String("desc", f.Desc()),
|
|
|
+ )
|
|
|
+ return clus.WaitHealth()
|
|
|
+}
|
|
|
+
|
|
|
+func (f *failureNoFailWithNoStressForLiveness) Recover(clus *Cluster) error {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+func (f *failureNoFailWithNoStressForLiveness) FailureCase() rpcpb.FailureCase {
|
|
|
+ return f.failureCase
|
|
|
+}
|
|
|
|
|
|
-func newFailureNoFailWithNoStressForLiveness() Failure {
|
|
|
+func newFailureNoFailWithNoStressForLiveness(clus *Cluster) Failure {
|
|
|
f := &failureNoFailWithNoStressForLiveness{
|
|
|
failureCase: rpcpb.FailureCase_NO_FAIL_WITH_NO_STRESS_FOR_LIVENESS,
|
|
|
}
|
|
|
return &failureDelay{
|
|
|
Failure: f,
|
|
|
- delayDuration: 7 * time.Second,
|
|
|
+ delayDuration: clus.GetFailureDelayDuration(),
|
|
|
}
|
|
|
}
|