diff --git a/consul/state/state_store_test.go b/consul/state/state_store_test.go index c0bc34ecbf..4e99f66dda 100644 --- a/consul/state/state_store_test.go +++ b/consul/state/state_store_test.go @@ -669,6 +669,21 @@ func TestStateStore_Node_Watches(t *testing.T) { t.Fatalf("err: %s", err) } }) + + // Check that a delete of a node + service + check triggers all three + // tables in one shot. + testRegisterNode(t, s, 4, "node1") + testRegisterService(t, s, 5, "node1", "service1") + testRegisterCheck(t, s, 6, "node1", "service1", "check3", structs.HealthPassing) + verifyWatch(t, s.GetTableWatch("nodes"), func() { + verifyWatch(t, s.GetTableWatch("services"), func() { + verifyWatch(t, s.GetTableWatch("checks"), func() { + if err := s.DeleteNode(7, "node1"); err != nil { + t.Fatalf("err: %s", err) + } + }) + }) + }) } func TestStateStore_EnsureService(t *testing.T) { @@ -906,6 +921,18 @@ func TestStateStore_Service_Watches(t *testing.T) { t.Fatalf("err: %s", err) } }) + + // Check that a delete of a service + check triggers both tables in one + // shot. + testRegisterService(t, s, 4, "node1", "service1") + testRegisterCheck(t, s, 5, "node1", "service1", "check3", structs.HealthPassing) + verifyWatch(t, s.GetTableWatch("services"), func() { + verifyWatch(t, s.GetTableWatch("checks"), func() { + if err := s.DeleteService(6, "node1", "service1"); err != nil { + t.Fatalf("err: %s", err) + } + }) + }) } func TestStateStore_EnsureCheck(t *testing.T) {