v3_watch_test.go (etcd-3.5.5) | : | v3_watch_test.go (etcd-3.5.6) | ||
---|---|---|---|---|
skipping to change at line 29 | skipping to change at line 29 | |||
"context" | "context" | |||
"fmt" | "fmt" | |||
"reflect" | "reflect" | |||
"sort" | "sort" | |||
"sync" | "sync" | |||
"testing" | "testing" | |||
"time" | "time" | |||
pb "go.etcd.io/etcd/api/v3/etcdserverpb" | pb "go.etcd.io/etcd/api/v3/etcdserverpb" | |||
"go.etcd.io/etcd/api/v3/mvccpb" | "go.etcd.io/etcd/api/v3/mvccpb" | |||
clientv3 "go.etcd.io/etcd/client/v3" | ||||
"go.etcd.io/etcd/server/v3/etcdserver/api/v3rpc" | "go.etcd.io/etcd/server/v3/etcdserver/api/v3rpc" | |||
) | ) | |||
// TestV3WatchFromCurrentRevision tests Watch APIs from current revision. | // TestV3WatchFromCurrentRevision tests Watch APIs from current revision. | |||
func TestV3WatchFromCurrentRevision(t *testing.T) { | func TestV3WatchFromCurrentRevision(t *testing.T) { | |||
BeforeTest(t) | BeforeTest(t) | |||
tests := []struct { | tests := []struct { | |||
putKeys []string | putKeys []string | |||
watchRequest *pb.WatchRequest | watchRequest *pb.WatchRequest | |||
skipping to change at line 398 | skipping to change at line 399 | |||
cresp, err := wStream.Recv() | cresp, err := wStream.Recv() | |||
if err != nil { | if err != nil { | |||
t.Fatalf("#%d: wStream.Recv error: %v", i, err) | t.Fatalf("#%d: wStream.Recv error: %v", i, err) | |||
} | } | |||
if !cresp.Created { | if !cresp.Created { | |||
t.Fatalf("#%d: create %v, want %v", i, cresp.Created, tru e) | t.Fatalf("#%d: create %v, want %v", i, cresp.Created, tru e) | |||
} | } | |||
if cresp.Canceled != tt.canceled { | if cresp.Canceled != tt.canceled { | |||
t.Fatalf("#%d: canceled %v, want %v", i, tt.canceled, cre sp.Canceled) | t.Fatalf("#%d: canceled %v, want %v", i, tt.canceled, cre sp.Canceled) | |||
} | } | |||
if tt.canceled && cresp.WatchId != -1 { | if tt.canceled && cresp.WatchId != clientv3.InvalidWatchID { | |||
t.Fatalf("#%d: canceled watch ID %d, want -1", i, cresp.W | t.Fatalf("#%d: canceled watch ID %d, want %d", i, cresp.W | |||
atchId) | atchId, clientv3.InvalidWatchID) | |||
} | } | |||
} | } | |||
} | } | |||
// TestV3WatchCancelSynced tests Watch APIs cancellation from synced map. | // TestV3WatchCancelSynced tests Watch APIs cancellation from synced map. | |||
func TestV3WatchCancelSynced(t *testing.T) { | func TestV3WatchCancelSynced(t *testing.T) { | |||
BeforeTest(t) | BeforeTest(t) | |||
testV3WatchCancel(t, 0) | testV3WatchCancel(t, 0) | |||
} | } | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 4 lines changed or added |