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

mvcc: allow clients to assign watcher IDs #9015

Closed
wants to merge 7 commits into from
Closed
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
Prev Previous commit
Next Next commit
mvcc: make test struct fields unexported
Signed-off-by: Gyuho Lee <[email protected]>
gyuho committed Dec 22, 2017
commit b6dcac4b83200e92769771e723bbf7feeb9a7538
18 changes: 9 additions & 9 deletions mvcc/watcher_test.go
Original file line number Diff line number Diff line change
@@ -92,9 +92,9 @@ func TestWatcherRequestsCustomID(t *testing.T) {
// - Make sure the auto-assignment skips over things we manually assigned

tt := []struct {
GivenID WatchID
ExpectedID WatchID
ExpectedErr error
givenID WatchID
expectedID WatchID
expectedErr error
}{
{1, 1, nil},
{1, 0, ErrWatcherDuplicateID},
@@ -103,13 +103,13 @@ func TestWatcherRequestsCustomID(t *testing.T) {
}

for i, tcase := range tt {
id, err := w.Watch(tcase.GivenID, []byte("foo"), nil, 0)
if tcase.ExpectedErr != nil || err != nil {
if err != tcase.ExpectedErr {
t.Errorf("expected get error %q in test case %q, got %q", tcase.ExpectedErr, i, err)
id, err := w.Watch(tcase.givenID, []byte("foo"), nil, 0)
if tcase.expectedErr != nil || err != nil {
if err != tcase.expectedErr {
t.Errorf("expected get error %q in test case %q, got %q", tcase.expectedErr, i, err)
}
} else if tcase.ExpectedID != id {
t.Errorf("expected to create ID %d, got %d in test case %d", tcase.ExpectedID, id, i)
} else if tcase.expectedID != id {
t.Errorf("expected to create ID %d, got %d in test case %d", tcase.expectedID, id, i)
}
}
}