-
Notifications
You must be signed in to change notification settings - Fork 501
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
tests: refactor fault trigger #896
Changes from all commits
689aa7c
8a7e6a1
f836536
8648f7e
1721243
7d1b2e1
7b79f2c
b5bc4e0
c6449e6
82cafca
14e76a8
f39f241
ac4070a
b09c8b1
a3faa0e
54709e4
68ddae7
5753e98
2cd1da6
3da2da4
1f8a921
f697e92
466a0f4
b48c82a
027eea8
f9dbde8
6afcd3b
ed5c31a
556238a
04af526
16e083e
1f4bd01
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ import ( | |
"github.com/pingcap/tidb-operator/tests/pkg/client" | ||
"github.com/pingcap/tidb-operator/tests/slack" | ||
"github.com/robfig/cron" | ||
v1 "k8s.io/api/core/v1" | ||
"k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/util/wait" | ||
"k8s.io/apiserver/pkg/util/logs" | ||
) | ||
|
@@ -270,28 +270,51 @@ func run() { | |
// stop all kube-scheduler pods | ||
for _, physicalNode := range cfg.APIServers { | ||
for _, vNode := range physicalNode.Nodes { | ||
fta.StopKubeSchedulerOrDie(vNode) | ||
fta.StopKubeSchedulerOrDie(vNode.IP) | ||
} | ||
} | ||
oa.CheckKubeSchedulerDownOrDie(ocfg, clusters) | ||
for _, physicalNode := range cfg.APIServers { | ||
for _, vNode := range physicalNode.Nodes { | ||
fta.StartKubeSchedulerOrDie(vNode) | ||
fta.StartKubeSchedulerOrDie(vNode.IP) | ||
} | ||
} | ||
|
||
// stop all kube-controller-manager pods | ||
for _, physicalNode := range cfg.APIServers { | ||
for _, vNode := range physicalNode.Nodes { | ||
fta.StopKubeControllerManagerOrDie(vNode) | ||
fta.StopKubeControllerManagerOrDie(vNode.IP) | ||
} | ||
} | ||
oa.CheckKubeControllerManagerDownOrDie(ocfg, clusters) | ||
for _, physicalNode := range cfg.APIServers { | ||
for _, vNode := range physicalNode.Nodes { | ||
fta.StartKubeControllerManagerOrDie(vNode) | ||
fta.StartKubeControllerManagerOrDie(vNode.IP) | ||
} | ||
} | ||
|
||
// stop one kube-apiserver pod | ||
faultApiServer := tests.SelectNode(cfg.APIServers) | ||
fta.StopKubeAPIServerOrDie(faultApiServer) | ||
defer fta.StartKubeAPIServerOrDie(faultApiServer) | ||
time.Sleep(3 * time.Minute) | ||
oa.CheckOneApiserverDownOrDie(ocfg, clusters, faultApiServer) | ||
fta.StartKubeAPIServerOrDie(faultApiServer) | ||
|
||
time.Sleep(time.Minute) | ||
// stop all kube-apiserver pods | ||
for _, physicalNode := range cfg.APIServers { | ||
for _, vNode := range physicalNode.Nodes { | ||
fta.StopKubeAPIServerOrDie(vNode.IP) | ||
} | ||
} | ||
oa.CheckAllApiserverDownOrDie(ocfg, clusters) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should ensure all pods not recreated after stopping all apiservers, just like: https://github.com/pingcap/tidb-operator/pull/955/files#diff-67dacabf080ca4dc8e95d2acf12ee36bR489 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the pr:#955 have not merge. |
||
for _, physicalNode := range cfg.APIServers { | ||
for _, vNode := range physicalNode.Nodes { | ||
fta.StartKubeAPIServerOrDie(vNode.IP) | ||
} | ||
} | ||
time.Sleep(time.Minute) | ||
} | ||
|
||
// before operator upgrade | ||
|
@@ -305,11 +328,13 @@ func run() { | |
IsAdditional: false, | ||
IncrementalType: tests.DbTypeTiDB, | ||
}, | ||
{ | ||
} | ||
if ocfg.Tag != "v1.0.0" { | ||
backupTargets = append(backupTargets, tests.BackupTarget{ | ||
TargetCluster: fileRestoreCluster1, | ||
IsAdditional: true, | ||
IncrementalType: tests.DbTypeFile, | ||
}, | ||
}) | ||
} | ||
caseFn(preUpgrade, onePDCluster1, backupTargets, upgradeVersions[0]) | ||
|
||
|
@@ -334,11 +359,14 @@ func run() { | |
IsAdditional: false, | ||
IncrementalType: tests.DbTypeTiDB, | ||
}, | ||
{ | ||
} | ||
|
||
if ocfg.Tag != "v1.0.0" { | ||
postUpgradeBackupTargets = append(postUpgradeBackupTargets, tests.BackupTarget{ | ||
TargetCluster: fileRestoreCluster2, | ||
IsAdditional: true, | ||
IncrementalType: tests.DbTypeFile, | ||
}, | ||
}) | ||
} | ||
// caseFn(postUpgrade, restoreCluster2, tidbUpgradeVersion) | ||
caseFn(postUpgrade, onePDCluster2, postUpgradeBackupTargets, v) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better not to allow invalid
--vm-manager
value, we can initialize vm manager and handle errors here, e.g.if some users configured an invalid value, but our program still works, this will confuse people because they don't know what virtual manager we use from the command-line flags unless they know implementation details