From 6f34c3d16845b6f2c481ff906404301ec63face1 Mon Sep 17 00:00:00 2001 From: Mstislav Bobakov Date: Thu, 9 Jan 2020 14:15:23 +0300 Subject: [PATCH] Bump dependencies versions. Closes #15 (#18) * update dependencies * update versions for manual testing --- charlatan_for_test.go | 618 --------------------------- consul.go | 4 +- consul_test.go | 122 +++--- go.mod | 28 +- go.sum | 126 +++--- internal/mocks/resolverClientConn.go | 87 ++++ internal/mocks/servicer.go | 48 +++ tests/client_test.go | 2 +- tests/docker-compose.yaml | 2 +- 9 files changed, 297 insertions(+), 740 deletions(-) delete mode 100644 charlatan_for_test.go create mode 100644 internal/mocks/resolverClientConn.go create mode 100644 internal/mocks/servicer.go diff --git a/charlatan_for_test.go b/charlatan_for_test.go deleted file mode 100644 index 29187a7..0000000 --- a/charlatan_for_test.go +++ /dev/null @@ -1,618 +0,0 @@ -// generated by "charlatan -output=charlatan_for_test.go resolver.ClientConn servicer". DO NOT EDIT. - -package consul - -import "reflect" -import "github.com/hashicorp/consul/api" -import "google.golang.org/grpc/resolver" - -// ClientConnNewAddressInvocation represents a single call of FakeClientConn.NewAddress -type ClientConnNewAddressInvocation struct { - Parameters struct { - Addresses []resolver.Address - } -} - -// ClientConnNewServiceConfigInvocation represents a single call of FakeClientConn.NewServiceConfig -type ClientConnNewServiceConfigInvocation struct { - Parameters struct { - ServiceConfig string - } -} - -// ClientConnTestingT represents the methods of "testing".T used by charlatan Fakes. It avoids importing the testing package. -type ClientConnTestingT interface { - Error(...interface{}) - Errorf(string, ...interface{}) - Fatal(...interface{}) - Helper() -} - -/* -FakeClientConn is a mock implementation of ClientConn for testing. -Use it in your tests as in this example: - - package example - - func TestWithClientConn(t *testing.T) { - f := &consul.FakeClientConn{ - NewAddressHook: func(addresses []resolver.Address) () { - // ensure parameters meet expections, signal errors using t, etc - return - }, - } - - // test code goes here ... - - // assert state of FakeNewAddress ... - f.AssertNewAddressCalledOnce(t) - } - -Create anonymous function implementations for only those interface methods that -should be called in the code under test. This will force a panic if any -unexpected calls are made to FakeNewAddress. -*/ -type FakeClientConn struct { - NewAddressHook func([]resolver.Address) - NewServiceConfigHook func(string) - - NewAddressCalls []*ClientConnNewAddressInvocation - NewServiceConfigCalls []*ClientConnNewServiceConfigInvocation -} - -// NewFakeClientConnDefaultPanic returns an instance of FakeClientConn with all hooks configured to panic -func NewFakeClientConnDefaultPanic() *FakeClientConn { - return &FakeClientConn{ - NewAddressHook: func([]resolver.Address) { - panic("Unexpected call to ClientConn.NewAddress") - }, - NewServiceConfigHook: func(string) { - panic("Unexpected call to ClientConn.NewServiceConfig") - }, - } -} - -// NewFakeClientConnDefaultFatal returns an instance of FakeClientConn with all hooks configured to call t.Fatal -func NewFakeClientConnDefaultFatal(t_sym1 ClientConnTestingT) *FakeClientConn { - return &FakeClientConn{ - NewAddressHook: func([]resolver.Address) { - t_sym1.Fatal("Unexpected call to ClientConn.NewAddress") - return - }, - NewServiceConfigHook: func(string) { - t_sym1.Fatal("Unexpected call to ClientConn.NewServiceConfig") - return - }, - } -} - -// NewFakeClientConnDefaultError returns an instance of FakeClientConn with all hooks configured to call t.Error -func NewFakeClientConnDefaultError(t_sym2 ClientConnTestingT) *FakeClientConn { - return &FakeClientConn{ - NewAddressHook: func([]resolver.Address) { - t_sym2.Error("Unexpected call to ClientConn.NewAddress") - return - }, - NewServiceConfigHook: func(string) { - t_sym2.Error("Unexpected call to ClientConn.NewServiceConfig") - return - }, - } -} - -func (f *FakeClientConn) Reset() { - f.NewAddressCalls = []*ClientConnNewAddressInvocation{} - f.NewServiceConfigCalls = []*ClientConnNewServiceConfigInvocation{} -} - -func (f_sym3 *FakeClientConn) NewAddress(addresses []resolver.Address) { - if f_sym3.NewAddressHook == nil { - panic("ClientConn.NewAddress() called but FakeClientConn.NewAddressHook is nil") - } - - invocation_sym3 := new(ClientConnNewAddressInvocation) - f_sym3.NewAddressCalls = append(f_sym3.NewAddressCalls, invocation_sym3) - - invocation_sym3.Parameters.Addresses = addresses - - f_sym3.NewAddressHook(addresses) - - return -} - -// NewAddressCalled returns true if FakeClientConn.NewAddress was called -func (f *FakeClientConn) NewAddressCalled() bool { - return len(f.NewAddressCalls) != 0 -} - -// AssertNewAddressCalled calls t.Error if FakeClientConn.NewAddress was not called -func (f *FakeClientConn) AssertNewAddressCalled(t ClientConnTestingT) { - t.Helper() - if len(f.NewAddressCalls) == 0 { - t.Error("FakeClientConn.NewAddress not called, expected at least one") - } -} - -// NewAddressNotCalled returns true if FakeClientConn.NewAddress was not called -func (f *FakeClientConn) NewAddressNotCalled() bool { - return len(f.NewAddressCalls) == 0 -} - -// AssertNewAddressNotCalled calls t.Error if FakeClientConn.NewAddress was called -func (f *FakeClientConn) AssertNewAddressNotCalled(t ClientConnTestingT) { - t.Helper() - if len(f.NewAddressCalls) != 0 { - t.Error("FakeClientConn.NewAddress called, expected none") - } -} - -// NewAddressCalledOnce returns true if FakeClientConn.NewAddress was called exactly once -func (f *FakeClientConn) NewAddressCalledOnce() bool { - return len(f.NewAddressCalls) == 1 -} - -// AssertNewAddressCalledOnce calls t.Error if FakeClientConn.NewAddress was not called exactly once -func (f *FakeClientConn) AssertNewAddressCalledOnce(t ClientConnTestingT) { - t.Helper() - if len(f.NewAddressCalls) != 1 { - t.Errorf("FakeClientConn.NewAddress called %d times, expected 1", len(f.NewAddressCalls)) - } -} - -// NewAddressCalledN returns true if FakeClientConn.NewAddress was called at least n times -func (f *FakeClientConn) NewAddressCalledN(n int) bool { - return len(f.NewAddressCalls) >= n -} - -// AssertNewAddressCalledN calls t.Error if FakeClientConn.NewAddress was called less than n times -func (f *FakeClientConn) AssertNewAddressCalledN(t ClientConnTestingT, n int) { - t.Helper() - if len(f.NewAddressCalls) < n { - t.Errorf("FakeClientConn.NewAddress called %d times, expected >= %d", len(f.NewAddressCalls), n) - } -} - -// NewAddressCalledWith returns true if FakeClientConn.NewAddress was called with the given values -func (f_sym4 *FakeClientConn) NewAddressCalledWith(addresses []resolver.Address) bool { - for _, call_sym4 := range f_sym4.NewAddressCalls { - if reflect.DeepEqual(call_sym4.Parameters.Addresses, addresses) { - return true - } - } - - return false -} - -// AssertNewAddressCalledWith calls t.Error if FakeClientConn.NewAddress was not called with the given values -func (f_sym5 *FakeClientConn) AssertNewAddressCalledWith(t ClientConnTestingT, addresses []resolver.Address) { - t.Helper() - var found_sym5 bool - for _, call_sym5 := range f_sym5.NewAddressCalls { - if reflect.DeepEqual(call_sym5.Parameters.Addresses, addresses) { - found_sym5 = true - break - } - } - - if !found_sym5 { - t.Error("FakeClientConn.NewAddress not called with expected parameters") - } -} - -// NewAddressCalledOnceWith returns true if FakeClientConn.NewAddress was called exactly once with the given values -func (f_sym6 *FakeClientConn) NewAddressCalledOnceWith(addresses []resolver.Address) bool { - var count_sym6 int - for _, call_sym6 := range f_sym6.NewAddressCalls { - if reflect.DeepEqual(call_sym6.Parameters.Addresses, addresses) { - count_sym6++ - } - } - - return count_sym6 == 1 -} - -// AssertNewAddressCalledOnceWith calls t.Error if FakeClientConn.NewAddress was not called exactly once with the given values -func (f_sym7 *FakeClientConn) AssertNewAddressCalledOnceWith(t ClientConnTestingT, addresses []resolver.Address) { - t.Helper() - var count_sym7 int - for _, call_sym7 := range f_sym7.NewAddressCalls { - if reflect.DeepEqual(call_sym7.Parameters.Addresses, addresses) { - count_sym7++ - } - } - - if count_sym7 != 1 { - t.Errorf("FakeClientConn.NewAddress called %d times with expected parameters, expected one", count_sym7) - } -} - -func (f_sym8 *FakeClientConn) NewServiceConfig(serviceConfig string) { - if f_sym8.NewServiceConfigHook == nil { - panic("ClientConn.NewServiceConfig() called but FakeClientConn.NewServiceConfigHook is nil") - } - - invocation_sym8 := new(ClientConnNewServiceConfigInvocation) - f_sym8.NewServiceConfigCalls = append(f_sym8.NewServiceConfigCalls, invocation_sym8) - - invocation_sym8.Parameters.ServiceConfig = serviceConfig - - f_sym8.NewServiceConfigHook(serviceConfig) - - return -} - -// NewServiceConfigCalled returns true if FakeClientConn.NewServiceConfig was called -func (f *FakeClientConn) NewServiceConfigCalled() bool { - return len(f.NewServiceConfigCalls) != 0 -} - -// AssertNewServiceConfigCalled calls t.Error if FakeClientConn.NewServiceConfig was not called -func (f *FakeClientConn) AssertNewServiceConfigCalled(t ClientConnTestingT) { - t.Helper() - if len(f.NewServiceConfigCalls) == 0 { - t.Error("FakeClientConn.NewServiceConfig not called, expected at least one") - } -} - -// NewServiceConfigNotCalled returns true if FakeClientConn.NewServiceConfig was not called -func (f *FakeClientConn) NewServiceConfigNotCalled() bool { - return len(f.NewServiceConfigCalls) == 0 -} - -// AssertNewServiceConfigNotCalled calls t.Error if FakeClientConn.NewServiceConfig was called -func (f *FakeClientConn) AssertNewServiceConfigNotCalled(t ClientConnTestingT) { - t.Helper() - if len(f.NewServiceConfigCalls) != 0 { - t.Error("FakeClientConn.NewServiceConfig called, expected none") - } -} - -// NewServiceConfigCalledOnce returns true if FakeClientConn.NewServiceConfig was called exactly once -func (f *FakeClientConn) NewServiceConfigCalledOnce() bool { - return len(f.NewServiceConfigCalls) == 1 -} - -// AssertNewServiceConfigCalledOnce calls t.Error if FakeClientConn.NewServiceConfig was not called exactly once -func (f *FakeClientConn) AssertNewServiceConfigCalledOnce(t ClientConnTestingT) { - t.Helper() - if len(f.NewServiceConfigCalls) != 1 { - t.Errorf("FakeClientConn.NewServiceConfig called %d times, expected 1", len(f.NewServiceConfigCalls)) - } -} - -// NewServiceConfigCalledN returns true if FakeClientConn.NewServiceConfig was called at least n times -func (f *FakeClientConn) NewServiceConfigCalledN(n int) bool { - return len(f.NewServiceConfigCalls) >= n -} - -// AssertNewServiceConfigCalledN calls t.Error if FakeClientConn.NewServiceConfig was called less than n times -func (f *FakeClientConn) AssertNewServiceConfigCalledN(t ClientConnTestingT, n int) { - t.Helper() - if len(f.NewServiceConfigCalls) < n { - t.Errorf("FakeClientConn.NewServiceConfig called %d times, expected >= %d", len(f.NewServiceConfigCalls), n) - } -} - -// NewServiceConfigCalledWith returns true if FakeClientConn.NewServiceConfig was called with the given values -func (f_sym9 *FakeClientConn) NewServiceConfigCalledWith(serviceConfig string) bool { - for _, call_sym9 := range f_sym9.NewServiceConfigCalls { - if reflect.DeepEqual(call_sym9.Parameters.ServiceConfig, serviceConfig) { - return true - } - } - - return false -} - -// AssertNewServiceConfigCalledWith calls t.Error if FakeClientConn.NewServiceConfig was not called with the given values -func (f_sym10 *FakeClientConn) AssertNewServiceConfigCalledWith(t ClientConnTestingT, serviceConfig string) { - t.Helper() - var found_sym10 bool - for _, call_sym10 := range f_sym10.NewServiceConfigCalls { - if reflect.DeepEqual(call_sym10.Parameters.ServiceConfig, serviceConfig) { - found_sym10 = true - break - } - } - - if !found_sym10 { - t.Error("FakeClientConn.NewServiceConfig not called with expected parameters") - } -} - -// NewServiceConfigCalledOnceWith returns true if FakeClientConn.NewServiceConfig was called exactly once with the given values -func (f_sym11 *FakeClientConn) NewServiceConfigCalledOnceWith(serviceConfig string) bool { - var count_sym11 int - for _, call_sym11 := range f_sym11.NewServiceConfigCalls { - if reflect.DeepEqual(call_sym11.Parameters.ServiceConfig, serviceConfig) { - count_sym11++ - } - } - - return count_sym11 == 1 -} - -// AssertNewServiceConfigCalledOnceWith calls t.Error if FakeClientConn.NewServiceConfig was not called exactly once with the given values -func (f_sym12 *FakeClientConn) AssertNewServiceConfigCalledOnceWith(t ClientConnTestingT, serviceConfig string) { - t.Helper() - var count_sym12 int - for _, call_sym12 := range f_sym12.NewServiceConfigCalls { - if reflect.DeepEqual(call_sym12.Parameters.ServiceConfig, serviceConfig) { - count_sym12++ - } - } - - if count_sym12 != 1 { - t.Errorf("FakeClientConn.NewServiceConfig called %d times with expected parameters, expected one", count_sym12) - } -} - -// servicerServiceInvocation represents a single call of Fakeservicer.Service -type servicerServiceInvocation struct { - Parameters struct { - Ident1 string - Ident2 string - Ident3 bool - Ident4 *api.QueryOptions - } - Results struct { - Ident5 []*api.ServiceEntry - Ident6 *api.QueryMeta - Ident7 error - } -} - -// NewservicerServiceInvocation creates a new instance of servicerServiceInvocation -func NewservicerServiceInvocation(ident1 string, ident2 string, ident3 bool, ident4 *api.QueryOptions, ident5 []*api.ServiceEntry, ident6 *api.QueryMeta, ident7 error) *servicerServiceInvocation { - invocation := new(servicerServiceInvocation) - - invocation.Parameters.Ident1 = ident1 - invocation.Parameters.Ident2 = ident2 - invocation.Parameters.Ident3 = ident3 - invocation.Parameters.Ident4 = ident4 - - invocation.Results.Ident5 = ident5 - invocation.Results.Ident6 = ident6 - invocation.Results.Ident7 = ident7 - - return invocation -} - -// servicerTestingT represents the methods of "testing".T used by charlatan Fakes. It avoids importing the testing package. -type servicerTestingT interface { - Error(...interface{}) - Errorf(string, ...interface{}) - Fatal(...interface{}) - Helper() -} - -/* -Fakeservicer is a mock implementation of servicer for testing. -Use it in your tests as in this example: - - package example - - func TestWithservicer(t *testing.T) { - f := &consul.Fakeservicer{ - ServiceHook: func(ident1 string, ident2 string, ident3 bool, ident4 *api.QueryOptions) (ident5 []*api.ServiceEntry, ident6 *api.QueryMeta, ident7 error) { - // ensure parameters meet expections, signal errors using t, etc - return - }, - } - - // test code goes here ... - - // assert state of FakeService ... - f.AssertServiceCalledOnce(t) - } - -Create anonymous function implementations for only those interface methods that -should be called in the code under test. This will force a panic if any -unexpected calls are made to FakeService. -*/ -type Fakeservicer struct { - ServiceHook func(string, string, bool, *api.QueryOptions) ([]*api.ServiceEntry, *api.QueryMeta, error) - - ServiceCalls []*servicerServiceInvocation -} - -// NewFakeservicerDefaultPanic returns an instance of Fakeservicer with all hooks configured to panic -func NewFakeservicerDefaultPanic() *Fakeservicer { - return &Fakeservicer{ - ServiceHook: func(string, string, bool, *api.QueryOptions) (ident5 []*api.ServiceEntry, ident6 *api.QueryMeta, ident7 error) { - panic("Unexpected call to servicer.Service") - }, - } -} - -// NewFakeservicerDefaultFatal returns an instance of Fakeservicer with all hooks configured to call t.Fatal -func NewFakeservicerDefaultFatal(t_sym13 servicerTestingT) *Fakeservicer { - return &Fakeservicer{ - ServiceHook: func(string, string, bool, *api.QueryOptions) (ident5 []*api.ServiceEntry, ident6 *api.QueryMeta, ident7 error) { - t_sym13.Fatal("Unexpected call to servicer.Service") - return - }, - } -} - -// NewFakeservicerDefaultError returns an instance of Fakeservicer with all hooks configured to call t.Error -func NewFakeservicerDefaultError(t_sym14 servicerTestingT) *Fakeservicer { - return &Fakeservicer{ - ServiceHook: func(string, string, bool, *api.QueryOptions) (ident5 []*api.ServiceEntry, ident6 *api.QueryMeta, ident7 error) { - t_sym14.Error("Unexpected call to servicer.Service") - return - }, - } -} - -func (f *Fakeservicer) Reset() { - f.ServiceCalls = []*servicerServiceInvocation{} -} - -func (f_sym15 *Fakeservicer) Service(ident1 string, ident2 string, ident3 bool, ident4 *api.QueryOptions) (ident5 []*api.ServiceEntry, ident6 *api.QueryMeta, ident7 error) { - if f_sym15.ServiceHook == nil { - panic("servicer.Service() called but Fakeservicer.ServiceHook is nil") - } - - invocation_sym15 := new(servicerServiceInvocation) - f_sym15.ServiceCalls = append(f_sym15.ServiceCalls, invocation_sym15) - - invocation_sym15.Parameters.Ident1 = ident1 - invocation_sym15.Parameters.Ident2 = ident2 - invocation_sym15.Parameters.Ident3 = ident3 - invocation_sym15.Parameters.Ident4 = ident4 - - ident5, ident6, ident7 = f_sym15.ServiceHook(ident1, ident2, ident3, ident4) - - invocation_sym15.Results.Ident5 = ident5 - invocation_sym15.Results.Ident6 = ident6 - invocation_sym15.Results.Ident7 = ident7 - - return -} - -// SetServiceStub configures servicer.Service to always return the given values -func (f_sym16 *Fakeservicer) SetServiceStub(ident5 []*api.ServiceEntry, ident6 *api.QueryMeta, ident7 error) { - f_sym16.ServiceHook = func(string, string, bool, *api.QueryOptions) ([]*api.ServiceEntry, *api.QueryMeta, error) { - return ident5, ident6, ident7 - } -} - -// SetServiceInvocation configures servicer.Service to return the given results when called with the given parameters -// If no match is found for an invocation the result(s) of the fallback function are returned -func (f_sym17 *Fakeservicer) SetServiceInvocation(calls_sym17 []*servicerServiceInvocation, fallback_sym17 func() ([]*api.ServiceEntry, *api.QueryMeta, error)) { - f_sym17.ServiceHook = func(ident1 string, ident2 string, ident3 bool, ident4 *api.QueryOptions) (ident5 []*api.ServiceEntry, ident6 *api.QueryMeta, ident7 error) { - for _, call_sym17 := range calls_sym17 { - if reflect.DeepEqual(call_sym17.Parameters.Ident1, ident1) && reflect.DeepEqual(call_sym17.Parameters.Ident2, ident2) && reflect.DeepEqual(call_sym17.Parameters.Ident3, ident3) && reflect.DeepEqual(call_sym17.Parameters.Ident4, ident4) { - ident5 = call_sym17.Results.Ident5 - ident6 = call_sym17.Results.Ident6 - ident7 = call_sym17.Results.Ident7 - - return - } - } - - return fallback_sym17() - } -} - -// ServiceCalled returns true if Fakeservicer.Service was called -func (f *Fakeservicer) ServiceCalled() bool { - return len(f.ServiceCalls) != 0 -} - -// AssertServiceCalled calls t.Error if Fakeservicer.Service was not called -func (f *Fakeservicer) AssertServiceCalled(t servicerTestingT) { - t.Helper() - if len(f.ServiceCalls) == 0 { - t.Error("Fakeservicer.Service not called, expected at least one") - } -} - -// ServiceNotCalled returns true if Fakeservicer.Service was not called -func (f *Fakeservicer) ServiceNotCalled() bool { - return len(f.ServiceCalls) == 0 -} - -// AssertServiceNotCalled calls t.Error if Fakeservicer.Service was called -func (f *Fakeservicer) AssertServiceNotCalled(t servicerTestingT) { - t.Helper() - if len(f.ServiceCalls) != 0 { - t.Error("Fakeservicer.Service called, expected none") - } -} - -// ServiceCalledOnce returns true if Fakeservicer.Service was called exactly once -func (f *Fakeservicer) ServiceCalledOnce() bool { - return len(f.ServiceCalls) == 1 -} - -// AssertServiceCalledOnce calls t.Error if Fakeservicer.Service was not called exactly once -func (f *Fakeservicer) AssertServiceCalledOnce(t servicerTestingT) { - t.Helper() - if len(f.ServiceCalls) != 1 { - t.Errorf("Fakeservicer.Service called %d times, expected 1", len(f.ServiceCalls)) - } -} - -// ServiceCalledN returns true if Fakeservicer.Service was called at least n times -func (f *Fakeservicer) ServiceCalledN(n int) bool { - return len(f.ServiceCalls) >= n -} - -// AssertServiceCalledN calls t.Error if Fakeservicer.Service was called less than n times -func (f *Fakeservicer) AssertServiceCalledN(t servicerTestingT, n int) { - t.Helper() - if len(f.ServiceCalls) < n { - t.Errorf("Fakeservicer.Service called %d times, expected >= %d", len(f.ServiceCalls), n) - } -} - -// ServiceCalledWith returns true if Fakeservicer.Service was called with the given values -func (f_sym18 *Fakeservicer) ServiceCalledWith(ident1 string, ident2 string, ident3 bool, ident4 *api.QueryOptions) bool { - for _, call_sym18 := range f_sym18.ServiceCalls { - if reflect.DeepEqual(call_sym18.Parameters.Ident1, ident1) && reflect.DeepEqual(call_sym18.Parameters.Ident2, ident2) && reflect.DeepEqual(call_sym18.Parameters.Ident3, ident3) && reflect.DeepEqual(call_sym18.Parameters.Ident4, ident4) { - return true - } - } - - return false -} - -// AssertServiceCalledWith calls t.Error if Fakeservicer.Service was not called with the given values -func (f_sym19 *Fakeservicer) AssertServiceCalledWith(t servicerTestingT, ident1 string, ident2 string, ident3 bool, ident4 *api.QueryOptions) { - t.Helper() - var found_sym19 bool - for _, call_sym19 := range f_sym19.ServiceCalls { - if reflect.DeepEqual(call_sym19.Parameters.Ident1, ident1) && reflect.DeepEqual(call_sym19.Parameters.Ident2, ident2) && reflect.DeepEqual(call_sym19.Parameters.Ident3, ident3) && reflect.DeepEqual(call_sym19.Parameters.Ident4, ident4) { - found_sym19 = true - break - } - } - - if !found_sym19 { - t.Error("Fakeservicer.Service not called with expected parameters") - } -} - -// ServiceCalledOnceWith returns true if Fakeservicer.Service was called exactly once with the given values -func (f_sym20 *Fakeservicer) ServiceCalledOnceWith(ident1 string, ident2 string, ident3 bool, ident4 *api.QueryOptions) bool { - var count_sym20 int - for _, call_sym20 := range f_sym20.ServiceCalls { - if reflect.DeepEqual(call_sym20.Parameters.Ident1, ident1) && reflect.DeepEqual(call_sym20.Parameters.Ident2, ident2) && reflect.DeepEqual(call_sym20.Parameters.Ident3, ident3) && reflect.DeepEqual(call_sym20.Parameters.Ident4, ident4) { - count_sym20++ - } - } - - return count_sym20 == 1 -} - -// AssertServiceCalledOnceWith calls t.Error if Fakeservicer.Service was not called exactly once with the given values -func (f_sym21 *Fakeservicer) AssertServiceCalledOnceWith(t servicerTestingT, ident1 string, ident2 string, ident3 bool, ident4 *api.QueryOptions) { - t.Helper() - var count_sym21 int - for _, call_sym21 := range f_sym21.ServiceCalls { - if reflect.DeepEqual(call_sym21.Parameters.Ident1, ident1) && reflect.DeepEqual(call_sym21.Parameters.Ident2, ident2) && reflect.DeepEqual(call_sym21.Parameters.Ident3, ident3) && reflect.DeepEqual(call_sym21.Parameters.Ident4, ident4) { - count_sym21++ - } - } - - if count_sym21 != 1 { - t.Errorf("Fakeservicer.Service called %d times with expected parameters, expected one", count_sym21) - } -} - -// ServiceResultsForCall returns the result values for the first call to Fakeservicer.Service with the given values -func (f_sym22 *Fakeservicer) ServiceResultsForCall(ident1 string, ident2 string, ident3 bool, ident4 *api.QueryOptions) (ident5 []*api.ServiceEntry, ident6 *api.QueryMeta, ident7 error, found_sym22 bool) { - for _, call_sym22 := range f_sym22.ServiceCalls { - if reflect.DeepEqual(call_sym22.Parameters.Ident1, ident1) && reflect.DeepEqual(call_sym22.Parameters.Ident2, ident2) && reflect.DeepEqual(call_sym22.Parameters.Ident3, ident3) && reflect.DeepEqual(call_sym22.Parameters.Ident4, ident4) { - ident5 = call_sym22.Results.Ident5 - ident6 = call_sym22.Results.Ident6 - ident7 = call_sym22.Results.Ident7 - found_sym22 = true - break - } - } - - return -} diff --git a/consul.go b/consul.go index 8d33f48..f23b2c9 100644 --- a/consul.go +++ b/consul.go @@ -31,6 +31,8 @@ func (r *resolvr) Close() { r.cancelFunc() } +//go:generate mockgen -package mocks -destination internal/mocks/resolverClientConn.go google.golang.org/grpc/resolver ClientConn +//go:generate mockgen -package mocks -destination internal/mocks/servicer.go -source consul.go servicer type servicer interface { Service(string, string, bool, *api.QueryOptions) ([]*api.ServiceEntry, *api.QueryMeta, error) } @@ -106,7 +108,7 @@ func populateEndpoints(ctx context.Context, clientConn resolver.ClientConn, inpu conns = append(conns, resolver.Address{Addr: c}) } sort.Sort(byAddressString(conns)) // Don't replace the same address list in the balancer - clientConn.NewAddress(conns) + clientConn.UpdateState(resolver.State{Addresses: conns}) case <-ctx.Done(): grpclog.Info("[Consul resolver] Watch has been finished") return diff --git a/consul_test.go b/consul_test.go index 576740c..a90bb2c 100644 --- a/consul_test.go +++ b/consul_test.go @@ -5,48 +5,50 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" "github.com/hashicorp/consul/api" - "github.com/pkg/errors" + "github.com/mbobakov/grpc-consul-resolver/internal/mocks" "github.com/stretchr/testify/require" "google.golang.org/grpc/resolver" ) func TestPopulateEndpoints(t *testing.T) { tests := []struct { - name string - input [][]string - want []resolver.Address + name string + input [][]string + wantCalls [][]resolver.Address }{ - {"one", [][]string{{"127.0.0.1:50051"}}, []resolver.Address{{Addr: "127.0.0.1:50051"}}}, - {"sorted", - [][]string{ - {"227.0.0.1:50051", "127.0.0.1:50051"}, - }, - []resolver.Address{ - {Addr: "127.0.0.1:50051"}, - {Addr: "227.0.0.1:50051"}, + {"one", + [][]string{{"127.0.0.1:50051"}}, + [][]resolver.Address{ + []resolver.Address{ + {Addr: "127.0.0.1:50051"}, + }, }, }, - {"multy", + {"sorted", [][]string{ - {"127.0.0.1:50051"}, - {"127.0.0.1:50052"}, - {"127.0.0.1:50053"}, + {"227.0.0.1:50051", "127.0.0.1:50051"}, }, - []resolver.Address{ - {Addr: "127.0.0.1:50053"}, + [][]resolver.Address{ + []resolver.Address{ + {Addr: "127.0.0.1:50051"}, + {Addr: "227.0.0.1:50051"}, + }, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + ctrl := gomock.NewController(t) + defer ctrl.Finish() var ( - got []resolver.Address - in = make(chan []string, len(tt.input)) + in = make(chan []string, len(tt.input)) ) - fcc := NewFakeClientConnDefaultFatal(t) - fcc.NewAddressHook = func(cc []resolver.Address) { - got = cc + + fcc := mocks.NewMockClientConn(ctrl) + for _, aa := range tt.wantCalls { + fcc.EXPECT().UpdateState(resolver.State{Addresses: aa}).Times(1) } ctx, cancel := context.WithCancel(context.Background()) @@ -56,8 +58,6 @@ func TestPopulateEndpoints(t *testing.T) { in <- i } time.Sleep(time.Millisecond) - require.True(t, fcc.NewAddressCalledN(len(tt.input))) - require.Equal(t, tt.want, got) }) } } @@ -66,21 +66,27 @@ func TestWatchConsulService(t *testing.T) { tests := []struct { name string tgt target - addr []string // port increased with 1 per invocation - startPort int - times uint64 - errorFromService bool + services []*api.ServiceEntry + errorFromService error want []string }{ - {"simple", target{Service: "svc", Wait: time.Second}, []string{"127.0.0.1"}, 100, 3, false, []string{"127.0.0.1:102"}}, - {"error", target{}, []string{"127.0.0.1"}, 100, 2, true, nil}, - {"limit", target{Limit: 1}, []string{"127.0.0.1", "127.0.0.2", "127.0.0.3"}, 100, 1, false, []string{"127.0.0.1:100"}}, - {"limitOver", target{Limit: 10}, []string{"127.0.0.1"}, 100, 1, false, []string{"127.0.0.1:100"}}, + {"simple", target{Service: "svc", Wait: time.Second}, + []*api.ServiceEntry{ + &api.ServiceEntry{ + Service: &api.AgentService{Address: "127.0.0.1", Port: 1024}, + }, + }, + nil, + []string{"127.0.0.1:1024"}, + }, + // TODO: Add more tests-cases } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + ctrl := gomock.NewController(t) + defer ctrl.Finish() var ( got []string @@ -95,30 +101,38 @@ func TestWatchConsulService(t *testing.T) { } } }() - fconsul := NewFakeservicerDefaultFatal(t) - - fconsul.ServiceHook = func(s, tag string, hlz bool, q *api.QueryOptions) ([]*api.ServiceEntry, *api.QueryMeta, error) { - require.Equal(t, tt.tgt.Service, s) - require.Equal(t, tt.tgt.Tag, tag) - require.Equal(t, tt.tgt.Healthy, hlz) - require.Equal(t, tt.tgt.Wait, q.WaitTime) - if q.WaitIndex >= tt.times { - select {} - } - if tt.errorFromService { - return nil, &api.QueryMeta{LastIndex: q.WaitIndex + 1}, errors.New("Error") - } - var rr []*api.ServiceEntry - for _, a := range tt.addr { - rr = append(rr, &api.ServiceEntry{Service: &api.AgentService{Address: a, Port: tt.startPort + int(q.WaitIndex)}}) - } - return rr, &api.QueryMeta{LastIndex: q.WaitIndex + 1}, nil - } + fconsul := mocks.NewMockservicer(ctrl) + fconsul.EXPECT().Service(tt.tgt.Service, tt.tgt.Tag, tt.tgt.Healthy, &api.QueryOptions{ + WaitIndex: 0, + Near: tt.tgt.Near, + WaitTime: tt.tgt.Wait, + Datacenter: tt.tgt.Dc, + AllowStale: tt.tgt.AllowStale, + RequireConsistent: tt.tgt.RequireConsistent, + }). + Times(1). + Return(tt.services, &api.QueryMeta{LastIndex: 1}, tt.errorFromService) + fconsul.EXPECT().Service(tt.tgt.Service, tt.tgt.Tag, tt.tgt.Healthy, &api.QueryOptions{ + WaitIndex: 1, + Near: tt.tgt.Near, + WaitTime: tt.tgt.Wait, + Datacenter: tt.tgt.Dc, + AllowStale: tt.tgt.AllowStale, + RequireConsistent: tt.tgt.RequireConsistent, + }). + Do( + func(svc string, tag string, h bool, opt *api.QueryOptions) ([]*api.ServiceEntry, *api.QueryMeta, error) { + if opt.WaitIndex > 0 { + select {} + } + return tt.services, &api.QueryMeta{LastIndex: 1}, tt.errorFromService + }, + ).Times(1). + Return(tt.services, &api.QueryMeta{LastIndex: 1}, tt.errorFromService) go watchConsulService(ctx, fconsul, tt.tgt, out) - time.Sleep(15 * time.Millisecond) + time.Sleep(5 * time.Millisecond) - require.True(t, fconsul.ServiceCalledN(int(tt.times))) require.Equal(t, tt.want, got) }) } diff --git a/go.mod b/go.mod index 2629b30..206f7d0 100644 --- a/go.mod +++ b/go.mod @@ -1,19 +1,21 @@ module github.com/mbobakov/grpc-consul-resolver +go 1.13 + require ( - github.com/armon/go-metrics v0.3.0 // indirect - github.com/go-playground/form v3.1.3+incompatible - github.com/hashicorp/consul/api v1.1.0 - github.com/hashicorp/go-msgpack v0.5.5 // indirect - github.com/hashicorp/memberlist v0.1.5 // indirect - github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7 + github.com/go-playground/form v3.1.4+incompatible + github.com/golang/mock v1.1.1 + github.com/google/btree v1.0.0 // indirect + github.com/hashicorp/consul/api v1.3.0 + github.com/jpillora/backoff v1.0.0 + github.com/kr/pretty v0.1.0 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/pkg/errors v0.8.1 - github.com/sirupsen/logrus v1.1.1 - github.com/stretchr/testify v1.3.0 - golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c // indirect - golang.org/x/net v0.0.0-20190403144856-b630fd6fe46b // indirect - golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 // indirect - golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e // indirect - google.golang.org/grpc v1.2.1-0.20181011201045-c05280cc73cd + github.com/sirupsen/logrus v1.4.2 + github.com/stretchr/testify v1.4.0 + golang.org/x/net v0.0.0-20190522155817-f3200d17e092 // indirect + google.golang.org/grpc v1.26.0 + gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect gopkg.in/go-playground/assert.v1 v1.2.1 // indirect + gopkg.in/yaml.v2 v2.2.4 // indirect ) diff --git a/go.sum b/go.sum index 6173d97..0e5542a 100644 --- a/go.sum +++ b/go.sum @@ -1,47 +1,48 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.3.0 h1:B7AQgHi8QSEi4uHu7Sbsga+IJDU+CENgjxoo81vDUqU= -github.com/armon/go-metrics v0.3.0/go.mod h1:zXjbSimjXTd7vOpY8B0/2LpvNvDoXBuplAD+gJD3GYs= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= -github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/go-playground/form v3.1.3+incompatible h1:GY0v2KFh5AYLVffrkgCFcaN7hcFaX8VXMOAGQ+WtpZs= -github.com/go-playground/form v3.1.3+incompatible/go.mod h1:lhcKXfTuhRtIZCIKUeJ0b5F207aeQCPbZU09ScKjwWg= +github.com/go-playground/form v3.1.4+incompatible h1:lvKiHVxE2WvzDIoyMnWcjyiBxKt2+uFJyZcPYWsLnjI= +github.com/go-playground/form v3.1.4+incompatible/go.mod h1:lhcKXfTuhRtIZCIKUeJ0b5F207aeQCPbZU09ScKjwWg= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= +github.com/golang/mock v1.1.1 h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCydnIczKteheJEzHRToSGK3Bnlw= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/hashicorp/consul/api v1.1.0 h1:BNQPM9ytxj6jbjjdRPioQ94T6YXriSopn0i8COv6SRA= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/sdk v0.1.1 h1:LnuDWGNsoajlhGyHJvuWW6FVqRl8JOTPqS6CPTsYjhY= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/hashicorp/consul/api v1.3.0 h1:HXNYlRkkM/t+Y/Yhxtwcy02dlYwIaoxzvxPnS+cqy78= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/sdk v0.3.0 h1:UOxjlb4xVNF93jak1mzzoBatyFju9nrkxpVwIp/QqxQ= +github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.0 h1:wvCrVc9TjDls6+YGAF2hAifE1E5U1+b4tH6KdvN3Gig= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-msgpack v0.5.5 h1:i9R9JSrqIz0QVLz3sz+i3YJdT7TTSLcfLLzJi9aZTuI= -github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0 h1:Rqb66Oo1X/eSV1x66xbDccZjhJigjg0+e82kpwzSwCI= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-sockaddr v1.0.0 h1:GeH6tui99pF4NJgfnhp+L6+FfobzVW3Ah46sLo0ICXs= @@ -55,24 +56,28 @@ github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCO github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3 h1:EmmoJme1matNzb+hMpDuR/0sbJSUisxyqBGG676r31M= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/memberlist v0.1.5 h1:AYBsgJOW9gab/toO5tEB8lWetVgDKZycqkebJ8xxpqM= -github.com/hashicorp/memberlist v0.1.5/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2 h1:YZ7UKsJv+hKjqGVUUbtE3HNj79Eln2oQ75tniF6iPt0= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7 h1:K//n/AqR5HjG3qxbrBCL4vJPW0MVFSs9CPK1OOJdRME= -github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7/go.mod h1:2iMrUgbbvHEiQClaW2NsSzMyGHqN+rDFqY705q49KG0= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe h1:CHRGQ8V7OlCYtwaKPJi3iA7J+YdNKdo8j7nG5IgDhjs= -github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.0.14 h1:9jZdLNd/P4+SfEJ0TNyxYpsK8N4GtfylBLqtbYN1sbA= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= @@ -80,69 +85,86 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= -github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/sirupsen/logrus v1.1.1 h1:VzGj7lhU7KEB9e9gMpAV/v5XT2NVSvLJhJLCWbnkgXg= -github.com/sirupsen/logrus v1.1.1/go.mod h1:zrgwTnHtNr00buQ1vSptGe8m1f/BbgsPukg8qsT7A+A= +github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3 h1:KYQXGkl6vs02hK7pK4eIbw0NpNPedieTSTEiJ//bwGs= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c h1:Vj5n4GlwjmQteupaxJ9+0FNOmBrHfq7vN4btdGoDZgI= -golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc h1:a3CU5tJYVj92DY2LaA1kUkrsqD5/3mLDhx2NcNqyW+0= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190403144856-b630fd6fe46b h1:/zjbcJPEGAyu6Is/VBOALsgdi4z9+kz/Vtdm6S+beD0= -golang.org/x/net v0.0.0-20190403144856-b630fd6fe46b/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 h1:bjcUS9ztw9kFmmIxJInhon/0Is3p+EHBKNgquIzo1OI= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5 h1:x6r4Jo0KNzOOzYd8lbcRsqjuqEASK6ob3auvWYM4/8U= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e h1:nFYrTHrdrAOpShe27kaFHjsqYSEQ0KWqdWLu3xuZJts= -golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/grpc v1.2.1-0.20181011201045-c05280cc73cd h1:v9jzEUwtfbZGqmG5Vx0jvJ33997QiWwOIr3pvZgSGRU= -google.golang.org/grpc v1.2.1-0.20181011201045-c05280cc73cd/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.26.0 h1:2dTRdpdFEEhJYQD8EMLB61nnrzSCTbG38PhqdhvOltg= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/mocks/resolverClientConn.go b/internal/mocks/resolverClientConn.go new file mode 100644 index 0000000..12a7dc2 --- /dev/null +++ b/internal/mocks/resolverClientConn.go @@ -0,0 +1,87 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: google.golang.org/grpc/resolver (interfaces: ClientConn) + +// Package mocks is a generated GoMock package. +package mocks + +import ( + gomock "github.com/golang/mock/gomock" + resolver "google.golang.org/grpc/resolver" + serviceconfig "google.golang.org/grpc/serviceconfig" + reflect "reflect" +) + +// MockClientConn is a mock of ClientConn interface +type MockClientConn struct { + ctrl *gomock.Controller + recorder *MockClientConnMockRecorder +} + +// MockClientConnMockRecorder is the mock recorder for MockClientConn +type MockClientConnMockRecorder struct { + mock *MockClientConn +} + +// NewMockClientConn creates a new mock instance +func NewMockClientConn(ctrl *gomock.Controller) *MockClientConn { + mock := &MockClientConn{ctrl: ctrl} + mock.recorder = &MockClientConnMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockClientConn) EXPECT() *MockClientConnMockRecorder { + return m.recorder +} + +// NewAddress mocks base method +func (m *MockClientConn) NewAddress(arg0 []resolver.Address) { + m.ctrl.Call(m, "NewAddress", arg0) +} + +// NewAddress indicates an expected call of NewAddress +func (mr *MockClientConnMockRecorder) NewAddress(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewAddress", reflect.TypeOf((*MockClientConn)(nil).NewAddress), arg0) +} + +// NewServiceConfig mocks base method +func (m *MockClientConn) NewServiceConfig(arg0 string) { + m.ctrl.Call(m, "NewServiceConfig", arg0) +} + +// NewServiceConfig indicates an expected call of NewServiceConfig +func (mr *MockClientConnMockRecorder) NewServiceConfig(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewServiceConfig", reflect.TypeOf((*MockClientConn)(nil).NewServiceConfig), arg0) +} + +// ParseServiceConfig mocks base method +func (m *MockClientConn) ParseServiceConfig(arg0 string) *serviceconfig.ParseResult { + ret := m.ctrl.Call(m, "ParseServiceConfig", arg0) + ret0, _ := ret[0].(*serviceconfig.ParseResult) + return ret0 +} + +// ParseServiceConfig indicates an expected call of ParseServiceConfig +func (mr *MockClientConnMockRecorder) ParseServiceConfig(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ParseServiceConfig", reflect.TypeOf((*MockClientConn)(nil).ParseServiceConfig), arg0) +} + +// ReportError mocks base method +func (m *MockClientConn) ReportError(arg0 error) { + m.ctrl.Call(m, "ReportError", arg0) +} + +// ReportError indicates an expected call of ReportError +func (mr *MockClientConnMockRecorder) ReportError(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReportError", reflect.TypeOf((*MockClientConn)(nil).ReportError), arg0) +} + +// UpdateState mocks base method +func (m *MockClientConn) UpdateState(arg0 resolver.State) { + m.ctrl.Call(m, "UpdateState", arg0) +} + +// UpdateState indicates an expected call of UpdateState +func (mr *MockClientConnMockRecorder) UpdateState(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateState", reflect.TypeOf((*MockClientConn)(nil).UpdateState), arg0) +} diff --git a/internal/mocks/servicer.go b/internal/mocks/servicer.go new file mode 100644 index 0000000..28c955e --- /dev/null +++ b/internal/mocks/servicer.go @@ -0,0 +1,48 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: consul.go + +// Package mocks is a generated GoMock package. +package mocks + +import ( + gomock "github.com/golang/mock/gomock" + api "github.com/hashicorp/consul/api" + reflect "reflect" +) + +// Mockservicer is a mock of servicer interface +type Mockservicer struct { + ctrl *gomock.Controller + recorder *MockservicerMockRecorder +} + +// MockservicerMockRecorder is the mock recorder for Mockservicer +type MockservicerMockRecorder struct { + mock *Mockservicer +} + +// NewMockservicer creates a new mock instance +func NewMockservicer(ctrl *gomock.Controller) *Mockservicer { + mock := &Mockservicer{ctrl: ctrl} + mock.recorder = &MockservicerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *Mockservicer) EXPECT() *MockservicerMockRecorder { + return m.recorder +} + +// Service mocks base method +func (m *Mockservicer) Service(arg0, arg1 string, arg2 bool, arg3 *api.QueryOptions) ([]*api.ServiceEntry, *api.QueryMeta, error) { + ret := m.ctrl.Call(m, "Service", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*api.ServiceEntry) + ret1, _ := ret[1].(*api.QueryMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// Service indicates an expected call of Service +func (mr *MockservicerMockRecorder) Service(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Service", reflect.TypeOf((*Mockservicer)(nil).Service), arg0, arg1, arg2, arg3) +} diff --git a/tests/client_test.go b/tests/client_test.go index 1dbbb3b..2f29443 100644 --- a/tests/client_test.go +++ b/tests/client_test.go @@ -15,7 +15,7 @@ import ( func TestCLient(t *testing.T) { logger := logrus.New() grpclog.SetLoggerV2(&grpcLog{logger}) - conn, err := grpc.Dial("consul://127.0.0.1:8500/whoami?wait=14s&tag=manual", grpc.WithInsecure(), grpc.WithBalancerName("round_robin")) + conn, err := grpc.Dial("consul://127.0.0.1:8500/whoami?wait=14s&tag=public", grpc.WithInsecure(), grpc.WithBalancerName("round_robin")) if err != nil { t.Fatal(err) } diff --git a/tests/docker-compose.yaml b/tests/docker-compose.yaml index e9d1e09..dcd706f 100644 --- a/tests/docker-compose.yaml +++ b/tests/docker-compose.yaml @@ -1,7 +1,7 @@ version: "2.3" services: consul: - image: consul:1.2.3 + image: consul:1.6.2 ports: - "127.0.0.1:8500:8500" command: agent -ui -client 0.0.0.0 -dev