Start to setup enterprise tests for terminating gateway streaming events.

Co-Authored-By: Kyle Havlovitz <kylehav@gmail.com>
This commit is contained in:
Daniel Nephin 2021-01-29 15:53:45 -05:00
parent d0b37f18f0
commit 38aeb88908
2 changed files with 13 additions and 5 deletions

View File

@ -312,7 +312,9 @@ func ServiceHealthEventsFromChanges(tx ReadTxn, changes Changes) ([]stream.Event
e.Topic = topicServiceHealthConnect
payload := e.Payload.(EventPayloadCheckServiceNode)
payload.overrideKey = serviceName.Name
payload.overrideNamespace = serviceName.EnterpriseMeta.GetNamespace()
if gatewayName.EnterpriseMeta.GetNamespace() != serviceName.EnterpriseMeta.GetNamespace() {
payload.overrideNamespace = serviceName.EnterpriseMeta.GetNamespace()
}
e.Payload = payload
events = append(events, e)
@ -334,7 +336,9 @@ func ServiceHealthEventsFromChanges(tx ReadTxn, changes Changes) ([]stream.Event
e.Topic = topicServiceHealthConnect
payload := e.Payload.(EventPayloadCheckServiceNode)
payload.overrideKey = serviceName.Name
payload.overrideNamespace = serviceName.EnterpriseMeta.GetNamespace()
if gatewayName.EnterpriseMeta.GetNamespace() != serviceName.EnterpriseMeta.GetNamespace() {
payload.overrideNamespace = serviceName.EnterpriseMeta.GetNamespace()
}
e.Payload = payload
events = append(events, e)
@ -450,7 +454,10 @@ func copyEventForService(event stream.Event, service structs.ServiceName) stream
event.Topic = topicServiceHealthConnect
payload := event.Payload.(EventPayloadCheckServiceNode)
payload.overrideKey = service.Name
payload.overrideNamespace = service.EnterpriseMeta.GetNamespace()
if payload.Value.Service.EnterpriseMeta.GetNamespace() != service.EnterpriseMeta.GetNamespace() {
payload.overrideNamespace = service.EnterpriseMeta.GetNamespace()
}
event.Payload = payload
return event
}

View File

@ -1717,8 +1717,9 @@ func testServiceHealthEvent(t *testing.T, svc string, opts ...eventOption) strea
csn.Node.Address = "10.10.10.10"
for _, opt := range opts {
err := opt(&e)
require.NoError(t, err)
if err := opt(&e); err != nil {
t.Fatalf("expected no error, got %v", err)
}
}
return e
}