m/p/event/etcd: better handle update coalescing
I wasn't able to replicate this in a test, but sometimes etcd sends
multiple events relating to the same key within a single entry in the
watch channel. I assume this happens when the etcd watcher client is not
reading from the server fast enough.
Anyway, when that happened, we'd get a panic about duplicate keys in a
non-ranged call because of a logic bug in the entry coalescing (in which
we would not coalesce multiple updates to the same key, just updates
with the same key and value). Now we coalesce these too, and the bug
seems to be gone.
Change-Id: I36234cc1104ec96a38ad1566b9df75532df44bba
Reviewed-on: https://review.monogon.dev/c/monogon/+/800
Tested-by: Jenkins CI
Reviewed-by: Leopold Schabel <leo@monogon.tech>
diff --git a/metropolis/pkg/event/etcd/etcd_test.go b/metropolis/pkg/event/etcd/etcd_test.go
index 2f5e283..13f6ea8 100644
--- a/metropolis/pkg/event/etcd/etcd_test.go
+++ b/metropolis/pkg/event/etcd/etcd_test.go
@@ -163,7 +163,7 @@
}
if got, want := string(got.([]byte)), value; got != want {
- t.Errorf("Got value %q, wanted %q", want, got)
+ t.Errorf("Wanted value %q, got %q", want, got)
}
}