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

integration: test with multi events in synced #4239

Closed
wants to merge 1 commit into from

Conversation

gyuho
Copy link
Contributor

@gyuho gyuho commented Jan 19, 2016

Related #4216.

@gyuho gyuho mentioned this pull request Jan 19, 2016
10 tasks
@@ -636,6 +634,68 @@ func TestV3WatchMultipleEventsFromCurrentRevision(t *testing.T) {
clus.Terminate(t)
}

// TestV3WatchMultipleEventsFromUnsynced tests Watch APIs from unsynced watchers.
func TestV3WatchMultipleEventsFromUnsynced(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really similar to TestV3WatchMultipleEventsFromCurrentRevision. Can the insert logic be unified to use only txns or multiple PUTs? If so, there can be a helper function testWatchMultipleEvents(t *testing.T, rev int64) that handles both cases without so much code duplication.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure I will fix it. Thanks!

@gyuho
Copy link
Contributor Author

gyuho commented Jan 20, 2016

@heyitsanthony Just addressed. PTAL. Thanks!

t.Fatalf("kvc.Txn failed: %+v", tresp)
if startRev == 0 { // test synced
for i := 0; i < 3; i++ {
if _, err := kvc.Put(context.TODO(), &pb.PutRequest{Key: []byte(fmt.Sprintf("foo%d", i)), Value: []byte("bar")}); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would this work just as well with only txns or puts but not both? if so it would simplify the logic a bit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. will fix the logic to make it simpler.

testV3WatchMultipleEvents(t, 1, true)
}

func testV3WatchMultipleEvents(t *testing.T, startRev int64, isTxn bool) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heyitsanthony Just fixed by adding isTxn option. PTAL. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, if txn/put matters, can you add tests for testV3WatchMultipleEvents(t, 0, true) and testV3WatchMultipleEvents(t, 1, false)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure I will.

@heyitsanthony
Copy link
Contributor

lgtm once the extra txn/put cases are covered

@gyuho
Copy link
Contributor Author

gyuho commented Jan 20, 2016

@heyitsanthony All cases are covered. Will merge after CI passes. Thanks!

t.Fatalf("kvc.Txn failed: %+v", tresp)
var wevents []*storagepb.Event

if isTxn {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this whole if else block looks pretty crazy. probably we need to refactor it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. Will try to make it cleaner. Thanks!

@gyuho gyuho changed the title integration: test with multi events in unsynced integration: test with multi events in synced Jan 20, 2016
@gyuho gyuho force-pushed the multi_unsynced branch 2 times, most recently from f03e593 to 4607014 Compare January 20, 2016 05:59
@gyuho
Copy link
Contributor Author

gyuho commented Jan 20, 2016

@xiang90 @heyitsanthony Could you take a look again? I made it simpler with smaller testing cases.
Locally tested and worked but somehow semaphore is stalling.

Thanks,

@gyuho
Copy link
Contributor Author

gyuho commented Jan 20, 2016

Closing this. Will figure out test failures.

@gyuho gyuho closed this Jan 20, 2016
@gyuho gyuho deleted the multi_unsynced branch January 31, 2016 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants