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

ddl: make TestNotifyDDLJob stable #23232

Merged
merged 4 commits into from
Mar 11, 2021
Merged
Changes from 1 commit
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
13 changes: 12 additions & 1 deletion ddl/ddl_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ func (s *testDDLSuite) TestNotifyDDLJob(c *C) {
)
defer d.Stop()
getFirstNotificationAfterStartDDL(d)
// Ensure that the notification is not handled by worker's "start".
zimulala marked this conversation as resolved.
Show resolved Hide resolved
d.cancel()
for _, worker := range d.workers {
worker.close()
}

job := &model.Job{
SchemaID: 1,
Expand All @@ -127,6 +132,7 @@ func (s *testDDLSuite) TestNotifyDDLJob(c *C) {
default:
c.Fatal("do not get the add index job notification")
}

// Test the notification mechanism that the owner and the server receiving the DDL request are not on the same TiDB.
// And the etcd client is nil.
d1 := testNewDDLAndStart(
Expand All @@ -135,8 +141,13 @@ func (s *testDDLSuite) TestNotifyDDLJob(c *C) {
WithStore(store),
WithLease(testLease),
)
getFirstNotificationAfterStartDDL(d1)
defer d1.Stop()
getFirstNotificationAfterStartDDL(d1)
// Ensure that the notification is not handled by worker's "start".
d1.cancel()
for _, worker := range d1.workers {
worker.close()
}
d1.ownerManager.RetireOwner()
d1.asyncNotifyWorker(job)
job.Type = model.ActionCreateTable
Expand Down