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

pkg/testutil: add a WithTestify func for CheckTransferLeader #5213

Merged
merged 2 commits into from
Jun 22, 2022
Merged
Changes from all 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
9 changes: 9 additions & 0 deletions pkg/testutil/operator_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ func CheckRemovePeerWithTestify(re *require.Assertions, op *operator.Operator, s
}
}

// CheckTransferLeaderWithTestify checks if the operator is to transfer leader between the specified source and target stores.
func CheckTransferLeaderWithTestify(re *require.Assertions, op *operator.Operator, kind operator.OpKind, sourceID, targetID uint64) {
re.NotNil(op)
re.Equal(1, op.Len())
re.Equal(operator.TransferLeader{FromStore: sourceID, ToStore: targetID}, op.Step(0))
kind |= operator.OpLeader
re.Equal(kind, op.Kind()&kind)
}

// CheckTransferPeerWithTestify checks if the operator is to transfer peer between the specified source and target stores.
func CheckTransferPeerWithTestify(re *require.Assertions, op *operator.Operator, kind operator.OpKind, sourceID, targetID uint64) {
re.NotNil(op)
Expand Down