integration: check Watch response error not nil to avoid runtime panic.

Fixes issue: #14259

Signed-off-by: 王霄霄 <1141195807@qq.com>
This commit is contained in:
王霄霄 2022-10-15 22:16:28 +08:00
parent f97aac9d61
commit 2751ec6479

View File

@ -340,6 +340,9 @@ func putAndWatch(t *testing.T, wctx *watchctx, key, val string) {
if !ok { if !ok {
t.Fatalf("unexpected watch close") t.Fatalf("unexpected watch close")
} }
if err := v.Err(); err != nil {
t.Fatalf("unexpected watch response error: %v", err)
}
if string(v.Events[0].Kv.Value) != val { if string(v.Events[0].Kv.Value) != val {
t.Fatalf("bad value got %v, wanted %v", v.Events[0].Kv.Value, val) t.Fatalf("bad value got %v, wanted %v", v.Events[0].Kv.Value, val)
} }