update github.com/didip/tollbooth from v6 to v7

This commit is contained in:
Dmitry Verkhoturov
2024-05-09 02:04:46 +02:00
committed by Umputun
parent d9085e7dcc
commit 0a9e489743
26 changed files with 249 additions and 292 deletions

View File

@@ -9,19 +9,19 @@ import (
// ConsulClientMock is a mock implementation of ConsulClient.
//
// func TestSomethingThatUsesConsulClient(t *testing.T) {
// func TestSomethingThatUsesConsulClient(t *testing.T) {
//
// // make and configure a mocked ConsulClient
// mockedConsulClient := &ConsulClientMock{
// GetFunc: func() ([]consulService, error) {
// panic("mock out the Get method")
// },
// }
// // make and configure a mocked ConsulClient
// mockedConsulClient := &ConsulClientMock{
// GetFunc: func() ([]consulService, error) {
// panic("mock out the Get method")
// },
// }
//
// // use mockedConsulClient in code that requires ConsulClient
// // and then make assertions.
// // use mockedConsulClient in code that requires ConsulClient
// // and then make assertions.
//
// }
// }
type ConsulClientMock struct {
// GetFunc mocks the Get method.
GetFunc func() ([]consulService, error)
@@ -50,7 +50,8 @@ func (mock *ConsulClientMock) Get() ([]consulService, error) {
// GetCalls gets all the calls that were made to Get.
// Check the length with:
// len(mockedConsulClient.GetCalls())
//
// len(mockedConsulClient.GetCalls())
func (mock *ConsulClientMock) GetCalls() []struct {
} {
var calls []struct {

View File

@@ -9,19 +9,19 @@ import (
// DockerClientMock is a mock implementation of DockerClient.
//
// func TestSomethingThatUsesDockerClient(t *testing.T) {
// func TestSomethingThatUsesDockerClient(t *testing.T) {
//
// // make and configure a mocked DockerClient
// mockedDockerClient := &DockerClientMock{
// ListContainersFunc: func() ([]containerInfo, error) {
// panic("mock out the ListContainers method")
// },
// }
// // make and configure a mocked DockerClient
// mockedDockerClient := &DockerClientMock{
// ListContainersFunc: func() ([]containerInfo, error) {
// panic("mock out the ListContainers method")
// },
// }
//
// // use mockedDockerClient in code that requires DockerClient
// // and then make assertions.
// // use mockedDockerClient in code that requires DockerClient
// // and then make assertions.
//
// }
// }
type DockerClientMock struct {
// ListContainersFunc mocks the ListContainers method.
ListContainersFunc func() ([]containerInfo, error)
@@ -50,7 +50,8 @@ func (mock *DockerClientMock) ListContainers() ([]containerInfo, error) {
// ListContainersCalls gets all the calls that were made to ListContainers.
// Check the length with:
// len(mockedDockerClient.ListContainersCalls())
//
// len(mockedDockerClient.ListContainersCalls())
func (mock *DockerClientMock) ListContainersCalls() []struct {
} {
var calls []struct {

View File

@@ -14,22 +14,22 @@ var _ Provider = &ProviderMock{}
// ProviderMock is a mock implementation of Provider.
//
// func TestSomethingThatUsesProvider(t *testing.T) {
// func TestSomethingThatUsesProvider(t *testing.T) {
//
// // make and configure a mocked Provider
// mockedProvider := &ProviderMock{
// EventsFunc: func(ctx context.Context) <-chan ProviderID {
// panic("mock out the Events method")
// },
// ListFunc: func() ([]URLMapper, error) {
// panic("mock out the List method")
// },
// }
// // make and configure a mocked Provider
// mockedProvider := &ProviderMock{
// EventsFunc: func(ctx context.Context) <-chan ProviderID {
// panic("mock out the Events method")
// },
// ListFunc: func() ([]URLMapper, error) {
// panic("mock out the List method")
// },
// }
//
// // use mockedProvider in code that requires Provider
// // and then make assertions.
// // use mockedProvider in code that requires Provider
// // and then make assertions.
//
// }
// }
type ProviderMock struct {
// EventsFunc mocks the Events method.
EventsFunc func(ctx context.Context) <-chan ProviderID
@@ -70,7 +70,8 @@ func (mock *ProviderMock) Events(ctx context.Context) <-chan ProviderID {
// EventsCalls gets all the calls that were made to Events.
// Check the length with:
// len(mockedProvider.EventsCalls())
//
// len(mockedProvider.EventsCalls())
func (mock *ProviderMock) EventsCalls() []struct {
Ctx context.Context
} {
@@ -98,7 +99,8 @@ func (mock *ProviderMock) List() ([]URLMapper, error) {
// ListCalls gets all the calls that were made to List.
// Check the length with:
// len(mockedProvider.ListCalls())
//
// len(mockedProvider.ListCalls())
func (mock *ProviderMock) ListCalls() []struct {
} {
var calls []struct {

View File

@@ -15,19 +15,19 @@ var _ Informer = &InformerMock{}
// InformerMock is a mock implementation of Informer.
//
// func TestSomethingThatUsesInformer(t *testing.T) {
// func TestSomethingThatUsesInformer(t *testing.T) {
//
// // make and configure a mocked Informer
// mockedInformer := &InformerMock{
// MappersFunc: func() []discovery.URLMapper {
// panic("mock out the Mappers method")
// },
// }
// // make and configure a mocked Informer
// mockedInformer := &InformerMock{
// MappersFunc: func() []discovery.URLMapper {
// panic("mock out the Mappers method")
// },
// }
//
// // use mockedInformer in code that requires Informer
// // and then make assertions.
// // use mockedInformer in code that requires Informer
// // and then make assertions.
//
// }
// }
type InformerMock struct {
// MappersFunc mocks the Mappers method.
MappersFunc func() []discovery.URLMapper
@@ -56,7 +56,8 @@ func (mock *InformerMock) Mappers() []discovery.URLMapper {
// MappersCalls gets all the calls that were made to Mappers.
// Check the length with:
// len(mockedInformer.MappersCalls())
//
// len(mockedInformer.MappersCalls())
func (mock *InformerMock) MappersCalls() []struct {
} {
var calls []struct {

View File

@@ -13,19 +13,19 @@ var _ RPCClient = &RPCClientMock{}
// RPCClientMock is a mock implementation of RPCClient.
//
// func TestSomethingThatUsesRPCClient(t *testing.T) {
// func TestSomethingThatUsesRPCClient(t *testing.T) {
//
// // make and configure a mocked RPCClient
// mockedRPCClient := &RPCClientMock{
// CallFunc: func(serviceMethod string, args interface{}, reply interface{}) error {
// panic("mock out the Call method")
// },
// }
// // make and configure a mocked RPCClient
// mockedRPCClient := &RPCClientMock{
// CallFunc: func(serviceMethod string, args interface{}, reply interface{}) error {
// panic("mock out the Call method")
// },
// }
//
// // use mockedRPCClient in code that requires RPCClient
// // and then make assertions.
// // use mockedRPCClient in code that requires RPCClient
// // and then make assertions.
//
// }
// }
type RPCClientMock struct {
// CallFunc mocks the Call method.
CallFunc func(serviceMethod string, args interface{}, reply interface{}) error
@@ -67,7 +67,8 @@ func (mock *RPCClientMock) Call(serviceMethod string, args interface{}, reply in
// CallCalls gets all the calls that were made to Call.
// Check the length with:
// len(mockedRPCClient.CallCalls())
//
// len(mockedRPCClient.CallCalls())
func (mock *RPCClientMock) CallCalls() []struct {
ServiceMethod string
Args interface{}

View File

@@ -13,19 +13,19 @@ var _ RPCDialer = &RPCDialerMock{}
// RPCDialerMock is a mock implementation of RPCDialer.
//
// func TestSomethingThatUsesRPCDialer(t *testing.T) {
// func TestSomethingThatUsesRPCDialer(t *testing.T) {
//
// // make and configure a mocked RPCDialer
// mockedRPCDialer := &RPCDialerMock{
// DialFunc: func(network string, address string) (RPCClient, error) {
// panic("mock out the Dial method")
// },
// }
// // make and configure a mocked RPCDialer
// mockedRPCDialer := &RPCDialerMock{
// DialFunc: func(network string, address string) (RPCClient, error) {
// panic("mock out the Dial method")
// },
// }
//
// // use mockedRPCDialer in code that requires RPCDialer
// // and then make assertions.
// // use mockedRPCDialer in code that requires RPCDialer
// // and then make assertions.
//
// }
// }
type RPCDialerMock struct {
// DialFunc mocks the Dial method.
DialFunc func(network string, address string) (RPCClient, error)
@@ -63,7 +63,8 @@ func (mock *RPCDialerMock) Dial(network string, address string) (RPCClient, erro
// DialCalls gets all the calls that were made to Dial.
// Check the length with:
// len(mockedRPCDialer.DialCalls())
//
// len(mockedRPCDialer.DialCalls())
func (mock *RPCDialerMock) DialCalls() []struct {
Network string
Address string

View File

@@ -7,8 +7,8 @@ import (
"net/http"
"strings"
"github.com/didip/tollbooth/v6"
"github.com/didip/tollbooth/v6/libstring"
"github.com/didip/tollbooth/v7"
"github.com/didip/tollbooth/v7/libstring"
log "github.com/go-pkgz/lgr"
R "github.com/go-pkgz/rest"
"github.com/gorilla/handlers"

View File

@@ -15,28 +15,28 @@ var _ Matcher = &MatcherMock{}
// MatcherMock is a mock implementation of Matcher.
//
// func TestSomethingThatUsesMatcher(t *testing.T) {
// func TestSomethingThatUsesMatcher(t *testing.T) {
//
// // make and configure a mocked Matcher
// mockedMatcher := &MatcherMock{
// CheckHealthFunc: func() map[string]error {
// panic("mock out the CheckHealth method")
// },
// MappersFunc: func() []discovery.URLMapper {
// panic("mock out the Mappers method")
// },
// MatchFunc: func(srv string, src string) discovery.Matches {
// panic("mock out the Match method")
// },
// ServersFunc: func() []string {
// panic("mock out the Servers method")
// },
// }
// // make and configure a mocked Matcher
// mockedMatcher := &MatcherMock{
// CheckHealthFunc: func() map[string]error {
// panic("mock out the CheckHealth method")
// },
// MappersFunc: func() []discovery.URLMapper {
// panic("mock out the Mappers method")
// },
// MatchFunc: func(srv string, src string) discovery.Matches {
// panic("mock out the Match method")
// },
// ServersFunc: func() []string {
// panic("mock out the Servers method")
// },
// }
//
// // use mockedMatcher in code that requires Matcher
// // and then make assertions.
// // use mockedMatcher in code that requires Matcher
// // and then make assertions.
//
// }
// }
type MatcherMock struct {
// CheckHealthFunc mocks the CheckHealth method.
CheckHealthFunc func() map[string]error
@@ -90,7 +90,8 @@ func (mock *MatcherMock) CheckHealth() map[string]error {
// CheckHealthCalls gets all the calls that were made to CheckHealth.
// Check the length with:
// len(mockedMatcher.CheckHealthCalls())
//
// len(mockedMatcher.CheckHealthCalls())
func (mock *MatcherMock) CheckHealthCalls() []struct {
} {
var calls []struct {
@@ -116,7 +117,8 @@ func (mock *MatcherMock) Mappers() []discovery.URLMapper {
// MappersCalls gets all the calls that were made to Mappers.
// Check the length with:
// len(mockedMatcher.MappersCalls())
//
// len(mockedMatcher.MappersCalls())
func (mock *MatcherMock) MappersCalls() []struct {
} {
var calls []struct {
@@ -147,7 +149,8 @@ func (mock *MatcherMock) Match(srv string, src string) discovery.Matches {
// MatchCalls gets all the calls that were made to Match.
// Check the length with:
// len(mockedMatcher.MatchCalls())
//
// len(mockedMatcher.MatchCalls())
func (mock *MatcherMock) MatchCalls() []struct {
Srv string
Src string
@@ -177,7 +180,8 @@ func (mock *MatcherMock) Servers() []string {
// ServersCalls gets all the calls that were made to Servers.
// Check the length with:
// len(mockedMatcher.ServersCalls())
//
// len(mockedMatcher.ServersCalls())
func (mock *MatcherMock) ServersCalls() []struct {
} {
var calls []struct {