Merge pull request #8893 from hashicorp/dnephin/add-steps-to-subscribe-tests

subscribe: add steps to long test cases, and add new cases for converting Events
This commit is contained in:
Daniel Nephin 2020-10-09 13:54:59 -04:00 committed by GitHub
commit 0d653b184b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 546 additions and 364 deletions

View File

@ -83,7 +83,7 @@ func (h *Server) Subscribe(req *pbsubscribe.SubscribeRequest, serverStream pbsub
} }
elog.Trace(event) elog.Trace(event)
e := newEventFromStreamEvent(req, event) e := newEventFromStreamEvent(req.Topic, event)
if err := serverStream.Send(e); err != nil { if err := serverStream.Send(e); err != nil {
return err return err
} }
@ -139,10 +139,10 @@ func filterByAuth(authz acl.Authorizer, event stream.Event) (stream.Event, bool)
return event.Filter(fn) return event.Filter(fn)
} }
func newEventFromStreamEvent(req *pbsubscribe.SubscribeRequest, event stream.Event) *pbsubscribe.Event { func newEventFromStreamEvent(topic pbsubscribe.Topic, event stream.Event) *pbsubscribe.Event {
e := &pbsubscribe.Event{ e := &pbsubscribe.Event{
Topic: req.Topic, Topic: topic,
Key: req.Key, Key: event.Key,
Index: event.Index, Index: event.Index,
} }
switch { switch {

File diff suppressed because it is too large Load Diff

View File

@ -5,9 +5,10 @@ import (
"fmt" "fmt"
"regexp" "regexp"
"github.com/hashicorp/consul/agent/structs"
"github.com/hashicorp/go-msgpack/codec" "github.com/hashicorp/go-msgpack/codec"
"github.com/hashicorp/go-uuid" "github.com/hashicorp/go-uuid"
"github.com/hashicorp/consul/agent/structs"
) )
const ( const (