consul: fixes for events and related tests
This commit is contained in:
parent
403a01dcbb
commit
6d27334ee1
|
@ -268,6 +268,9 @@ func TestClientServer_UserEvent(t *testing.T) {
|
|||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
// Wait for the leader
|
||||
testutil.WaitForLeader(t, s1.RPC, "dc1")
|
||||
|
||||
// Check the members
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
return len(c1.LANMembers()) == 2 && len(s1.LANMembers()) == 2, nil
|
||||
|
@ -276,7 +279,13 @@ func TestClientServer_UserEvent(t *testing.T) {
|
|||
})
|
||||
|
||||
// Fire the user event
|
||||
if err := s1.UserEvent("foo", []byte("baz")); err != nil {
|
||||
client := rpcClient(t, s1)
|
||||
event := structs.EventFireRequest{
|
||||
Name: "foo",
|
||||
Datacenter: "dc1",
|
||||
Payload: []byte("baz"),
|
||||
}
|
||||
if err := client.Call("Internal.EventFire", &event, nil); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
|
|
|
@ -71,8 +71,11 @@ func (m *Internal) EventFire(args *structs.EventFireRequest,
|
|||
// Set the query meta data
|
||||
m.srv.setQueryMeta(&reply.QueryMeta)
|
||||
|
||||
// Add the consul prefix to the event name
|
||||
eventName := userEventName(args.Name)
|
||||
|
||||
// Fire the event
|
||||
return m.srv.serfLAN.UserEvent(args.Name, args.Payload, false)
|
||||
return m.srv.serfLAN.UserEvent(eventName, args.Payload, false)
|
||||
}
|
||||
|
||||
// KeyringOperation will query the WAN and LAN gossip keyrings of all nodes.
|
||||
|
|
Loading…
Reference in a new issue