Bogz fixes: #295,#294,#291,#289,#288,#283,#275

mine
derailed 2019-08-27 15:25:24 -06:00
parent 90667396b4
commit fe93bd229b
36 changed files with 1371 additions and 650 deletions

View File

@ -0,0 +1,41 @@
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/k9s_small.png" align="right" width="200" height="auto"/>
# Release v0.8.3
## Notes
Thank you to all that contributed with flushing out issues and enhancements for K9s! I'll try to mark some of these issues as fixed. But if you don't mind grab the latest rev and see if we're happier with some of the fixes! If you've filed an issue please help me verify and close. Your support, kindness and awesome suggestions to make K9s better is as ever very much noticed and appreciated!
Also if you dig this tool, please make some noise on social! [@kitesurfer](https://twitter.com/kitesurfer)
---
## Change Logs
### NetworkPolicy
NetworkPolicy resource is now available under the command `np` while in command mode. It behaves like other K9s resource views. You will get a bit more information in K9s vs `kubectl` as it includes information about ingress and egress rules.
### Arrrggg! New CLI Argument
There isa new K9s command option available on the CLI that affords for launching K9s with a given resource. For example using `k9s -c svc` willlaunch K9s with a preloaded service view. You can use the same aliases as you would while in K9s to navigate a resources. For all supports resource aliases please view the `Alias View` using `Ctrl-A`.
### CRDS!
We've beefed up CRD support to allow users to navigate to the CRD instances view more readily. So you can now navigate between CRD schema and CRD instances by just hitting `ENTER` while in the `crd` view.
---
## Resolved Bugs/Features
+ CRD Navigation [Issue #295](https://github.com/derailed/k9s/issues/295)
+ Terminal colors [Issue #294](https://github.com/derailed/k9s/issues/294)
+ Help menu typo [Issue #291](https://github.com/derailed/k9s/issues/291)
+ NetworkPolicy Support [Issue #289](https://github.com/derailed/k9s/issues/289)
+ Scaling replicas start count [Issue #288](https://github.com/derailed/k9s/issues/288)
+ CLI command arg support [Issue #283](https://github.com/derailed/k9s/issues/283)
+ YAML screen dump support [Issue #275](https://github.com/derailed/k9s/issues/275)
---
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/imhotep_logo.png" width="32" height="auto"/> © 2019 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)

View File

@ -96,6 +96,10 @@ func loadConfiguration() *config.Config {
k9sCfg.K9s.OverrideHeadless(*k9sFlags.Headless)
}
if k9sFlags.Command != nil {
k9sCfg.K9s.OverrideCommand(*k9sFlags.Command)
}
if err := k9sCfg.Refine(k8sFlags); err != nil {
log.Panic().Err(err).Msg("Unable to locate kubeconfig file")
}
@ -132,7 +136,7 @@ func initK9sFlags() {
k9sFlags.RefreshRate,
"refresh", "r",
config.DefaultRefreshRate,
"Specifies the default refresh rate as an integer (sec)",
"Specify the default refresh rate as an integer (sec)",
)
rootCmd.Flags().StringVarP(
k9sFlags.LogLevel,
@ -146,6 +150,12 @@ func initK9sFlags() {
false,
"Turn K9s header off",
)
rootCmd.Flags().StringVarP(
k9sFlags.Command,
"command", "c",
config.DefaultCommand,
"Specify the default command to view when the application launches",
)
}
func initK8sFlags() {

7
go.mod
View File

@ -26,6 +26,8 @@ replace (
)
require (
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 // indirect
github.com/atotto/clipboard v0.1.2
github.com/derailed/tview v0.2.1
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect
@ -34,7 +36,7 @@ require (
github.com/evanphx/json-patch v4.1.0+incompatible // indirect
github.com/fatih/camelcase v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.4.7
github.com/gdamore/tcell v1.2.0
github.com/gdamore/tcell v1.1.2
github.com/ghodss/yaml v1.0.0 // indirect
github.com/gogo/protobuf v1.2.1 // indirect
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
@ -52,7 +54,7 @@ require (
github.com/mattn/go-runewidth v0.0.4
github.com/onsi/ginkgo v1.8.0 // indirect
github.com/onsi/gomega v1.5.0 // indirect
github.com/petergtz/pegomock v0.0.0-20181206220228-b113d17a7e81
github.com/petergtz/pegomock v2.5.0+incompatible
github.com/rakyll/hey v0.1.2
github.com/rs/zerolog v1.14.3
github.com/sahilm/fuzzy v0.1.0
@ -63,6 +65,7 @@ require (
golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6 // indirect
golang.org/x/text v0.3.2
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.2.2

15
go.sum
View File

@ -20,6 +20,10 @@ github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/Rican7/retry v0.1.0/go.mod h1:FgOROf8P5bebcC1DS0PdOQiqGUridaZvikzUmkFW6gg=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 h1:Hs82Z41s6SdL1CELW+XaDYmOH4hkBN4/N9og/AsOv7E=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/atotto/clipboard v0.1.2 h1:YZCtFu5Ie8qX2VmVTBnrqLSiU9XOWwqNRmdT3gIQzbY=
@ -91,9 +95,8 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
github.com/gdamore/tcell v1.1.2 h1:Afe8cU6SECC06UmvaJ55Jr3Eh0tz/ywLjqWYqjGZp3s=
github.com/gdamore/tcell v1.1.2/go.mod h1:h3kq4HO9l2On+V9ed8w8ewqQEmGCSSHOgQ+2h8uzurE=
github.com/gdamore/tcell v1.2.0 h1:ikixzsxc8K8o3V2/CEmyoEW8mJZaNYQQ3NP3VIQdUe4=
github.com/gdamore/tcell v1.2.0/go.mod h1:Hjvr+Ofd+gLglo7RYKxxnzCBmev3BzsS67MebKS4zMM=
github.com/ghodss/yaml v0.0.0-20180820084758-c7ce16629ff4/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
@ -254,6 +257,8 @@ github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+v
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
github.com/petergtz/pegomock v0.0.0-20181206220228-b113d17a7e81 h1:MhSbvsIs4KvpPYr4taOvb6j+r9VNbj/08AfjsKi+Ui0=
github.com/petergtz/pegomock v0.0.0-20181206220228-b113d17a7e81/go.mod h1:nuBLWZpVyv/fLo56qTwt/AUau7jgouO1h7bEvZCq82o=
github.com/petergtz/pegomock v2.5.0+incompatible h1:NgwX1/qc+tsl7I45OkDxYZ1mIonYWbOESnpZcd20sR0=
github.com/petergtz/pegomock v2.5.0+incompatible/go.mod h1:nuBLWZpVyv/fLo56qTwt/AUau7jgouO1h7bEvZCq82o=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@ -355,9 +360,8 @@ golang.org/x/sys v0.0.0-20181004145325-8469e314837c/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756 h1:9nuHUbU8dRnRRfj9KjWUVrJeoexdbeMjttk6Oh1rD10=
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
@ -371,6 +375,7 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc h1:N3zlSgxkefUH/ecsl37RWTkESTB026kmXzNly8TuZCI=
golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485/go.mod h1:2ltnJ7xHfj0zHS40VVPYEAAMTa3ZGguvHGBSJeRWqE0=
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
@ -382,6 +387,8 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7
google.golang.org/genproto v0.0.0-20170731182057-09f6ed296fc6/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/grpc v1.13.0 h1:bHIbVsCwmvbArgCJmLdgOdHFXlKqTOVjbibbS19cXHc=
google.golang.org/grpc v1.13.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
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=

View File

@ -138,7 +138,13 @@ func (c *Config) ActiveView() string {
if c.K9s.ActiveCluster() == nil {
return defaultView
}
return c.K9s.ActiveCluster().View.Active
cmd := c.K9s.ActiveCluster().View.Active
if c.K9s.manualCommand != nil && *c.K9s.manualCommand != "" {
cmd = *c.K9s.manualCommand
}
return cmd
}
// SetActiveView set the currently cluster active view

View File

@ -3,8 +3,12 @@ package config
const (
// DefaultRefreshRate represents the refresh interval.
DefaultRefreshRate = 2 // secs
// DefaultLogLevel represents the default log level.
DefaultLogLevel = "info"
// DefaultCommand represents the default command to run.
DefaultCommand = "po"
)
// Flags represents K9s configuration flags.
@ -12,6 +16,7 @@ type Flags struct {
RefreshRate *int
LogLevel *string
Headless *bool
Command *string
}
// NewFlags returns new configuration flags.
@ -20,6 +25,7 @@ func NewFlags() *Flags {
RefreshRate: intPtr(DefaultRefreshRate),
LogLevel: strPtr(DefaultLogLevel),
Headless: boolPtr(false),
Command: strPtr(DefaultCommand),
}
}

View File

@ -22,6 +22,7 @@ type K9s struct {
Plugins map[string]*Plugin `yaml:"plugins,omitempty"`
manualRefreshRate int
manualHeadless *bool
manualCommand *string
}
// NewK9s create a new K9s configuration.
@ -45,6 +46,11 @@ func (k *K9s) OverrideHeadless(b bool) {
k.manualHeadless = &b
}
// OverrideCommand set the command manually.
func (k *K9s) OverrideCommand(cmd string) {
k.manualCommand = &cmd
}
// GetHeadless returns headless setting.
func (k *K9s) GetHeadless() bool {
h := k.Headless

View File

@ -20,8 +20,34 @@ type MockConnection struct {
fail func(message string, callerSkip ...int)
}
func NewMockConnection() *MockConnection {
return &MockConnection{fail: pegomock.GlobalFailHandler}
func NewMockConnection(options ...pegomock.Option) *MockConnection {
mock := &MockConnection{}
for _, option := range options {
option.Apply(mock)
}
return mock
}
func (mock *MockConnection) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockConnection) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockConnection) CanIAccess(_param0 string, _param1 string, _param2 []string) (bool, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockConnection().")
}
params := []pegomock.Param{_param0, _param1, _param2}
result := pegomock.GetGenericMockFrom(mock).Invoke("CanIAccess", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 bool
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(bool)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockConnection) CheckListNSAccess() error {
@ -319,77 +345,112 @@ func (mock *MockConnection) ValidNamespaces() ([]v1.Namespace, error) {
return ret0, ret1
}
func (mock *MockConnection) VerifyWasCalledOnce() *VerifierConnection {
return &VerifierConnection{
func (mock *MockConnection) VerifyWasCalledOnce() *VerifierMockConnection {
return &VerifierMockConnection{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockConnection) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierConnection {
return &VerifierConnection{
func (mock *MockConnection) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockConnection {
return &VerifierMockConnection{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockConnection) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierConnection {
return &VerifierConnection{
func (mock *MockConnection) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockConnection {
return &VerifierMockConnection{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockConnection) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierConnection {
return &VerifierConnection{
func (mock *MockConnection) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockConnection {
return &VerifierMockConnection{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierConnection struct {
type VerifierMockConnection struct {
mock *MockConnection
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierConnection) CheckListNSAccess() *Connection_CheckListNSAccess_OngoingVerification {
func (verifier *VerifierMockConnection) CanIAccess(_param0 string, _param1 string, _param2 []string) *MockConnection_CanIAccess_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CanIAccess", params, verifier.timeout)
return &MockConnection_CanIAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockConnection_CanIAccess_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *MockConnection_CanIAccess_OngoingVerification) GetCapturedArguments() (string, string, []string) {
_param0, _param1, _param2 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1]
}
func (c *MockConnection_CanIAccess_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 [][]string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
for u, param := range params[0] {
_param0[u] = param.(string)
}
_param1 = make([]string, len(params[1]))
for u, param := range params[1] {
_param1[u] = param.(string)
}
_param2 = make([][]string, len(params[2]))
for u, param := range params[2] {
_param2[u] = param.([]string)
}
}
return
}
func (verifier *VerifierMockConnection) CheckListNSAccess() *MockConnection_CheckListNSAccess_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CheckListNSAccess", params, verifier.timeout)
return &Connection_CheckListNSAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_CheckListNSAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_CheckListNSAccess_OngoingVerification struct {
type MockConnection_CheckListNSAccess_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_CheckListNSAccess_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_CheckListNSAccess_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_CheckListNSAccess_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_CheckListNSAccess_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) CheckNSAccess(_param0 string) *Connection_CheckNSAccess_OngoingVerification {
func (verifier *VerifierMockConnection) CheckNSAccess(_param0 string) *MockConnection_CheckNSAccess_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CheckNSAccess", params, verifier.timeout)
return &Connection_CheckNSAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_CheckNSAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_CheckNSAccess_OngoingVerification struct {
type MockConnection_CheckNSAccess_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_CheckNSAccess_OngoingVerification) GetCapturedArguments() string {
func (c *MockConnection_CheckNSAccess_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Connection_CheckNSAccess_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockConnection_CheckNSAccess_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -400,125 +461,125 @@ func (c *Connection_CheckNSAccess_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierConnection) Config() *Connection_Config_OngoingVerification {
func (verifier *VerifierMockConnection) Config() *MockConnection_Config_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Config", params, verifier.timeout)
return &Connection_Config_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_Config_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_Config_OngoingVerification struct {
type MockConnection_Config_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_Config_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_Config_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_Config_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_Config_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) CurrentNamespaceName() *Connection_CurrentNamespaceName_OngoingVerification {
func (verifier *VerifierMockConnection) CurrentNamespaceName() *MockConnection_CurrentNamespaceName_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CurrentNamespaceName", params, verifier.timeout)
return &Connection_CurrentNamespaceName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_CurrentNamespaceName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_CurrentNamespaceName_OngoingVerification struct {
type MockConnection_CurrentNamespaceName_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_CurrentNamespaceName_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_CurrentNamespaceName_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_CurrentNamespaceName_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_CurrentNamespaceName_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) DialOrDie() *Connection_DialOrDie_OngoingVerification {
func (verifier *VerifierMockConnection) DialOrDie() *MockConnection_DialOrDie_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DialOrDie", params, verifier.timeout)
return &Connection_DialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_DialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_DialOrDie_OngoingVerification struct {
type MockConnection_DialOrDie_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_DialOrDie_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_DialOrDie_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_DialOrDie_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_DialOrDie_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) DynDialOrDie() *Connection_DynDialOrDie_OngoingVerification {
func (verifier *VerifierMockConnection) DynDialOrDie() *MockConnection_DynDialOrDie_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DynDialOrDie", params, verifier.timeout)
return &Connection_DynDialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_DynDialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_DynDialOrDie_OngoingVerification struct {
type MockConnection_DynDialOrDie_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_DynDialOrDie_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_DynDialOrDie_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_DynDialOrDie_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_DynDialOrDie_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) FetchNodes() *Connection_FetchNodes_OngoingVerification {
func (verifier *VerifierMockConnection) FetchNodes() *MockConnection_FetchNodes_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "FetchNodes", params, verifier.timeout)
return &Connection_FetchNodes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_FetchNodes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_FetchNodes_OngoingVerification struct {
type MockConnection_FetchNodes_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_FetchNodes_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_FetchNodes_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_FetchNodes_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_FetchNodes_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) HasMetrics() *Connection_HasMetrics_OngoingVerification {
func (verifier *VerifierMockConnection) HasMetrics() *MockConnection_HasMetrics_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "HasMetrics", params, verifier.timeout)
return &Connection_HasMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_HasMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_HasMetrics_OngoingVerification struct {
type MockConnection_HasMetrics_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_HasMetrics_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_HasMetrics_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_HasMetrics_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_HasMetrics_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) IsNamespaced(_param0 string) *Connection_IsNamespaced_OngoingVerification {
func (verifier *VerifierMockConnection) IsNamespaced(_param0 string) *MockConnection_IsNamespaced_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "IsNamespaced", params, verifier.timeout)
return &Connection_IsNamespaced_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_IsNamespaced_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_IsNamespaced_OngoingVerification struct {
type MockConnection_IsNamespaced_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_IsNamespaced_OngoingVerification) GetCapturedArguments() string {
func (c *MockConnection_IsNamespaced_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Connection_IsNamespaced_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockConnection_IsNamespaced_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -529,57 +590,57 @@ func (c *Connection_IsNamespaced_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierConnection) MXDial() *Connection_MXDial_OngoingVerification {
func (verifier *VerifierMockConnection) MXDial() *MockConnection_MXDial_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "MXDial", params, verifier.timeout)
return &Connection_MXDial_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_MXDial_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_MXDial_OngoingVerification struct {
type MockConnection_MXDial_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_MXDial_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_MXDial_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_MXDial_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_MXDial_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) NSDialOrDie() *Connection_NSDialOrDie_OngoingVerification {
func (verifier *VerifierMockConnection) NSDialOrDie() *MockConnection_NSDialOrDie_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "NSDialOrDie", params, verifier.timeout)
return &Connection_NSDialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_NSDialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_NSDialOrDie_OngoingVerification struct {
type MockConnection_NSDialOrDie_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_NSDialOrDie_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_NSDialOrDie_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_NSDialOrDie_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_NSDialOrDie_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) NodePods(_param0 string) *Connection_NodePods_OngoingVerification {
func (verifier *VerifierMockConnection) NodePods(_param0 string) *MockConnection_NodePods_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "NodePods", params, verifier.timeout)
return &Connection_NodePods_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_NodePods_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_NodePods_OngoingVerification struct {
type MockConnection_NodePods_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_NodePods_OngoingVerification) GetCapturedArguments() string {
func (c *MockConnection_NodePods_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Connection_NodePods_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockConnection_NodePods_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -590,57 +651,57 @@ func (c *Connection_NodePods_OngoingVerification) GetAllCapturedArguments() (_pa
return
}
func (verifier *VerifierConnection) RestConfigOrDie() *Connection_RestConfigOrDie_OngoingVerification {
func (verifier *VerifierMockConnection) RestConfigOrDie() *MockConnection_RestConfigOrDie_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "RestConfigOrDie", params, verifier.timeout)
return &Connection_RestConfigOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_RestConfigOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_RestConfigOrDie_OngoingVerification struct {
type MockConnection_RestConfigOrDie_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_RestConfigOrDie_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_RestConfigOrDie_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_RestConfigOrDie_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_RestConfigOrDie_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) ServerVersion() *Connection_ServerVersion_OngoingVerification {
func (verifier *VerifierMockConnection) ServerVersion() *MockConnection_ServerVersion_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ServerVersion", params, verifier.timeout)
return &Connection_ServerVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_ServerVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_ServerVersion_OngoingVerification struct {
type MockConnection_ServerVersion_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_ServerVersion_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_ServerVersion_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_ServerVersion_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_ServerVersion_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) SupportsRes(_param0 string, _param1 []string) *Connection_SupportsRes_OngoingVerification {
func (verifier *VerifierMockConnection) SupportsRes(_param0 string, _param1 []string) *MockConnection_SupportsRes_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SupportsRes", params, verifier.timeout)
return &Connection_SupportsRes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_SupportsRes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_SupportsRes_OngoingVerification struct {
type MockConnection_SupportsRes_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_SupportsRes_OngoingVerification) GetCapturedArguments() (string, []string) {
func (c *MockConnection_SupportsRes_OngoingVerification) GetCapturedArguments() (string, []string) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *Connection_SupportsRes_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]string) {
func (c *MockConnection_SupportsRes_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -655,23 +716,23 @@ func (c *Connection_SupportsRes_OngoingVerification) GetAllCapturedArguments() (
return
}
func (verifier *VerifierConnection) SupportsResource(_param0 string) *Connection_SupportsResource_OngoingVerification {
func (verifier *VerifierMockConnection) SupportsResource(_param0 string) *MockConnection_SupportsResource_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SupportsResource", params, verifier.timeout)
return &Connection_SupportsResource_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_SupportsResource_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_SupportsResource_OngoingVerification struct {
type MockConnection_SupportsResource_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_SupportsResource_OngoingVerification) GetCapturedArguments() string {
func (c *MockConnection_SupportsResource_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Connection_SupportsResource_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockConnection_SupportsResource_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -682,23 +743,23 @@ func (c *Connection_SupportsResource_OngoingVerification) GetAllCapturedArgument
return
}
func (verifier *VerifierConnection) SwitchContextOrDie(_param0 string) *Connection_SwitchContextOrDie_OngoingVerification {
func (verifier *VerifierMockConnection) SwitchContextOrDie(_param0 string) *MockConnection_SwitchContextOrDie_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SwitchContextOrDie", params, verifier.timeout)
return &Connection_SwitchContextOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_SwitchContextOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_SwitchContextOrDie_OngoingVerification struct {
type MockConnection_SwitchContextOrDie_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_SwitchContextOrDie_OngoingVerification) GetCapturedArguments() string {
func (c *MockConnection_SwitchContextOrDie_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Connection_SwitchContextOrDie_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockConnection_SwitchContextOrDie_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -709,19 +770,19 @@ func (c *Connection_SwitchContextOrDie_OngoingVerification) GetAllCapturedArgume
return
}
func (verifier *VerifierConnection) ValidNamespaces() *Connection_ValidNamespaces_OngoingVerification {
func (verifier *VerifierMockConnection) ValidNamespaces() *MockConnection_ValidNamespaces_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ValidNamespaces", params, verifier.timeout)
return &Connection_ValidNamespaces_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_ValidNamespaces_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_ValidNamespaces_OngoingVerification struct {
type MockConnection_ValidNamespaces_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_ValidNamespaces_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_ValidNamespaces_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_ValidNamespaces_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_ValidNamespaces_OngoingVerification) GetAllCapturedArguments() {
}

View File

@ -14,10 +14,17 @@ type MockKubeSettings struct {
fail func(message string, callerSkip ...int)
}
func NewMockKubeSettings() *MockKubeSettings {
return &MockKubeSettings{fail: pegomock.GlobalFailHandler}
func NewMockKubeSettings(options ...pegomock.Option) *MockKubeSettings {
mock := &MockKubeSettings{}
for _, option := range options {
option.Apply(mock)
}
return mock
}
func (mock *MockKubeSettings) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockKubeSettings) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockKubeSettings) ClusterNames() ([]string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockKubeSettings().")
@ -109,128 +116,128 @@ func (mock *MockKubeSettings) NamespaceNames(_param0 []v1.Namespace) []string {
return ret0
}
func (mock *MockKubeSettings) VerifyWasCalledOnce() *VerifierKubeSettings {
return &VerifierKubeSettings{
func (mock *MockKubeSettings) VerifyWasCalledOnce() *VerifierMockKubeSettings {
return &VerifierMockKubeSettings{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockKubeSettings) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierKubeSettings {
return &VerifierKubeSettings{
func (mock *MockKubeSettings) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockKubeSettings {
return &VerifierMockKubeSettings{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockKubeSettings) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierKubeSettings {
return &VerifierKubeSettings{
func (mock *MockKubeSettings) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockKubeSettings {
return &VerifierMockKubeSettings{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockKubeSettings) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierKubeSettings {
return &VerifierKubeSettings{
func (mock *MockKubeSettings) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockKubeSettings {
return &VerifierMockKubeSettings{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierKubeSettings struct {
type VerifierMockKubeSettings struct {
mock *MockKubeSettings
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierKubeSettings) ClusterNames() *KubeSettings_ClusterNames_OngoingVerification {
func (verifier *VerifierMockKubeSettings) ClusterNames() *MockKubeSettings_ClusterNames_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ClusterNames", params, verifier.timeout)
return &KubeSettings_ClusterNames_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockKubeSettings_ClusterNames_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type KubeSettings_ClusterNames_OngoingVerification struct {
type MockKubeSettings_ClusterNames_OngoingVerification struct {
mock *MockKubeSettings
methodInvocations []pegomock.MethodInvocation
}
func (c *KubeSettings_ClusterNames_OngoingVerification) GetCapturedArguments() {
func (c *MockKubeSettings_ClusterNames_OngoingVerification) GetCapturedArguments() {
}
func (c *KubeSettings_ClusterNames_OngoingVerification) GetAllCapturedArguments() {
func (c *MockKubeSettings_ClusterNames_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierKubeSettings) CurrentClusterName() *KubeSettings_CurrentClusterName_OngoingVerification {
func (verifier *VerifierMockKubeSettings) CurrentClusterName() *MockKubeSettings_CurrentClusterName_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CurrentClusterName", params, verifier.timeout)
return &KubeSettings_CurrentClusterName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockKubeSettings_CurrentClusterName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type KubeSettings_CurrentClusterName_OngoingVerification struct {
type MockKubeSettings_CurrentClusterName_OngoingVerification struct {
mock *MockKubeSettings
methodInvocations []pegomock.MethodInvocation
}
func (c *KubeSettings_CurrentClusterName_OngoingVerification) GetCapturedArguments() {
func (c *MockKubeSettings_CurrentClusterName_OngoingVerification) GetCapturedArguments() {
}
func (c *KubeSettings_CurrentClusterName_OngoingVerification) GetAllCapturedArguments() {
func (c *MockKubeSettings_CurrentClusterName_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierKubeSettings) CurrentContextName() *KubeSettings_CurrentContextName_OngoingVerification {
func (verifier *VerifierMockKubeSettings) CurrentContextName() *MockKubeSettings_CurrentContextName_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CurrentContextName", params, verifier.timeout)
return &KubeSettings_CurrentContextName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockKubeSettings_CurrentContextName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type KubeSettings_CurrentContextName_OngoingVerification struct {
type MockKubeSettings_CurrentContextName_OngoingVerification struct {
mock *MockKubeSettings
methodInvocations []pegomock.MethodInvocation
}
func (c *KubeSettings_CurrentContextName_OngoingVerification) GetCapturedArguments() {
func (c *MockKubeSettings_CurrentContextName_OngoingVerification) GetCapturedArguments() {
}
func (c *KubeSettings_CurrentContextName_OngoingVerification) GetAllCapturedArguments() {
func (c *MockKubeSettings_CurrentContextName_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierKubeSettings) CurrentNamespaceName() *KubeSettings_CurrentNamespaceName_OngoingVerification {
func (verifier *VerifierMockKubeSettings) CurrentNamespaceName() *MockKubeSettings_CurrentNamespaceName_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CurrentNamespaceName", params, verifier.timeout)
return &KubeSettings_CurrentNamespaceName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockKubeSettings_CurrentNamespaceName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type KubeSettings_CurrentNamespaceName_OngoingVerification struct {
type MockKubeSettings_CurrentNamespaceName_OngoingVerification struct {
mock *MockKubeSettings
methodInvocations []pegomock.MethodInvocation
}
func (c *KubeSettings_CurrentNamespaceName_OngoingVerification) GetCapturedArguments() {
func (c *MockKubeSettings_CurrentNamespaceName_OngoingVerification) GetCapturedArguments() {
}
func (c *KubeSettings_CurrentNamespaceName_OngoingVerification) GetAllCapturedArguments() {
func (c *MockKubeSettings_CurrentNamespaceName_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierKubeSettings) NamespaceNames(_param0 []v1.Namespace) *KubeSettings_NamespaceNames_OngoingVerification {
func (verifier *VerifierMockKubeSettings) NamespaceNames(_param0 []v1.Namespace) *MockKubeSettings_NamespaceNames_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "NamespaceNames", params, verifier.timeout)
return &KubeSettings_NamespaceNames_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockKubeSettings_NamespaceNames_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type KubeSettings_NamespaceNames_OngoingVerification struct {
type MockKubeSettings_NamespaceNames_OngoingVerification struct {
mock *MockKubeSettings
methodInvocations []pegomock.MethodInvocation
}
func (c *KubeSettings_NamespaceNames_OngoingVerification) GetCapturedArguments() []v1.Namespace {
func (c *MockKubeSettings_NamespaceNames_OngoingVerification) GetCapturedArguments() []v1.Namespace {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *KubeSettings_NamespaceNames_OngoingVerification) GetAllCapturedArguments() (_param0 [][]v1.Namespace) {
func (c *MockKubeSettings_NamespaceNames_OngoingVerification) GetAllCapturedArguments() (_param0 [][]v1.Namespace) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([][]v1.Namespace, len(params[0]))

View File

@ -72,6 +72,7 @@ type (
CurrentNamespaceName() (string, error)
CheckNSAccess(ns string) error
CheckListNSAccess() error
CanIAccess(ns, resURL string, verbs []string) (bool, error)
}
k8sClient struct {
@ -120,25 +121,27 @@ func (a *APIClient) CheckNSAccess(n string) error {
return err
}
func makeSAR(ns, name, resURL string) *authorizationv1.SelfSubjectAccessReview {
_, gr := schema.ParseResourceArg(strings.ToLower(resURL))
func makeSAR(ns, resURL string) *authorizationv1.SelfSubjectAccessReview {
gvr, _ := schema.ParseResourceArg(strings.ToLower(resURL))
if gvr == nil {
panic(fmt.Errorf("Unable to get GVR from url %s", resURL))
}
log.Debug().Msgf("GVR for %s -- %#v", resURL, *gvr)
return &authorizationv1.SelfSubjectAccessReview{
Spec: authorizationv1.SelfSubjectAccessReviewSpec{
ResourceAttributes: &authorizationv1.ResourceAttributes{
Namespace: ns,
Group: gr.Group,
Resource: gr.Resource,
Subresource: "",
Name: name,
Namespace: ns,
Group: gvr.Group,
Resource: gvr.Resource,
},
},
}
}
// CanIAccess checks if user has access to a certain resource.
func canIAccess(conn Connection, ns, name, resURL string, verbs []string) (bool, error) {
sar := makeSAR(ns, name, resURL)
dial := conn.DialOrDie().AuthorizationV1().SelfSubjectAccessReviews()
func (a *APIClient) CanIAccess(ns, resURL string, verbs []string) (bool, error) {
sar := makeSAR(ns, resURL)
dial := a.DialOrDie().AuthorizationV1().SelfSubjectAccessReviews()
for _, v := range verbs {
sar.Spec.ResourceAttributes.Verb = v
resp, err := dial.Create(sar)

View File

@ -243,6 +243,11 @@ var resMap = map[string]*meta.RESTMapping{
GroupVersionKind: schema.GroupVersionKind{Group: "apiextensions.k8s.io", Version: "v1beta1", Kind: "CustomResourceDefinition"},
Scope: RestMapping,
},
"NetworkPolicies": {
Resource: schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "networkpolicies"},
GroupVersionKind: schema.GroupVersionKind{Group: "extensions", Version: "v1beta1", Kind: "NetworkPolicy"},
Scope: RestMapping,
},
"Events": {
Resource: schema.GroupVersionResource{Group: "events.k8s.io", Version: "v1beta1", Resource: "events"},

50
internal/k8s/np.go Normal file
View File

@ -0,0 +1,50 @@
package k8s
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// NetworkPolicy represents a Kubernetes NetworkPolicy
type NetworkPolicy struct {
*base
Connection
}
// NewNetworkPolicy returns a new NetworkPolicy.
func NewNetworkPolicy(c Connection) *NetworkPolicy {
return &NetworkPolicy{&base{}, c}
}
// Get a NetworkPolicy.
func (d *NetworkPolicy) Get(ns, n string) (interface{}, error) {
return d.DialOrDie().ExtensionsV1beta1().NetworkPolicies(ns).Get(n, metav1.GetOptions{})
}
// List all NetworkPolicys in a given namespace.
func (d *NetworkPolicy) List(ns string) (Collection, error) {
opts := metav1.ListOptions{
LabelSelector: d.labelSelector,
FieldSelector: d.fieldSelector,
}
rr, err := d.DialOrDie().ExtensionsV1beta1().NetworkPolicies(ns).List(opts)
if err != nil {
return nil, err
}
cc := make(Collection, len(rr.Items))
for i, r := range rr.Items {
cc[i] = r
}
return cc, nil
}
// Delete a NetworkPolicy.
func (d *NetworkPolicy) Delete(ns, n string, cascade, force bool) error {
p := metav1.DeletePropagationOrphan
if cascade {
p = metav1.DeletePropagationBackground
}
return d.DialOrDie().ExtensionsV1beta1().NetworkPolicies(ns).Delete(n, &metav1.DeleteOptions{
PropagationPolicy: &p,
})
}

View File

@ -30,7 +30,7 @@ func NewCustomList(c k8s.Connection, ns, group, version, name string) List {
return NewList(
ns,
name,
NewCustom(c, group, version, name), AllVerbsAccess,
NewCustom(c, group, version, name), AllVerbsAccess|DescribeAccess,
)
}

View File

@ -20,8 +20,34 @@ type MockClusterMeta struct {
fail func(message string, callerSkip ...int)
}
func NewMockClusterMeta() *MockClusterMeta {
return &MockClusterMeta{fail: pegomock.GlobalFailHandler}
func NewMockClusterMeta(options ...pegomock.Option) *MockClusterMeta {
mock := &MockClusterMeta{}
for _, option := range options {
option.Apply(mock)
}
return mock
}
func (mock *MockClusterMeta) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockClusterMeta) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockClusterMeta) CanIAccess(_param0 string, _param1 string, _param2 []string) (bool, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockClusterMeta().")
}
params := []pegomock.Param{_param0, _param1, _param2}
result := pegomock.GetGenericMockFrom(mock).Invoke("CanIAccess", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 bool
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(bool)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockClusterMeta) CheckListNSAccess() error {
@ -402,77 +428,112 @@ func (mock *MockClusterMeta) Version() (string, error) {
return ret0, ret1
}
func (mock *MockClusterMeta) VerifyWasCalledOnce() *VerifierClusterMeta {
return &VerifierClusterMeta{
func (mock *MockClusterMeta) VerifyWasCalledOnce() *VerifierMockClusterMeta {
return &VerifierMockClusterMeta{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockClusterMeta) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierClusterMeta {
return &VerifierClusterMeta{
func (mock *MockClusterMeta) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockClusterMeta {
return &VerifierMockClusterMeta{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockClusterMeta) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierClusterMeta {
return &VerifierClusterMeta{
func (mock *MockClusterMeta) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockClusterMeta {
return &VerifierMockClusterMeta{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockClusterMeta) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierClusterMeta {
return &VerifierClusterMeta{
func (mock *MockClusterMeta) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockClusterMeta {
return &VerifierMockClusterMeta{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierClusterMeta struct {
type VerifierMockClusterMeta struct {
mock *MockClusterMeta
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierClusterMeta) CheckListNSAccess() *ClusterMeta_CheckListNSAccess_OngoingVerification {
func (verifier *VerifierMockClusterMeta) CanIAccess(_param0 string, _param1 string, _param2 []string) *MockClusterMeta_CanIAccess_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CanIAccess", params, verifier.timeout)
return &MockClusterMeta_CanIAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockClusterMeta_CanIAccess_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *MockClusterMeta_CanIAccess_OngoingVerification) GetCapturedArguments() (string, string, []string) {
_param0, _param1, _param2 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1]
}
func (c *MockClusterMeta_CanIAccess_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 [][]string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
for u, param := range params[0] {
_param0[u] = param.(string)
}
_param1 = make([]string, len(params[1]))
for u, param := range params[1] {
_param1[u] = param.(string)
}
_param2 = make([][]string, len(params[2]))
for u, param := range params[2] {
_param2[u] = param.([]string)
}
}
return
}
func (verifier *VerifierMockClusterMeta) CheckListNSAccess() *MockClusterMeta_CheckListNSAccess_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CheckListNSAccess", params, verifier.timeout)
return &ClusterMeta_CheckListNSAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_CheckListNSAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_CheckListNSAccess_OngoingVerification struct {
type MockClusterMeta_CheckListNSAccess_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_CheckListNSAccess_OngoingVerification) GetCapturedArguments() {
func (c *MockClusterMeta_CheckListNSAccess_OngoingVerification) GetCapturedArguments() {
}
func (c *ClusterMeta_CheckListNSAccess_OngoingVerification) GetAllCapturedArguments() {
func (c *MockClusterMeta_CheckListNSAccess_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierClusterMeta) CheckNSAccess(_param0 string) *ClusterMeta_CheckNSAccess_OngoingVerification {
func (verifier *VerifierMockClusterMeta) CheckNSAccess(_param0 string) *MockClusterMeta_CheckNSAccess_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CheckNSAccess", params, verifier.timeout)
return &ClusterMeta_CheckNSAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_CheckNSAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_CheckNSAccess_OngoingVerification struct {
type MockClusterMeta_CheckNSAccess_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_CheckNSAccess_OngoingVerification) GetCapturedArguments() string {
func (c *MockClusterMeta_CheckNSAccess_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *ClusterMeta_CheckNSAccess_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockClusterMeta_CheckNSAccess_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -483,176 +544,176 @@ func (c *ClusterMeta_CheckNSAccess_OngoingVerification) GetAllCapturedArguments(
return
}
func (verifier *VerifierClusterMeta) ClusterName() *ClusterMeta_ClusterName_OngoingVerification {
func (verifier *VerifierMockClusterMeta) ClusterName() *MockClusterMeta_ClusterName_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ClusterName", params, verifier.timeout)
return &ClusterMeta_ClusterName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_ClusterName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_ClusterName_OngoingVerification struct {
type MockClusterMeta_ClusterName_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_ClusterName_OngoingVerification) GetCapturedArguments() {
func (c *MockClusterMeta_ClusterName_OngoingVerification) GetCapturedArguments() {
}
func (c *ClusterMeta_ClusterName_OngoingVerification) GetAllCapturedArguments() {
func (c *MockClusterMeta_ClusterName_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierClusterMeta) Config() *ClusterMeta_Config_OngoingVerification {
func (verifier *VerifierMockClusterMeta) Config() *MockClusterMeta_Config_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Config", params, verifier.timeout)
return &ClusterMeta_Config_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_Config_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_Config_OngoingVerification struct {
type MockClusterMeta_Config_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_Config_OngoingVerification) GetCapturedArguments() {
func (c *MockClusterMeta_Config_OngoingVerification) GetCapturedArguments() {
}
func (c *ClusterMeta_Config_OngoingVerification) GetAllCapturedArguments() {
func (c *MockClusterMeta_Config_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierClusterMeta) ContextName() *ClusterMeta_ContextName_OngoingVerification {
func (verifier *VerifierMockClusterMeta) ContextName() *MockClusterMeta_ContextName_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ContextName", params, verifier.timeout)
return &ClusterMeta_ContextName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_ContextName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_ContextName_OngoingVerification struct {
type MockClusterMeta_ContextName_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_ContextName_OngoingVerification) GetCapturedArguments() {
func (c *MockClusterMeta_ContextName_OngoingVerification) GetCapturedArguments() {
}
func (c *ClusterMeta_ContextName_OngoingVerification) GetAllCapturedArguments() {
func (c *MockClusterMeta_ContextName_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierClusterMeta) CurrentNamespaceName() *ClusterMeta_CurrentNamespaceName_OngoingVerification {
func (verifier *VerifierMockClusterMeta) CurrentNamespaceName() *MockClusterMeta_CurrentNamespaceName_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CurrentNamespaceName", params, verifier.timeout)
return &ClusterMeta_CurrentNamespaceName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_CurrentNamespaceName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_CurrentNamespaceName_OngoingVerification struct {
type MockClusterMeta_CurrentNamespaceName_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_CurrentNamespaceName_OngoingVerification) GetCapturedArguments() {
func (c *MockClusterMeta_CurrentNamespaceName_OngoingVerification) GetCapturedArguments() {
}
func (c *ClusterMeta_CurrentNamespaceName_OngoingVerification) GetAllCapturedArguments() {
func (c *MockClusterMeta_CurrentNamespaceName_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierClusterMeta) DialOrDie() *ClusterMeta_DialOrDie_OngoingVerification {
func (verifier *VerifierMockClusterMeta) DialOrDie() *MockClusterMeta_DialOrDie_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DialOrDie", params, verifier.timeout)
return &ClusterMeta_DialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_DialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_DialOrDie_OngoingVerification struct {
type MockClusterMeta_DialOrDie_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_DialOrDie_OngoingVerification) GetCapturedArguments() {
func (c *MockClusterMeta_DialOrDie_OngoingVerification) GetCapturedArguments() {
}
func (c *ClusterMeta_DialOrDie_OngoingVerification) GetAllCapturedArguments() {
func (c *MockClusterMeta_DialOrDie_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierClusterMeta) DynDialOrDie() *ClusterMeta_DynDialOrDie_OngoingVerification {
func (verifier *VerifierMockClusterMeta) DynDialOrDie() *MockClusterMeta_DynDialOrDie_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DynDialOrDie", params, verifier.timeout)
return &ClusterMeta_DynDialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_DynDialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_DynDialOrDie_OngoingVerification struct {
type MockClusterMeta_DynDialOrDie_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_DynDialOrDie_OngoingVerification) GetCapturedArguments() {
func (c *MockClusterMeta_DynDialOrDie_OngoingVerification) GetCapturedArguments() {
}
func (c *ClusterMeta_DynDialOrDie_OngoingVerification) GetAllCapturedArguments() {
func (c *MockClusterMeta_DynDialOrDie_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierClusterMeta) FetchNodes() *ClusterMeta_FetchNodes_OngoingVerification {
func (verifier *VerifierMockClusterMeta) FetchNodes() *MockClusterMeta_FetchNodes_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "FetchNodes", params, verifier.timeout)
return &ClusterMeta_FetchNodes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_FetchNodes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_FetchNodes_OngoingVerification struct {
type MockClusterMeta_FetchNodes_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_FetchNodes_OngoingVerification) GetCapturedArguments() {
func (c *MockClusterMeta_FetchNodes_OngoingVerification) GetCapturedArguments() {
}
func (c *ClusterMeta_FetchNodes_OngoingVerification) GetAllCapturedArguments() {
func (c *MockClusterMeta_FetchNodes_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierClusterMeta) GetNodes() *ClusterMeta_GetNodes_OngoingVerification {
func (verifier *VerifierMockClusterMeta) GetNodes() *MockClusterMeta_GetNodes_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetNodes", params, verifier.timeout)
return &ClusterMeta_GetNodes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_GetNodes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_GetNodes_OngoingVerification struct {
type MockClusterMeta_GetNodes_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_GetNodes_OngoingVerification) GetCapturedArguments() {
func (c *MockClusterMeta_GetNodes_OngoingVerification) GetCapturedArguments() {
}
func (c *ClusterMeta_GetNodes_OngoingVerification) GetAllCapturedArguments() {
func (c *MockClusterMeta_GetNodes_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierClusterMeta) HasMetrics() *ClusterMeta_HasMetrics_OngoingVerification {
func (verifier *VerifierMockClusterMeta) HasMetrics() *MockClusterMeta_HasMetrics_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "HasMetrics", params, verifier.timeout)
return &ClusterMeta_HasMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_HasMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_HasMetrics_OngoingVerification struct {
type MockClusterMeta_HasMetrics_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_HasMetrics_OngoingVerification) GetCapturedArguments() {
func (c *MockClusterMeta_HasMetrics_OngoingVerification) GetCapturedArguments() {
}
func (c *ClusterMeta_HasMetrics_OngoingVerification) GetAllCapturedArguments() {
func (c *MockClusterMeta_HasMetrics_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierClusterMeta) IsNamespaced(_param0 string) *ClusterMeta_IsNamespaced_OngoingVerification {
func (verifier *VerifierMockClusterMeta) IsNamespaced(_param0 string) *MockClusterMeta_IsNamespaced_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "IsNamespaced", params, verifier.timeout)
return &ClusterMeta_IsNamespaced_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_IsNamespaced_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_IsNamespaced_OngoingVerification struct {
type MockClusterMeta_IsNamespaced_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_IsNamespaced_OngoingVerification) GetCapturedArguments() string {
func (c *MockClusterMeta_IsNamespaced_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *ClusterMeta_IsNamespaced_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockClusterMeta_IsNamespaced_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -663,57 +724,57 @@ func (c *ClusterMeta_IsNamespaced_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierClusterMeta) MXDial() *ClusterMeta_MXDial_OngoingVerification {
func (verifier *VerifierMockClusterMeta) MXDial() *MockClusterMeta_MXDial_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "MXDial", params, verifier.timeout)
return &ClusterMeta_MXDial_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_MXDial_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_MXDial_OngoingVerification struct {
type MockClusterMeta_MXDial_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_MXDial_OngoingVerification) GetCapturedArguments() {
func (c *MockClusterMeta_MXDial_OngoingVerification) GetCapturedArguments() {
}
func (c *ClusterMeta_MXDial_OngoingVerification) GetAllCapturedArguments() {
func (c *MockClusterMeta_MXDial_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierClusterMeta) NSDialOrDie() *ClusterMeta_NSDialOrDie_OngoingVerification {
func (verifier *VerifierMockClusterMeta) NSDialOrDie() *MockClusterMeta_NSDialOrDie_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "NSDialOrDie", params, verifier.timeout)
return &ClusterMeta_NSDialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_NSDialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_NSDialOrDie_OngoingVerification struct {
type MockClusterMeta_NSDialOrDie_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_NSDialOrDie_OngoingVerification) GetCapturedArguments() {
func (c *MockClusterMeta_NSDialOrDie_OngoingVerification) GetCapturedArguments() {
}
func (c *ClusterMeta_NSDialOrDie_OngoingVerification) GetAllCapturedArguments() {
func (c *MockClusterMeta_NSDialOrDie_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierClusterMeta) NodePods(_param0 string) *ClusterMeta_NodePods_OngoingVerification {
func (verifier *VerifierMockClusterMeta) NodePods(_param0 string) *MockClusterMeta_NodePods_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "NodePods", params, verifier.timeout)
return &ClusterMeta_NodePods_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_NodePods_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_NodePods_OngoingVerification struct {
type MockClusterMeta_NodePods_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_NodePods_OngoingVerification) GetCapturedArguments() string {
func (c *MockClusterMeta_NodePods_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *ClusterMeta_NodePods_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockClusterMeta_NodePods_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -724,57 +785,57 @@ func (c *ClusterMeta_NodePods_OngoingVerification) GetAllCapturedArguments() (_p
return
}
func (verifier *VerifierClusterMeta) RestConfigOrDie() *ClusterMeta_RestConfigOrDie_OngoingVerification {
func (verifier *VerifierMockClusterMeta) RestConfigOrDie() *MockClusterMeta_RestConfigOrDie_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "RestConfigOrDie", params, verifier.timeout)
return &ClusterMeta_RestConfigOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_RestConfigOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_RestConfigOrDie_OngoingVerification struct {
type MockClusterMeta_RestConfigOrDie_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_RestConfigOrDie_OngoingVerification) GetCapturedArguments() {
func (c *MockClusterMeta_RestConfigOrDie_OngoingVerification) GetCapturedArguments() {
}
func (c *ClusterMeta_RestConfigOrDie_OngoingVerification) GetAllCapturedArguments() {
func (c *MockClusterMeta_RestConfigOrDie_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierClusterMeta) ServerVersion() *ClusterMeta_ServerVersion_OngoingVerification {
func (verifier *VerifierMockClusterMeta) ServerVersion() *MockClusterMeta_ServerVersion_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ServerVersion", params, verifier.timeout)
return &ClusterMeta_ServerVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_ServerVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_ServerVersion_OngoingVerification struct {
type MockClusterMeta_ServerVersion_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_ServerVersion_OngoingVerification) GetCapturedArguments() {
func (c *MockClusterMeta_ServerVersion_OngoingVerification) GetCapturedArguments() {
}
func (c *ClusterMeta_ServerVersion_OngoingVerification) GetAllCapturedArguments() {
func (c *MockClusterMeta_ServerVersion_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierClusterMeta) SupportsRes(_param0 string, _param1 []string) *ClusterMeta_SupportsRes_OngoingVerification {
func (verifier *VerifierMockClusterMeta) SupportsRes(_param0 string, _param1 []string) *MockClusterMeta_SupportsRes_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SupportsRes", params, verifier.timeout)
return &ClusterMeta_SupportsRes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_SupportsRes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_SupportsRes_OngoingVerification struct {
type MockClusterMeta_SupportsRes_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_SupportsRes_OngoingVerification) GetCapturedArguments() (string, []string) {
func (c *MockClusterMeta_SupportsRes_OngoingVerification) GetCapturedArguments() (string, []string) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *ClusterMeta_SupportsRes_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]string) {
func (c *MockClusterMeta_SupportsRes_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -789,23 +850,23 @@ func (c *ClusterMeta_SupportsRes_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierClusterMeta) SupportsResource(_param0 string) *ClusterMeta_SupportsResource_OngoingVerification {
func (verifier *VerifierMockClusterMeta) SupportsResource(_param0 string) *MockClusterMeta_SupportsResource_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SupportsResource", params, verifier.timeout)
return &ClusterMeta_SupportsResource_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_SupportsResource_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_SupportsResource_OngoingVerification struct {
type MockClusterMeta_SupportsResource_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_SupportsResource_OngoingVerification) GetCapturedArguments() string {
func (c *MockClusterMeta_SupportsResource_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *ClusterMeta_SupportsResource_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockClusterMeta_SupportsResource_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -816,23 +877,23 @@ func (c *ClusterMeta_SupportsResource_OngoingVerification) GetAllCapturedArgumen
return
}
func (verifier *VerifierClusterMeta) SwitchContextOrDie(_param0 string) *ClusterMeta_SwitchContextOrDie_OngoingVerification {
func (verifier *VerifierMockClusterMeta) SwitchContextOrDie(_param0 string) *MockClusterMeta_SwitchContextOrDie_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SwitchContextOrDie", params, verifier.timeout)
return &ClusterMeta_SwitchContextOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_SwitchContextOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_SwitchContextOrDie_OngoingVerification struct {
type MockClusterMeta_SwitchContextOrDie_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_SwitchContextOrDie_OngoingVerification) GetCapturedArguments() string {
func (c *MockClusterMeta_SwitchContextOrDie_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *ClusterMeta_SwitchContextOrDie_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockClusterMeta_SwitchContextOrDie_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -843,53 +904,53 @@ func (c *ClusterMeta_SwitchContextOrDie_OngoingVerification) GetAllCapturedArgum
return
}
func (verifier *VerifierClusterMeta) UserName() *ClusterMeta_UserName_OngoingVerification {
func (verifier *VerifierMockClusterMeta) UserName() *MockClusterMeta_UserName_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UserName", params, verifier.timeout)
return &ClusterMeta_UserName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_UserName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_UserName_OngoingVerification struct {
type MockClusterMeta_UserName_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_UserName_OngoingVerification) GetCapturedArguments() {
func (c *MockClusterMeta_UserName_OngoingVerification) GetCapturedArguments() {
}
func (c *ClusterMeta_UserName_OngoingVerification) GetAllCapturedArguments() {
func (c *MockClusterMeta_UserName_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierClusterMeta) ValidNamespaces() *ClusterMeta_ValidNamespaces_OngoingVerification {
func (verifier *VerifierMockClusterMeta) ValidNamespaces() *MockClusterMeta_ValidNamespaces_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ValidNamespaces", params, verifier.timeout)
return &ClusterMeta_ValidNamespaces_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_ValidNamespaces_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_ValidNamespaces_OngoingVerification struct {
type MockClusterMeta_ValidNamespaces_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_ValidNamespaces_OngoingVerification) GetCapturedArguments() {
func (c *MockClusterMeta_ValidNamespaces_OngoingVerification) GetCapturedArguments() {
}
func (c *ClusterMeta_ValidNamespaces_OngoingVerification) GetAllCapturedArguments() {
func (c *MockClusterMeta_ValidNamespaces_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierClusterMeta) Version() *ClusterMeta_Version_OngoingVerification {
func (verifier *VerifierMockClusterMeta) Version() *MockClusterMeta_Version_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Version", params, verifier.timeout)
return &ClusterMeta_Version_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClusterMeta_Version_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ClusterMeta_Version_OngoingVerification struct {
type MockClusterMeta_Version_OngoingVerification struct {
mock *MockClusterMeta
methodInvocations []pegomock.MethodInvocation
}
func (c *ClusterMeta_Version_OngoingVerification) GetCapturedArguments() {
func (c *MockClusterMeta_Version_OngoingVerification) GetCapturedArguments() {
}
func (c *ClusterMeta_Version_OngoingVerification) GetAllCapturedArguments() {
func (c *MockClusterMeta_Version_OngoingVerification) GetAllCapturedArguments() {
}

View File

@ -20,8 +20,34 @@ type MockConnection struct {
fail func(message string, callerSkip ...int)
}
func NewMockConnection() *MockConnection {
return &MockConnection{fail: pegomock.GlobalFailHandler}
func NewMockConnection(options ...pegomock.Option) *MockConnection {
mock := &MockConnection{}
for _, option := range options {
option.Apply(mock)
}
return mock
}
func (mock *MockConnection) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockConnection) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockConnection) CanIAccess(_param0 string, _param1 string, _param2 []string) (bool, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockConnection().")
}
params := []pegomock.Param{_param0, _param1, _param2}
result := pegomock.GetGenericMockFrom(mock).Invoke("CanIAccess", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 bool
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(bool)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockConnection) CheckListNSAccess() error {
@ -319,77 +345,112 @@ func (mock *MockConnection) ValidNamespaces() ([]v1.Namespace, error) {
return ret0, ret1
}
func (mock *MockConnection) VerifyWasCalledOnce() *VerifierConnection {
return &VerifierConnection{
func (mock *MockConnection) VerifyWasCalledOnce() *VerifierMockConnection {
return &VerifierMockConnection{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockConnection) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierConnection {
return &VerifierConnection{
func (mock *MockConnection) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockConnection {
return &VerifierMockConnection{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockConnection) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierConnection {
return &VerifierConnection{
func (mock *MockConnection) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockConnection {
return &VerifierMockConnection{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockConnection) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierConnection {
return &VerifierConnection{
func (mock *MockConnection) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockConnection {
return &VerifierMockConnection{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierConnection struct {
type VerifierMockConnection struct {
mock *MockConnection
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierConnection) CheckListNSAccess() *Connection_CheckListNSAccess_OngoingVerification {
func (verifier *VerifierMockConnection) CanIAccess(_param0 string, _param1 string, _param2 []string) *MockConnection_CanIAccess_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CanIAccess", params, verifier.timeout)
return &MockConnection_CanIAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockConnection_CanIAccess_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *MockConnection_CanIAccess_OngoingVerification) GetCapturedArguments() (string, string, []string) {
_param0, _param1, _param2 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1]
}
func (c *MockConnection_CanIAccess_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 [][]string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
for u, param := range params[0] {
_param0[u] = param.(string)
}
_param1 = make([]string, len(params[1]))
for u, param := range params[1] {
_param1[u] = param.(string)
}
_param2 = make([][]string, len(params[2]))
for u, param := range params[2] {
_param2[u] = param.([]string)
}
}
return
}
func (verifier *VerifierMockConnection) CheckListNSAccess() *MockConnection_CheckListNSAccess_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CheckListNSAccess", params, verifier.timeout)
return &Connection_CheckListNSAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_CheckListNSAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_CheckListNSAccess_OngoingVerification struct {
type MockConnection_CheckListNSAccess_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_CheckListNSAccess_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_CheckListNSAccess_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_CheckListNSAccess_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_CheckListNSAccess_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) CheckNSAccess(_param0 string) *Connection_CheckNSAccess_OngoingVerification {
func (verifier *VerifierMockConnection) CheckNSAccess(_param0 string) *MockConnection_CheckNSAccess_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CheckNSAccess", params, verifier.timeout)
return &Connection_CheckNSAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_CheckNSAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_CheckNSAccess_OngoingVerification struct {
type MockConnection_CheckNSAccess_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_CheckNSAccess_OngoingVerification) GetCapturedArguments() string {
func (c *MockConnection_CheckNSAccess_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Connection_CheckNSAccess_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockConnection_CheckNSAccess_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -400,125 +461,125 @@ func (c *Connection_CheckNSAccess_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierConnection) Config() *Connection_Config_OngoingVerification {
func (verifier *VerifierMockConnection) Config() *MockConnection_Config_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Config", params, verifier.timeout)
return &Connection_Config_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_Config_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_Config_OngoingVerification struct {
type MockConnection_Config_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_Config_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_Config_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_Config_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_Config_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) CurrentNamespaceName() *Connection_CurrentNamespaceName_OngoingVerification {
func (verifier *VerifierMockConnection) CurrentNamespaceName() *MockConnection_CurrentNamespaceName_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CurrentNamespaceName", params, verifier.timeout)
return &Connection_CurrentNamespaceName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_CurrentNamespaceName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_CurrentNamespaceName_OngoingVerification struct {
type MockConnection_CurrentNamespaceName_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_CurrentNamespaceName_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_CurrentNamespaceName_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_CurrentNamespaceName_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_CurrentNamespaceName_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) DialOrDie() *Connection_DialOrDie_OngoingVerification {
func (verifier *VerifierMockConnection) DialOrDie() *MockConnection_DialOrDie_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DialOrDie", params, verifier.timeout)
return &Connection_DialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_DialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_DialOrDie_OngoingVerification struct {
type MockConnection_DialOrDie_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_DialOrDie_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_DialOrDie_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_DialOrDie_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_DialOrDie_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) DynDialOrDie() *Connection_DynDialOrDie_OngoingVerification {
func (verifier *VerifierMockConnection) DynDialOrDie() *MockConnection_DynDialOrDie_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DynDialOrDie", params, verifier.timeout)
return &Connection_DynDialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_DynDialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_DynDialOrDie_OngoingVerification struct {
type MockConnection_DynDialOrDie_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_DynDialOrDie_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_DynDialOrDie_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_DynDialOrDie_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_DynDialOrDie_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) FetchNodes() *Connection_FetchNodes_OngoingVerification {
func (verifier *VerifierMockConnection) FetchNodes() *MockConnection_FetchNodes_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "FetchNodes", params, verifier.timeout)
return &Connection_FetchNodes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_FetchNodes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_FetchNodes_OngoingVerification struct {
type MockConnection_FetchNodes_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_FetchNodes_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_FetchNodes_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_FetchNodes_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_FetchNodes_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) HasMetrics() *Connection_HasMetrics_OngoingVerification {
func (verifier *VerifierMockConnection) HasMetrics() *MockConnection_HasMetrics_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "HasMetrics", params, verifier.timeout)
return &Connection_HasMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_HasMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_HasMetrics_OngoingVerification struct {
type MockConnection_HasMetrics_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_HasMetrics_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_HasMetrics_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_HasMetrics_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_HasMetrics_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) IsNamespaced(_param0 string) *Connection_IsNamespaced_OngoingVerification {
func (verifier *VerifierMockConnection) IsNamespaced(_param0 string) *MockConnection_IsNamespaced_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "IsNamespaced", params, verifier.timeout)
return &Connection_IsNamespaced_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_IsNamespaced_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_IsNamespaced_OngoingVerification struct {
type MockConnection_IsNamespaced_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_IsNamespaced_OngoingVerification) GetCapturedArguments() string {
func (c *MockConnection_IsNamespaced_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Connection_IsNamespaced_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockConnection_IsNamespaced_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -529,57 +590,57 @@ func (c *Connection_IsNamespaced_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierConnection) MXDial() *Connection_MXDial_OngoingVerification {
func (verifier *VerifierMockConnection) MXDial() *MockConnection_MXDial_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "MXDial", params, verifier.timeout)
return &Connection_MXDial_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_MXDial_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_MXDial_OngoingVerification struct {
type MockConnection_MXDial_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_MXDial_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_MXDial_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_MXDial_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_MXDial_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) NSDialOrDie() *Connection_NSDialOrDie_OngoingVerification {
func (verifier *VerifierMockConnection) NSDialOrDie() *MockConnection_NSDialOrDie_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "NSDialOrDie", params, verifier.timeout)
return &Connection_NSDialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_NSDialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_NSDialOrDie_OngoingVerification struct {
type MockConnection_NSDialOrDie_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_NSDialOrDie_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_NSDialOrDie_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_NSDialOrDie_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_NSDialOrDie_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) NodePods(_param0 string) *Connection_NodePods_OngoingVerification {
func (verifier *VerifierMockConnection) NodePods(_param0 string) *MockConnection_NodePods_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "NodePods", params, verifier.timeout)
return &Connection_NodePods_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_NodePods_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_NodePods_OngoingVerification struct {
type MockConnection_NodePods_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_NodePods_OngoingVerification) GetCapturedArguments() string {
func (c *MockConnection_NodePods_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Connection_NodePods_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockConnection_NodePods_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -590,57 +651,57 @@ func (c *Connection_NodePods_OngoingVerification) GetAllCapturedArguments() (_pa
return
}
func (verifier *VerifierConnection) RestConfigOrDie() *Connection_RestConfigOrDie_OngoingVerification {
func (verifier *VerifierMockConnection) RestConfigOrDie() *MockConnection_RestConfigOrDie_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "RestConfigOrDie", params, verifier.timeout)
return &Connection_RestConfigOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_RestConfigOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_RestConfigOrDie_OngoingVerification struct {
type MockConnection_RestConfigOrDie_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_RestConfigOrDie_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_RestConfigOrDie_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_RestConfigOrDie_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_RestConfigOrDie_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) ServerVersion() *Connection_ServerVersion_OngoingVerification {
func (verifier *VerifierMockConnection) ServerVersion() *MockConnection_ServerVersion_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ServerVersion", params, verifier.timeout)
return &Connection_ServerVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_ServerVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_ServerVersion_OngoingVerification struct {
type MockConnection_ServerVersion_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_ServerVersion_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_ServerVersion_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_ServerVersion_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_ServerVersion_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) SupportsRes(_param0 string, _param1 []string) *Connection_SupportsRes_OngoingVerification {
func (verifier *VerifierMockConnection) SupportsRes(_param0 string, _param1 []string) *MockConnection_SupportsRes_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SupportsRes", params, verifier.timeout)
return &Connection_SupportsRes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_SupportsRes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_SupportsRes_OngoingVerification struct {
type MockConnection_SupportsRes_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_SupportsRes_OngoingVerification) GetCapturedArguments() (string, []string) {
func (c *MockConnection_SupportsRes_OngoingVerification) GetCapturedArguments() (string, []string) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *Connection_SupportsRes_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]string) {
func (c *MockConnection_SupportsRes_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -655,23 +716,23 @@ func (c *Connection_SupportsRes_OngoingVerification) GetAllCapturedArguments() (
return
}
func (verifier *VerifierConnection) SupportsResource(_param0 string) *Connection_SupportsResource_OngoingVerification {
func (verifier *VerifierMockConnection) SupportsResource(_param0 string) *MockConnection_SupportsResource_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SupportsResource", params, verifier.timeout)
return &Connection_SupportsResource_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_SupportsResource_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_SupportsResource_OngoingVerification struct {
type MockConnection_SupportsResource_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_SupportsResource_OngoingVerification) GetCapturedArguments() string {
func (c *MockConnection_SupportsResource_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Connection_SupportsResource_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockConnection_SupportsResource_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -682,23 +743,23 @@ func (c *Connection_SupportsResource_OngoingVerification) GetAllCapturedArgument
return
}
func (verifier *VerifierConnection) SwitchContextOrDie(_param0 string) *Connection_SwitchContextOrDie_OngoingVerification {
func (verifier *VerifierMockConnection) SwitchContextOrDie(_param0 string) *MockConnection_SwitchContextOrDie_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SwitchContextOrDie", params, verifier.timeout)
return &Connection_SwitchContextOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_SwitchContextOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_SwitchContextOrDie_OngoingVerification struct {
type MockConnection_SwitchContextOrDie_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_SwitchContextOrDie_OngoingVerification) GetCapturedArguments() string {
func (c *MockConnection_SwitchContextOrDie_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Connection_SwitchContextOrDie_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockConnection_SwitchContextOrDie_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -709,19 +770,19 @@ func (c *Connection_SwitchContextOrDie_OngoingVerification) GetAllCapturedArgume
return
}
func (verifier *VerifierConnection) ValidNamespaces() *Connection_ValidNamespaces_OngoingVerification {
func (verifier *VerifierMockConnection) ValidNamespaces() *MockConnection_ValidNamespaces_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ValidNamespaces", params, verifier.timeout)
return &Connection_ValidNamespaces_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_ValidNamespaces_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_ValidNamespaces_OngoingVerification struct {
type MockConnection_ValidNamespaces_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_ValidNamespaces_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_ValidNamespaces_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_ValidNamespaces_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_ValidNamespaces_OngoingVerification) GetAllCapturedArguments() {
}

View File

@ -14,10 +14,17 @@ type MockCruder struct {
fail func(message string, callerSkip ...int)
}
func NewMockCruder() *MockCruder {
return &MockCruder{fail: pegomock.GlobalFailHandler}
func NewMockCruder(options ...pegomock.Option) *MockCruder {
mock := &MockCruder{}
for _, option := range options {
option.Apply(mock)
}
return mock
}
func (mock *MockCruder) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockCruder) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockCruder) Delete(_param0 string, _param1 string, _param2 bool, _param3 bool) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockCruder().")
@ -132,60 +139,60 @@ func (mock *MockCruder) SetLabelSelector(_param0 string) {
pegomock.GetGenericMockFrom(mock).Invoke("SetLabelSelector", params, []reflect.Type{})
}
func (mock *MockCruder) VerifyWasCalledOnce() *VerifierCruder {
return &VerifierCruder{
func (mock *MockCruder) VerifyWasCalledOnce() *VerifierMockCruder {
return &VerifierMockCruder{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockCruder) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierCruder {
return &VerifierCruder{
func (mock *MockCruder) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockCruder {
return &VerifierMockCruder{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockCruder) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierCruder {
return &VerifierCruder{
func (mock *MockCruder) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockCruder {
return &VerifierMockCruder{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockCruder) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierCruder {
return &VerifierCruder{
func (mock *MockCruder) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockCruder {
return &VerifierMockCruder{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierCruder struct {
type VerifierMockCruder struct {
mock *MockCruder
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierCruder) Delete(_param0 string, _param1 string, _param2 bool, _param3 bool) *Cruder_Delete_OngoingVerification {
func (verifier *VerifierMockCruder) Delete(_param0 string, _param1 string, _param2 bool, _param3 bool) *MockCruder_Delete_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2, _param3}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Delete", params, verifier.timeout)
return &Cruder_Delete_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockCruder_Delete_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Cruder_Delete_OngoingVerification struct {
type MockCruder_Delete_OngoingVerification struct {
mock *MockCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *Cruder_Delete_OngoingVerification) GetCapturedArguments() (string, string, bool, bool) {
func (c *MockCruder_Delete_OngoingVerification) GetCapturedArguments() (string, string, bool, bool) {
_param0, _param1, _param2, _param3 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1]
}
func (c *Cruder_Delete_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 []bool, _param3 []bool) {
func (c *MockCruder_Delete_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 []bool, _param3 []bool) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -208,23 +215,23 @@ func (c *Cruder_Delete_OngoingVerification) GetAllCapturedArguments() (_param0 [
return
}
func (verifier *VerifierCruder) Get(_param0 string, _param1 string) *Cruder_Get_OngoingVerification {
func (verifier *VerifierMockCruder) Get(_param0 string, _param1 string) *MockCruder_Get_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Get", params, verifier.timeout)
return &Cruder_Get_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockCruder_Get_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Cruder_Get_OngoingVerification struct {
type MockCruder_Get_OngoingVerification struct {
mock *MockCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *Cruder_Get_OngoingVerification) GetCapturedArguments() (string, string) {
func (c *MockCruder_Get_OngoingVerification) GetCapturedArguments() (string, string) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *Cruder_Get_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string) {
func (c *MockCruder_Get_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -239,74 +246,74 @@ func (c *Cruder_Get_OngoingVerification) GetAllCapturedArguments() (_param0 []st
return
}
func (verifier *VerifierCruder) GetFieldSelector() *Cruder_GetFieldSelector_OngoingVerification {
func (verifier *VerifierMockCruder) GetFieldSelector() *MockCruder_GetFieldSelector_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetFieldSelector", params, verifier.timeout)
return &Cruder_GetFieldSelector_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockCruder_GetFieldSelector_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Cruder_GetFieldSelector_OngoingVerification struct {
type MockCruder_GetFieldSelector_OngoingVerification struct {
mock *MockCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *Cruder_GetFieldSelector_OngoingVerification) GetCapturedArguments() {
func (c *MockCruder_GetFieldSelector_OngoingVerification) GetCapturedArguments() {
}
func (c *Cruder_GetFieldSelector_OngoingVerification) GetAllCapturedArguments() {
func (c *MockCruder_GetFieldSelector_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierCruder) GetLabelSelector() *Cruder_GetLabelSelector_OngoingVerification {
func (verifier *VerifierMockCruder) GetLabelSelector() *MockCruder_GetLabelSelector_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetLabelSelector", params, verifier.timeout)
return &Cruder_GetLabelSelector_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockCruder_GetLabelSelector_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Cruder_GetLabelSelector_OngoingVerification struct {
type MockCruder_GetLabelSelector_OngoingVerification struct {
mock *MockCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *Cruder_GetLabelSelector_OngoingVerification) GetCapturedArguments() {
func (c *MockCruder_GetLabelSelector_OngoingVerification) GetCapturedArguments() {
}
func (c *Cruder_GetLabelSelector_OngoingVerification) GetAllCapturedArguments() {
func (c *MockCruder_GetLabelSelector_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierCruder) HasSelectors() *Cruder_HasSelectors_OngoingVerification {
func (verifier *VerifierMockCruder) HasSelectors() *MockCruder_HasSelectors_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "HasSelectors", params, verifier.timeout)
return &Cruder_HasSelectors_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockCruder_HasSelectors_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Cruder_HasSelectors_OngoingVerification struct {
type MockCruder_HasSelectors_OngoingVerification struct {
mock *MockCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *Cruder_HasSelectors_OngoingVerification) GetCapturedArguments() {
func (c *MockCruder_HasSelectors_OngoingVerification) GetCapturedArguments() {
}
func (c *Cruder_HasSelectors_OngoingVerification) GetAllCapturedArguments() {
func (c *MockCruder_HasSelectors_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierCruder) List(_param0 string) *Cruder_List_OngoingVerification {
func (verifier *VerifierMockCruder) List(_param0 string) *MockCruder_List_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "List", params, verifier.timeout)
return &Cruder_List_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockCruder_List_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Cruder_List_OngoingVerification struct {
type MockCruder_List_OngoingVerification struct {
mock *MockCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *Cruder_List_OngoingVerification) GetCapturedArguments() string {
func (c *MockCruder_List_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Cruder_List_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockCruder_List_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -317,23 +324,23 @@ func (c *Cruder_List_OngoingVerification) GetAllCapturedArguments() (_param0 []s
return
}
func (verifier *VerifierCruder) SetFieldSelector(_param0 string) *Cruder_SetFieldSelector_OngoingVerification {
func (verifier *VerifierMockCruder) SetFieldSelector(_param0 string) *MockCruder_SetFieldSelector_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SetFieldSelector", params, verifier.timeout)
return &Cruder_SetFieldSelector_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockCruder_SetFieldSelector_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Cruder_SetFieldSelector_OngoingVerification struct {
type MockCruder_SetFieldSelector_OngoingVerification struct {
mock *MockCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *Cruder_SetFieldSelector_OngoingVerification) GetCapturedArguments() string {
func (c *MockCruder_SetFieldSelector_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Cruder_SetFieldSelector_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockCruder_SetFieldSelector_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -344,23 +351,23 @@ func (c *Cruder_SetFieldSelector_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierCruder) SetLabelSelector(_param0 string) *Cruder_SetLabelSelector_OngoingVerification {
func (verifier *VerifierMockCruder) SetLabelSelector(_param0 string) *MockCruder_SetLabelSelector_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SetLabelSelector", params, verifier.timeout)
return &Cruder_SetLabelSelector_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockCruder_SetLabelSelector_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Cruder_SetLabelSelector_OngoingVerification struct {
type MockCruder_SetLabelSelector_OngoingVerification struct {
mock *MockCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *Cruder_SetLabelSelector_OngoingVerification) GetCapturedArguments() string {
func (c *MockCruder_SetLabelSelector_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Cruder_SetLabelSelector_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockCruder_SetLabelSelector_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))

View File

@ -15,10 +15,17 @@ type MockMetricsServer struct {
fail func(message string, callerSkip ...int)
}
func NewMockMetricsServer() *MockMetricsServer {
return &MockMetricsServer{fail: pegomock.GlobalFailHandler}
func NewMockMetricsServer(options ...pegomock.Option) *MockMetricsServer {
mock := &MockMetricsServer{}
for _, option := range options {
option.Apply(mock)
}
return mock
}
func (mock *MockMetricsServer) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockMetricsServer) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockMetricsServer) ClusterLoad(_param0 k8s.Collection, _param1 k8s.Collection, _param2 *k8s.ClusterMetrics) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockMetricsServer().")
@ -96,60 +103,60 @@ func (mock *MockMetricsServer) PodsMetrics(_param0 *v1beta1.PodMetricsList, _par
pegomock.GetGenericMockFrom(mock).Invoke("PodsMetrics", params, []reflect.Type{})
}
func (mock *MockMetricsServer) VerifyWasCalledOnce() *VerifierMetricsServer {
return &VerifierMetricsServer{
func (mock *MockMetricsServer) VerifyWasCalledOnce() *VerifierMockMetricsServer {
return &VerifierMockMetricsServer{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockMetricsServer) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMetricsServer {
return &VerifierMetricsServer{
func (mock *MockMetricsServer) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockMetricsServer {
return &VerifierMockMetricsServer{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockMetricsServer) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMetricsServer {
return &VerifierMetricsServer{
func (mock *MockMetricsServer) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockMetricsServer {
return &VerifierMockMetricsServer{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockMetricsServer) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMetricsServer {
return &VerifierMetricsServer{
func (mock *MockMetricsServer) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockMetricsServer {
return &VerifierMockMetricsServer{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierMetricsServer struct {
type VerifierMockMetricsServer struct {
mock *MockMetricsServer
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierMetricsServer) ClusterLoad(_param0 k8s.Collection, _param1 k8s.Collection, _param2 *k8s.ClusterMetrics) *MetricsServer_ClusterLoad_OngoingVerification {
func (verifier *VerifierMockMetricsServer) ClusterLoad(_param0 k8s.Collection, _param1 k8s.Collection, _param2 *k8s.ClusterMetrics) *MockMetricsServer_ClusterLoad_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ClusterLoad", params, verifier.timeout)
return &MetricsServer_ClusterLoad_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockMetricsServer_ClusterLoad_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MetricsServer_ClusterLoad_OngoingVerification struct {
type MockMetricsServer_ClusterLoad_OngoingVerification struct {
mock *MockMetricsServer
methodInvocations []pegomock.MethodInvocation
}
func (c *MetricsServer_ClusterLoad_OngoingVerification) GetCapturedArguments() (k8s.Collection, k8s.Collection, *k8s.ClusterMetrics) {
func (c *MockMetricsServer_ClusterLoad_OngoingVerification) GetCapturedArguments() (k8s.Collection, k8s.Collection, *k8s.ClusterMetrics) {
_param0, _param1, _param2 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1]
}
func (c *MetricsServer_ClusterLoad_OngoingVerification) GetAllCapturedArguments() (_param0 []k8s.Collection, _param1 []k8s.Collection, _param2 []*k8s.ClusterMetrics) {
func (c *MockMetricsServer_ClusterLoad_OngoingVerification) GetAllCapturedArguments() (_param0 []k8s.Collection, _param1 []k8s.Collection, _param2 []*k8s.ClusterMetrics) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]k8s.Collection, len(params[0]))
@ -168,40 +175,40 @@ func (c *MetricsServer_ClusterLoad_OngoingVerification) GetAllCapturedArguments(
return
}
func (verifier *VerifierMetricsServer) FetchNodesMetrics() *MetricsServer_FetchNodesMetrics_OngoingVerification {
func (verifier *VerifierMockMetricsServer) FetchNodesMetrics() *MockMetricsServer_FetchNodesMetrics_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "FetchNodesMetrics", params, verifier.timeout)
return &MetricsServer_FetchNodesMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockMetricsServer_FetchNodesMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MetricsServer_FetchNodesMetrics_OngoingVerification struct {
type MockMetricsServer_FetchNodesMetrics_OngoingVerification struct {
mock *MockMetricsServer
methodInvocations []pegomock.MethodInvocation
}
func (c *MetricsServer_FetchNodesMetrics_OngoingVerification) GetCapturedArguments() {
func (c *MockMetricsServer_FetchNodesMetrics_OngoingVerification) GetCapturedArguments() {
}
func (c *MetricsServer_FetchNodesMetrics_OngoingVerification) GetAllCapturedArguments() {
func (c *MockMetricsServer_FetchNodesMetrics_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierMetricsServer) FetchPodsMetrics(_param0 string) *MetricsServer_FetchPodsMetrics_OngoingVerification {
func (verifier *VerifierMockMetricsServer) FetchPodsMetrics(_param0 string) *MockMetricsServer_FetchPodsMetrics_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "FetchPodsMetrics", params, verifier.timeout)
return &MetricsServer_FetchPodsMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockMetricsServer_FetchPodsMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MetricsServer_FetchPodsMetrics_OngoingVerification struct {
type MockMetricsServer_FetchPodsMetrics_OngoingVerification struct {
mock *MockMetricsServer
methodInvocations []pegomock.MethodInvocation
}
func (c *MetricsServer_FetchPodsMetrics_OngoingVerification) GetCapturedArguments() string {
func (c *MockMetricsServer_FetchPodsMetrics_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *MetricsServer_FetchPodsMetrics_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockMetricsServer_FetchPodsMetrics_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -212,40 +219,40 @@ func (c *MetricsServer_FetchPodsMetrics_OngoingVerification) GetAllCapturedArgum
return
}
func (verifier *VerifierMetricsServer) HasMetrics() *MetricsServer_HasMetrics_OngoingVerification {
func (verifier *VerifierMockMetricsServer) HasMetrics() *MockMetricsServer_HasMetrics_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "HasMetrics", params, verifier.timeout)
return &MetricsServer_HasMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockMetricsServer_HasMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MetricsServer_HasMetrics_OngoingVerification struct {
type MockMetricsServer_HasMetrics_OngoingVerification struct {
mock *MockMetricsServer
methodInvocations []pegomock.MethodInvocation
}
func (c *MetricsServer_HasMetrics_OngoingVerification) GetCapturedArguments() {
func (c *MockMetricsServer_HasMetrics_OngoingVerification) GetCapturedArguments() {
}
func (c *MetricsServer_HasMetrics_OngoingVerification) GetAllCapturedArguments() {
func (c *MockMetricsServer_HasMetrics_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierMetricsServer) NodesMetrics(_param0 k8s.Collection, _param1 *v1beta1.NodeMetricsList, _param2 k8s.NodesMetrics) *MetricsServer_NodesMetrics_OngoingVerification {
func (verifier *VerifierMockMetricsServer) NodesMetrics(_param0 k8s.Collection, _param1 *v1beta1.NodeMetricsList, _param2 k8s.NodesMetrics) *MockMetricsServer_NodesMetrics_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "NodesMetrics", params, verifier.timeout)
return &MetricsServer_NodesMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockMetricsServer_NodesMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MetricsServer_NodesMetrics_OngoingVerification struct {
type MockMetricsServer_NodesMetrics_OngoingVerification struct {
mock *MockMetricsServer
methodInvocations []pegomock.MethodInvocation
}
func (c *MetricsServer_NodesMetrics_OngoingVerification) GetCapturedArguments() (k8s.Collection, *v1beta1.NodeMetricsList, k8s.NodesMetrics) {
func (c *MockMetricsServer_NodesMetrics_OngoingVerification) GetCapturedArguments() (k8s.Collection, *v1beta1.NodeMetricsList, k8s.NodesMetrics) {
_param0, _param1, _param2 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1]
}
func (c *MetricsServer_NodesMetrics_OngoingVerification) GetAllCapturedArguments() (_param0 []k8s.Collection, _param1 []*v1beta1.NodeMetricsList, _param2 []k8s.NodesMetrics) {
func (c *MockMetricsServer_NodesMetrics_OngoingVerification) GetAllCapturedArguments() (_param0 []k8s.Collection, _param1 []*v1beta1.NodeMetricsList, _param2 []k8s.NodesMetrics) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]k8s.Collection, len(params[0]))
@ -264,23 +271,23 @@ func (c *MetricsServer_NodesMetrics_OngoingVerification) GetAllCapturedArguments
return
}
func (verifier *VerifierMetricsServer) PodsMetrics(_param0 *v1beta1.PodMetricsList, _param1 k8s.PodsMetrics) *MetricsServer_PodsMetrics_OngoingVerification {
func (verifier *VerifierMockMetricsServer) PodsMetrics(_param0 *v1beta1.PodMetricsList, _param1 k8s.PodsMetrics) *MockMetricsServer_PodsMetrics_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "PodsMetrics", params, verifier.timeout)
return &MetricsServer_PodsMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockMetricsServer_PodsMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MetricsServer_PodsMetrics_OngoingVerification struct {
type MockMetricsServer_PodsMetrics_OngoingVerification struct {
mock *MockMetricsServer
methodInvocations []pegomock.MethodInvocation
}
func (c *MetricsServer_PodsMetrics_OngoingVerification) GetCapturedArguments() (*v1beta1.PodMetricsList, k8s.PodsMetrics) {
func (c *MockMetricsServer_PodsMetrics_OngoingVerification) GetCapturedArguments() (*v1beta1.PodMetricsList, k8s.PodsMetrics) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *MetricsServer_PodsMetrics_OngoingVerification) GetAllCapturedArguments() (_param0 []*v1beta1.PodMetricsList, _param1 []k8s.PodsMetrics) {
func (c *MockMetricsServer_PodsMetrics_OngoingVerification) GetAllCapturedArguments() (_param0 []*v1beta1.PodMetricsList, _param1 []k8s.PodsMetrics) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*v1beta1.PodMetricsList, len(params[0]))

View File

@ -14,10 +14,17 @@ type MockSwitchableCruder struct {
fail func(message string, callerSkip ...int)
}
func NewMockSwitchableCruder() *MockSwitchableCruder {
return &MockSwitchableCruder{fail: pegomock.GlobalFailHandler}
func NewMockSwitchableCruder(options ...pegomock.Option) *MockSwitchableCruder {
mock := &MockSwitchableCruder{}
for _, option := range options {
option.Apply(mock)
}
return mock
}
func (mock *MockSwitchableCruder) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockSwitchableCruder) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockSwitchableCruder) Delete(_param0 string, _param1 string, _param2 bool, _param3 bool) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockSwitchableCruder().")
@ -162,60 +169,60 @@ func (mock *MockSwitchableCruder) Switch(_param0 string) error {
return ret0
}
func (mock *MockSwitchableCruder) VerifyWasCalledOnce() *VerifierSwitchableCruder {
return &VerifierSwitchableCruder{
func (mock *MockSwitchableCruder) VerifyWasCalledOnce() *VerifierMockSwitchableCruder {
return &VerifierMockSwitchableCruder{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockSwitchableCruder) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierSwitchableCruder {
return &VerifierSwitchableCruder{
func (mock *MockSwitchableCruder) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockSwitchableCruder {
return &VerifierMockSwitchableCruder{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockSwitchableCruder) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierSwitchableCruder {
return &VerifierSwitchableCruder{
func (mock *MockSwitchableCruder) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockSwitchableCruder {
return &VerifierMockSwitchableCruder{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockSwitchableCruder) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierSwitchableCruder {
return &VerifierSwitchableCruder{
func (mock *MockSwitchableCruder) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockSwitchableCruder {
return &VerifierMockSwitchableCruder{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierSwitchableCruder struct {
type VerifierMockSwitchableCruder struct {
mock *MockSwitchableCruder
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierSwitchableCruder) Delete(_param0 string, _param1 string, _param2 bool, _param3 bool) *SwitchableCruder_Delete_OngoingVerification {
func (verifier *VerifierMockSwitchableCruder) Delete(_param0 string, _param1 string, _param2 bool, _param3 bool) *MockSwitchableCruder_Delete_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2, _param3}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Delete", params, verifier.timeout)
return &SwitchableCruder_Delete_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSwitchableCruder_Delete_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SwitchableCruder_Delete_OngoingVerification struct {
type MockSwitchableCruder_Delete_OngoingVerification struct {
mock *MockSwitchableCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *SwitchableCruder_Delete_OngoingVerification) GetCapturedArguments() (string, string, bool, bool) {
func (c *MockSwitchableCruder_Delete_OngoingVerification) GetCapturedArguments() (string, string, bool, bool) {
_param0, _param1, _param2, _param3 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1]
}
func (c *SwitchableCruder_Delete_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 []bool, _param3 []bool) {
func (c *MockSwitchableCruder_Delete_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 []bool, _param3 []bool) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -238,23 +245,23 @@ func (c *SwitchableCruder_Delete_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierSwitchableCruder) Get(_param0 string, _param1 string) *SwitchableCruder_Get_OngoingVerification {
func (verifier *VerifierMockSwitchableCruder) Get(_param0 string, _param1 string) *MockSwitchableCruder_Get_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Get", params, verifier.timeout)
return &SwitchableCruder_Get_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSwitchableCruder_Get_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SwitchableCruder_Get_OngoingVerification struct {
type MockSwitchableCruder_Get_OngoingVerification struct {
mock *MockSwitchableCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *SwitchableCruder_Get_OngoingVerification) GetCapturedArguments() (string, string) {
func (c *MockSwitchableCruder_Get_OngoingVerification) GetCapturedArguments() (string, string) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *SwitchableCruder_Get_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string) {
func (c *MockSwitchableCruder_Get_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -269,74 +276,74 @@ func (c *SwitchableCruder_Get_OngoingVerification) GetAllCapturedArguments() (_p
return
}
func (verifier *VerifierSwitchableCruder) GetFieldSelector() *SwitchableCruder_GetFieldSelector_OngoingVerification {
func (verifier *VerifierMockSwitchableCruder) GetFieldSelector() *MockSwitchableCruder_GetFieldSelector_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetFieldSelector", params, verifier.timeout)
return &SwitchableCruder_GetFieldSelector_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSwitchableCruder_GetFieldSelector_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SwitchableCruder_GetFieldSelector_OngoingVerification struct {
type MockSwitchableCruder_GetFieldSelector_OngoingVerification struct {
mock *MockSwitchableCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *SwitchableCruder_GetFieldSelector_OngoingVerification) GetCapturedArguments() {
func (c *MockSwitchableCruder_GetFieldSelector_OngoingVerification) GetCapturedArguments() {
}
func (c *SwitchableCruder_GetFieldSelector_OngoingVerification) GetAllCapturedArguments() {
func (c *MockSwitchableCruder_GetFieldSelector_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierSwitchableCruder) GetLabelSelector() *SwitchableCruder_GetLabelSelector_OngoingVerification {
func (verifier *VerifierMockSwitchableCruder) GetLabelSelector() *MockSwitchableCruder_GetLabelSelector_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetLabelSelector", params, verifier.timeout)
return &SwitchableCruder_GetLabelSelector_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSwitchableCruder_GetLabelSelector_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SwitchableCruder_GetLabelSelector_OngoingVerification struct {
type MockSwitchableCruder_GetLabelSelector_OngoingVerification struct {
mock *MockSwitchableCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *SwitchableCruder_GetLabelSelector_OngoingVerification) GetCapturedArguments() {
func (c *MockSwitchableCruder_GetLabelSelector_OngoingVerification) GetCapturedArguments() {
}
func (c *SwitchableCruder_GetLabelSelector_OngoingVerification) GetAllCapturedArguments() {
func (c *MockSwitchableCruder_GetLabelSelector_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierSwitchableCruder) HasSelectors() *SwitchableCruder_HasSelectors_OngoingVerification {
func (verifier *VerifierMockSwitchableCruder) HasSelectors() *MockSwitchableCruder_HasSelectors_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "HasSelectors", params, verifier.timeout)
return &SwitchableCruder_HasSelectors_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSwitchableCruder_HasSelectors_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SwitchableCruder_HasSelectors_OngoingVerification struct {
type MockSwitchableCruder_HasSelectors_OngoingVerification struct {
mock *MockSwitchableCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *SwitchableCruder_HasSelectors_OngoingVerification) GetCapturedArguments() {
func (c *MockSwitchableCruder_HasSelectors_OngoingVerification) GetCapturedArguments() {
}
func (c *SwitchableCruder_HasSelectors_OngoingVerification) GetAllCapturedArguments() {
func (c *MockSwitchableCruder_HasSelectors_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierSwitchableCruder) List(_param0 string) *SwitchableCruder_List_OngoingVerification {
func (verifier *VerifierMockSwitchableCruder) List(_param0 string) *MockSwitchableCruder_List_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "List", params, verifier.timeout)
return &SwitchableCruder_List_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSwitchableCruder_List_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SwitchableCruder_List_OngoingVerification struct {
type MockSwitchableCruder_List_OngoingVerification struct {
mock *MockSwitchableCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *SwitchableCruder_List_OngoingVerification) GetCapturedArguments() string {
func (c *MockSwitchableCruder_List_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *SwitchableCruder_List_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockSwitchableCruder_List_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -347,40 +354,40 @@ func (c *SwitchableCruder_List_OngoingVerification) GetAllCapturedArguments() (_
return
}
func (verifier *VerifierSwitchableCruder) MustCurrentContextName() *SwitchableCruder_MustCurrentContextName_OngoingVerification {
func (verifier *VerifierMockSwitchableCruder) MustCurrentContextName() *MockSwitchableCruder_MustCurrentContextName_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "MustCurrentContextName", params, verifier.timeout)
return &SwitchableCruder_MustCurrentContextName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSwitchableCruder_MustCurrentContextName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SwitchableCruder_MustCurrentContextName_OngoingVerification struct {
type MockSwitchableCruder_MustCurrentContextName_OngoingVerification struct {
mock *MockSwitchableCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *SwitchableCruder_MustCurrentContextName_OngoingVerification) GetCapturedArguments() {
func (c *MockSwitchableCruder_MustCurrentContextName_OngoingVerification) GetCapturedArguments() {
}
func (c *SwitchableCruder_MustCurrentContextName_OngoingVerification) GetAllCapturedArguments() {
func (c *MockSwitchableCruder_MustCurrentContextName_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierSwitchableCruder) SetFieldSelector(_param0 string) *SwitchableCruder_SetFieldSelector_OngoingVerification {
func (verifier *VerifierMockSwitchableCruder) SetFieldSelector(_param0 string) *MockSwitchableCruder_SetFieldSelector_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SetFieldSelector", params, verifier.timeout)
return &SwitchableCruder_SetFieldSelector_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSwitchableCruder_SetFieldSelector_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SwitchableCruder_SetFieldSelector_OngoingVerification struct {
type MockSwitchableCruder_SetFieldSelector_OngoingVerification struct {
mock *MockSwitchableCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *SwitchableCruder_SetFieldSelector_OngoingVerification) GetCapturedArguments() string {
func (c *MockSwitchableCruder_SetFieldSelector_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *SwitchableCruder_SetFieldSelector_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockSwitchableCruder_SetFieldSelector_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -391,23 +398,23 @@ func (c *SwitchableCruder_SetFieldSelector_OngoingVerification) GetAllCapturedAr
return
}
func (verifier *VerifierSwitchableCruder) SetLabelSelector(_param0 string) *SwitchableCruder_SetLabelSelector_OngoingVerification {
func (verifier *VerifierMockSwitchableCruder) SetLabelSelector(_param0 string) *MockSwitchableCruder_SetLabelSelector_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SetLabelSelector", params, verifier.timeout)
return &SwitchableCruder_SetLabelSelector_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSwitchableCruder_SetLabelSelector_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SwitchableCruder_SetLabelSelector_OngoingVerification struct {
type MockSwitchableCruder_SetLabelSelector_OngoingVerification struct {
mock *MockSwitchableCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *SwitchableCruder_SetLabelSelector_OngoingVerification) GetCapturedArguments() string {
func (c *MockSwitchableCruder_SetLabelSelector_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *SwitchableCruder_SetLabelSelector_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockSwitchableCruder_SetLabelSelector_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -418,23 +425,23 @@ func (c *SwitchableCruder_SetLabelSelector_OngoingVerification) GetAllCapturedAr
return
}
func (verifier *VerifierSwitchableCruder) Switch(_param0 string) *SwitchableCruder_Switch_OngoingVerification {
func (verifier *VerifierMockSwitchableCruder) Switch(_param0 string) *MockSwitchableCruder_Switch_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Switch", params, verifier.timeout)
return &SwitchableCruder_Switch_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSwitchableCruder_Switch_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SwitchableCruder_Switch_OngoingVerification struct {
type MockSwitchableCruder_Switch_OngoingVerification struct {
mock *MockSwitchableCruder
methodInvocations []pegomock.MethodInvocation
}
func (c *SwitchableCruder_Switch_OngoingVerification) GetCapturedArguments() string {
func (c *MockSwitchableCruder_Switch_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *SwitchableCruder_Switch_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockSwitchableCruder_Switch_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))

216
internal/resource/np.go Normal file
View File

@ -0,0 +1,216 @@
package resource
import (
"fmt"
"strings"
"github.com/derailed/k9s/internal/k8s"
"github.com/rs/zerolog/log"
v1beta1 "k8s.io/api/extensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// NetworkPolicy tracks a kubernetes resource.
type NetworkPolicy struct {
*Base
instance *v1beta1.NetworkPolicy
}
// NewNetworkPolicyList returns a new resource list.
func NewNetworkPolicyList(c Connection, ns string) List {
return NewList(
ns,
"np",
NewNetworkPolicy(c),
AllVerbsAccess|DescribeAccess,
)
}
// NewNetworkPolicy instantiates a new NetworkPolicy.
func NewNetworkPolicy(c Connection) *NetworkPolicy {
ds := &NetworkPolicy{&Base{Connection: c, Resource: k8s.NewNetworkPolicy(c)}, nil}
ds.Factory = ds
return ds
}
// New builds a new NetworkPolicy instance from a k8s resource.
func (r *NetworkPolicy) New(i interface{}) Columnar {
c := NewNetworkPolicy(r.Connection)
switch instance := i.(type) {
case *v1beta1.NetworkPolicy:
c.instance = instance
case v1beta1.NetworkPolicy:
c.instance = &instance
default:
log.Fatal().Msgf("unknown NetworkPolicy type %#v", i)
}
c.path = c.namespacedName(c.instance.ObjectMeta)
return c
}
// Marshal resource to yaml.
func (r *NetworkPolicy) Marshal(path string) (string, error) {
ns, n := Namespaced(path)
i, err := r.Resource.Get(ns, n)
if err != nil {
return "", err
}
ds := i.(*v1beta1.NetworkPolicy)
ds.TypeMeta.APIVersion = "extensions/v1beta1"
ds.TypeMeta.Kind = "NetworkPolicy"
return r.marshalObject(ds)
}
// Header return resource header.
func (*NetworkPolicy) Header(ns string) Row {
hh := Row{}
if ns == AllNamespaces {
hh = append(hh, "NAMESPACE")
}
hh = append(hh, "NAME", "ING-SELECTOR", "ING-PORTS", "ING-BLOCK", "EGR-SELECTOR", "EGR-PORTS", "EGR-BLOCK", "AGE")
return hh
}
// Fields retrieves displayable fields.
func (r *NetworkPolicy) Fields(ns string) Row {
ff := make([]string, 0, len(r.Header(ns)))
i := r.instance
if ns == AllNamespaces {
ff = append(ff, i.Namespace)
}
ip, is, ib := ingress(i.Spec.Ingress)
ep, es, eb := egress(i.Spec.Egress)
return append(ff,
i.Name,
is,
ip,
ib,
es,
ep,
eb,
toAge(i.ObjectMeta.CreationTimestamp),
)
}
// Helpers...
func ingress(ii []v1beta1.NetworkPolicyIngressRule) (string, string, string) {
var ports, sels, blocks []string
for _, i := range ii {
if p := portsToStr(i.Ports); p != "" {
ports = append(ports, p)
}
ll, pp := peersToStr(i.From)
if ll != "" {
sels = append(sels, ll)
}
if pp != "" {
blocks = append(blocks, pp)
}
}
return strings.Join(ports, ","), strings.Join(sels, ","), strings.Join(blocks, ",")
}
func egress(ee []v1beta1.NetworkPolicyEgressRule) (string, string, string) {
var ports, sels, blocks []string
for _, e := range ee {
if p := portsToStr(e.Ports); p != "" {
ports = append(ports, p)
}
ll, pp := peersToStr(e.To)
if ll != "" {
sels = append(sels, ll)
}
if pp != "" {
blocks = append(blocks, pp)
}
}
return strings.Join(ports, ","), strings.Join(sels, ","), strings.Join(blocks, ",")
}
func portsToStr(pp []v1beta1.NetworkPolicyPort) string {
ports := make([]string, 0, len(pp))
for _, p := range pp {
ports = append(ports, string(*p.Protocol)+":"+p.Port.String())
}
return strings.Join(ports, ",")
}
func peersToStr(pp []v1beta1.NetworkPolicyPeer) (string, string) {
sels := make([]string, 0, len(pp))
ips := make([]string, 0, len(pp))
for _, p := range pp {
if peer := renderPeer(p); peer != "" {
sels = append(sels, peer)
}
if p.IPBlock == nil {
continue
}
if b := renderBlock(p.IPBlock); b != "" {
ips = append(ips, b)
}
}
return strings.Join(sels, ","), strings.Join(ips, ",")
}
func renderBlock(b *v1beta1.IPBlock) string {
s := b.CIDR
if len(b.Except) == 0 {
return s
}
e, more := b.Except, false
if len(b.Except) > 2 {
e, more = e[:2], true
}
if more {
return s + "[" + strings.Join(e, ",") + "...]"
}
return s + "[" + strings.Join(b.Except, ",") + "]"
}
func renderPeer(i v1beta1.NetworkPolicyPeer) string {
var s string
if i.PodSelector != nil {
if m := mapToStr(i.PodSelector.MatchLabels); m != "" {
s += "po:" + m
}
if e := expToStr(i.PodSelector.MatchExpressions); e != "" {
s += "--" + e
}
}
if i.NamespaceSelector != nil {
if m := mapToStr(i.NamespaceSelector.MatchLabels); m != "" {
s += "ns:" + m
}
if e := expToStr(i.NamespaceSelector.MatchExpressions); e != "" {
s += "--" + e
}
}
return s
}
func expToStr(ee []metav1.LabelSelectorRequirement) string {
ss := make([]string, len(ee))
for i, e := range ee {
ss[i] = labToStr(e)
}
return strings.Join(ss, ",")
}
func labToStr(e metav1.LabelSelectorRequirement) string {
return fmt.Sprintf("%s-%s%s", e.Key, e.Operator, strings.Join(e.Values, ","))
}

View File

@ -111,7 +111,7 @@ func (v *aliasView) hydrate() resource.TableData {
aliasCmds(v.app.Conn(), cmds)
data := resource.TableData{
Header: resource.Row{"NAME", "RESOURCE", "APIGROUP"},
Header: resource.Row{"ALIAS", "RESOURCE", "APIGROUP"},
Rows: make(resource.RowEvents, len(cmds)),
Namespace: resource.NotNamespaced,
}

View File

@ -13,6 +13,6 @@ func TestAliasView(t *testing.T) {
v.Init(nil, "")
assert.Equal(t, 3, len(td.Header))
assert.Equal(t, 31, len(td.Rows))
assert.Equal(t, 32, len(td.Rows))
assert.Equal(t, "Aliases", v.getTitle())
}

View File

@ -42,6 +42,7 @@ type (
setColorerFn(ui.ColorerFunc)
setDecorateFn(decorateFn)
setExtraActionsFn(ui.ActionsFunc)
masterPage() *tableView
}
appView struct {

View File

@ -142,7 +142,7 @@ func fetchResources(app *appView) (k8s.Collection, k8s.Collection, error) {
func (v *clusterInfoView) refreshMetrics(cluster *resource.Cluster, row int) {
nos, nmx, err := fetchResources(v.app)
if err != nil {
log.Warn().Err(err).Msg("NodeMetrics")
log.Warn().Msgf("NodeMetrics %#v", err)
return
}

View File

@ -76,6 +76,7 @@ func (v *detailsView) bindKeys() {
tcell.KeyEscape: ui.NewKeyAction("Back", v.backCmd, true),
tcell.KeyTab: ui.NewKeyAction("Next Match", v.nextCmd, false),
tcell.KeyBacktab: ui.NewKeyAction("Previous Match", v.prevCmd, false),
tcell.KeyCtrlS: ui.NewKeyAction("Save", v.saveCmd, true),
}
}
@ -101,6 +102,15 @@ func (v *detailsView) keyboard(evt *tcell.EventKey) *tcell.EventKey {
return evt
}
func (v *detailsView) saveCmd(evt *tcell.EventKey) *tcell.EventKey {
if path, err := saveYAML(v.app.Config.K9s.CurrentCluster, v.title, v.GetText(true)); err != nil {
v.app.Flash().Err(err)
} else {
v.app.Flash().Infof("Log %s saved successfully!", path)
}
return nil
}
func (v *detailsView) backCmd(evt *tcell.EventKey) *tcell.EventKey {
if !v.cmdBuff.Empty() {
v.cmdBuff.Reset()

View File

@ -54,6 +54,10 @@ func newDumpView(_ string, app *appView, _ resource.List) resourceViewer {
return &v
}
func (v *dumpView) masterPage() *tableView {
return v.GetPrimitive("table").(*tableView)
}
func (v *dumpView) setEnterFn(enterFn) {}
func (v *dumpView) setColorerFn(ui.ColorerFunc) {}
func (v *dumpView) setDecorateFn(decorateFn) {}

View File

@ -50,6 +50,10 @@ func newForwardView(ns string, app *appView, list resource.List) resourceViewer
return &v
}
func (v *forwardView) masterPage() *tableView {
return v.GetPrimitive("table").(*tableView)
}
func (v *forwardView) setEnterFn(enterFn) {}
func (v *forwardView) setColorerFn(ui.ColorerFunc) {}
func (v *forwardView) setDecorateFn(decorateFn) {}

View File

@ -88,7 +88,7 @@ func (v *helpView) showHelp() ui.Hints {
func (v *helpView) showNav() ui.Hints {
return ui.Hints{
{"g", "Goto Top"},
{"G", "Goto Bottom"},
{"Shift-g", "Goto Bottom"},
{"Ctrl-b", "Page Down"},
{"Ctrl-f", "Page Up"},
{"h", "Left"},

View File

@ -52,8 +52,9 @@ func showPods(app *appView, ns, labelSel, fieldSel string, a ui.ActionHandler) {
pv := newPodView("Pods", app, list)
pv.setColorerFn(podColorer)
pv.setExtraActionsFn(func(aa ui.KeyActions) {
aa[tcell.KeyEsc] = ui.NewKeyAction("Back", a, true)
// pv.setExtraActionsFn(func(aa ui.KeyActions) {
pv.masterPage().SetActions(ui.KeyActions{
tcell.KeyEsc: ui.NewKeyAction("Back", a, true),
})
// Reset active namespace to all.
app.Config.SetActiveNamespace(ns)

View File

@ -15,7 +15,7 @@ import (
const (
containerFmt = "[fg:bg:b]%s([hilite:bg:b]%s[fg:bg:-])"
shellCheck = "command -v bash >/dev/null && exec bash || exec sh"
shellCheck = "command -v bash >/dev/null && bash || sh"
)
type podView struct {

View File

@ -1,6 +1,8 @@
package views
import (
"strings"
"github.com/derailed/k9s/internal/k8s"
"github.com/derailed/k9s/internal/resource"
"github.com/derailed/k9s/internal/ui"
@ -89,6 +91,13 @@ func showRBAC(app *appView, ns, resource, selection string) {
app.inject(newRBACView(app, ns, selection, kind))
}
func showCRD(app *appView, ns, resource, selection string) {
log.Debug().Msgf("Launching CRD %q -- %q -- %q", ns, resource, selection)
tokens := strings.Split(selection, ".")
app.gotoResource(tokens[0], true)
}
func showClusterRole(app *appView, ns, resource, selection string) {
crb, err := app.Conn().DialOrDie().RbacV1().ClusterRoleBindings().Get(selection, metav1.GetOptions{})
if err != nil {
@ -345,8 +354,17 @@ func apiExtRes(m map[string]resCmd) {
crdCmd: crdCmd{
api: "apiextensions.k8s.io",
},
viewFn: newResourceView,
listFn: resource.NewCustomResourceDefinitionList,
enterFn: showCRD,
}
m["np"] = resCmd{
title: "NetworkPolicies",
crdCmd: crdCmd{
api: "apiextensions.k8s.io",
},
viewFn: newResourceView,
listFn: resource.NewCustomResourceDefinitionList,
listFn: resource.NewNetworkPolicyList,
}
}

View File

@ -3,6 +3,7 @@ package views
import (
"fmt"
"strconv"
"strings"
"github.com/derailed/k9s/internal/resource"
"github.com/derailed/k9s/internal/ui"
@ -67,7 +68,8 @@ func (v *scalableResourceView) showScaleDialog(resourceType string, resourceName
func (v *scalableResourceView) createScaleForm() *tview.Form {
f := v.createStyledForm()
replicas := "1"
tv := v.masterPage()
replicas := strings.TrimSpace(tv.GetCell(tv.GetSelectedRow(), tv.NameColIndex()+1).Text)
f.AddInputField("Replicas:", replicas, 4, func(textToCheck string, lastChar rune) bool {
_, err := strconv.Atoi(textToCheck)
return err == nil

View File

@ -81,6 +81,10 @@ func (v *subjectView) Init(c context.Context, _ string) {
}
func (v *subjectView) masterPage() *tableView {
return v.tableView
}
func (v *subjectView) bindKeys() {
// No time data or ns
v.RmAction(ui.KeyShiftA)

View File

@ -2,10 +2,14 @@ package views
import (
"fmt"
"os"
"path/filepath"
"regexp"
"strings"
"time"
"github.com/derailed/k9s/internal/config"
"github.com/rs/zerolog/log"
)
var (
@ -50,3 +54,31 @@ func colorizeYAML(style config.Yaml, raw string) string {
return strings.Join(buff, "\n")
}
func saveYAML(cluster, name, data string) (string, error) {
dir := filepath.Join(config.K9sDumpDir, cluster)
if err := ensureDir(dir); err != nil {
return "", err
}
now := time.Now().UnixNano()
fName := fmt.Sprintf("%s-%d.yml", strings.Replace(name, "/", "-", -1), now)
path := filepath.Join(dir, fName)
mod := os.O_CREATE | os.O_WRONLY
file, err := os.OpenFile(path, mod, 0644)
defer func() {
if file != nil {
file.Close()
}
}()
if err != nil {
log.Error().Err(err).Msgf("YAML create %s", path)
return "", nil
}
if _, err := fmt.Fprintf(file, data); err != nil {
return "", err
}
return path, nil
}

View File

@ -70,6 +70,7 @@ func NewInformer(client k8s.Connection, ns string) (*Informer, error) {
}
if err := client.CheckNSAccess(ns); err != nil {
log.Error().Err(err).Msg("Checking NS Access")
return nil, err
}
@ -80,19 +81,39 @@ func NewInformer(client k8s.Connection, ns string) (*Informer, error) {
func (i *Informer) init(ns string) {
log.Debug().Msgf(">>>>> Starting Informer in namespace %q", ns)
if ok, err := i.client.CanIAccess(ns, "pods.v1.", []string{"list", "watch"}); ok && err == nil {
log.Debug().Msgf("Pod access granted!")
} else {
log.Debug().Msgf("No pod access! %t -- %#v", ok, err)
}
i.initOnce.Do(func() {
po := NewPod(i.client, ns)
i.informers = map[string]StoreInformer{
PodIndex: po,
ContainerIndex: NewContainer(po),
}
i.informers[NodeIndex] = NewNode(i.client)
if ok, err := i.client.CanIAccess(ns, "nodes.v1.", []string{"list", "watch"}); ok && err == nil {
log.Debug().Msgf("CanI access nodes %t -- %#v", ok, err)
i.informers[NodeIndex] = NewNode(i.client)
} else {
log.Debug().Msgf("No node access! %t -- %#v", ok, err)
}
if !i.client.HasMetrics() {
return
}
i.informers[NodeMXIndex] = NewNodeMetrics(i.client)
i.informers[PodMXIndex] = NewPodMetrics(i.client, ns)
if ok, err := i.client.CanIAccess(ns, "nodes.v1beta1.metrics.k8s.io", []string{"list", "watch"}); ok && err == nil {
i.informers[NodeMXIndex] = NewNodeMetrics(i.client)
} else {
log.Debug().Msg("No node metrics access!")
}
if ok, err := i.client.CanIAccess(ns, "pods.v1beta1.metrics.k8s.io", []string{"list", "watch"}); ok && err == nil {
i.informers[PodMXIndex] = NewPodMetrics(i.client, ns)
} else {
log.Debug().Msgf("No pod metrics access! %t -- %#v", ok, err)
}
})
}

View File

@ -48,6 +48,7 @@ func TestInformerInitWithNS(t *testing.T) {
m.When(cmo.Config()).ThenReturn(k8s.NewConfig(f))
m.When(cmo.HasMetrics()).ThenReturn(true)
m.When(cmo.CheckNSAccess(ns)).ThenReturn(nil)
m.When(cmo.CanIAccess(ns, "pods.v1", []string{"list", "watch"})).ThenReturn(true, nil)
i, err := NewInformer(cmo, ns)
assert.NilError(t, err)

View File

@ -4,6 +4,9 @@
package watch
import (
"reflect"
"time"
k8s "github.com/derailed/k9s/internal/k8s"
pegomock "github.com/petergtz/pegomock"
v1 "k8s.io/api/core/v1"
@ -12,8 +15,6 @@ import (
kubernetes "k8s.io/client-go/kubernetes"
rest "k8s.io/client-go/rest"
versioned "k8s.io/metrics/pkg/client/clientset/versioned"
"reflect"
"time"
)
type MockConnection struct {
@ -21,7 +22,30 @@ type MockConnection struct {
}
func NewMockConnection() *MockConnection {
return &MockConnection{fail: pegomock.GlobalFailHandler}
mock := &MockConnection{}
return mock
}
func (mock *MockConnection) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockConnection) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockConnection) CanIAccess(_param0 string, _param1 string, _param2 []string) (bool, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockConnection().")
}
params := []pegomock.Param{_param0, _param1, _param2}
result := pegomock.GetGenericMockFrom(mock).Invoke("CanIAccess", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 bool
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(bool)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockConnection) CheckListNSAccess() error {
@ -319,77 +343,112 @@ func (mock *MockConnection) ValidNamespaces() ([]v1.Namespace, error) {
return ret0, ret1
}
func (mock *MockConnection) VerifyWasCalledOnce() *VerifierConnection {
return &VerifierConnection{
func (mock *MockConnection) VerifyWasCalledOnce() *VerifierMockConnection {
return &VerifierMockConnection{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockConnection) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierConnection {
return &VerifierConnection{
func (mock *MockConnection) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockConnection {
return &VerifierMockConnection{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockConnection) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierConnection {
return &VerifierConnection{
func (mock *MockConnection) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockConnection {
return &VerifierMockConnection{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockConnection) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierConnection {
return &VerifierConnection{
func (mock *MockConnection) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockConnection {
return &VerifierMockConnection{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierConnection struct {
type VerifierMockConnection struct {
mock *MockConnection
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierConnection) CheckListNSAccess() *Connection_CheckListNSAccess_OngoingVerification {
func (verifier *VerifierMockConnection) CanIAccess(_param0 string, _param1 string, _param2 []string) *MockConnection_CanIAccess_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CanIAccess", params, verifier.timeout)
return &MockConnection_CanIAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockConnection_CanIAccess_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *MockConnection_CanIAccess_OngoingVerification) GetCapturedArguments() (string, string, []string) {
_param0, _param1, _param2 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1]
}
func (c *MockConnection_CanIAccess_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 [][]string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
for u, param := range params[0] {
_param0[u] = param.(string)
}
_param1 = make([]string, len(params[1]))
for u, param := range params[1] {
_param1[u] = param.(string)
}
_param2 = make([][]string, len(params[2]))
for u, param := range params[2] {
_param2[u] = param.([]string)
}
}
return
}
func (verifier *VerifierMockConnection) CheckListNSAccess() *MockConnection_CheckListNSAccess_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CheckListNSAccess", params, verifier.timeout)
return &Connection_CheckListNSAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_CheckListNSAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_CheckListNSAccess_OngoingVerification struct {
type MockConnection_CheckListNSAccess_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_CheckListNSAccess_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_CheckListNSAccess_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_CheckListNSAccess_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_CheckListNSAccess_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) CheckNSAccess(_param0 string) *Connection_CheckNSAccess_OngoingVerification {
func (verifier *VerifierMockConnection) CheckNSAccess(_param0 string) *MockConnection_CheckNSAccess_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CheckNSAccess", params, verifier.timeout)
return &Connection_CheckNSAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_CheckNSAccess_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_CheckNSAccess_OngoingVerification struct {
type MockConnection_CheckNSAccess_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_CheckNSAccess_OngoingVerification) GetCapturedArguments() string {
func (c *MockConnection_CheckNSAccess_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Connection_CheckNSAccess_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockConnection_CheckNSAccess_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -400,125 +459,125 @@ func (c *Connection_CheckNSAccess_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierConnection) Config() *Connection_Config_OngoingVerification {
func (verifier *VerifierMockConnection) Config() *MockConnection_Config_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Config", params, verifier.timeout)
return &Connection_Config_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_Config_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_Config_OngoingVerification struct {
type MockConnection_Config_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_Config_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_Config_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_Config_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_Config_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) CurrentNamespaceName() *Connection_CurrentNamespaceName_OngoingVerification {
func (verifier *VerifierMockConnection) CurrentNamespaceName() *MockConnection_CurrentNamespaceName_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CurrentNamespaceName", params, verifier.timeout)
return &Connection_CurrentNamespaceName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_CurrentNamespaceName_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_CurrentNamespaceName_OngoingVerification struct {
type MockConnection_CurrentNamespaceName_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_CurrentNamespaceName_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_CurrentNamespaceName_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_CurrentNamespaceName_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_CurrentNamespaceName_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) DialOrDie() *Connection_DialOrDie_OngoingVerification {
func (verifier *VerifierMockConnection) DialOrDie() *MockConnection_DialOrDie_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DialOrDie", params, verifier.timeout)
return &Connection_DialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_DialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_DialOrDie_OngoingVerification struct {
type MockConnection_DialOrDie_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_DialOrDie_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_DialOrDie_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_DialOrDie_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_DialOrDie_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) DynDialOrDie() *Connection_DynDialOrDie_OngoingVerification {
func (verifier *VerifierMockConnection) DynDialOrDie() *MockConnection_DynDialOrDie_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DynDialOrDie", params, verifier.timeout)
return &Connection_DynDialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_DynDialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_DynDialOrDie_OngoingVerification struct {
type MockConnection_DynDialOrDie_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_DynDialOrDie_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_DynDialOrDie_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_DynDialOrDie_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_DynDialOrDie_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) FetchNodes() *Connection_FetchNodes_OngoingVerification {
func (verifier *VerifierMockConnection) FetchNodes() *MockConnection_FetchNodes_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "FetchNodes", params, verifier.timeout)
return &Connection_FetchNodes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_FetchNodes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_FetchNodes_OngoingVerification struct {
type MockConnection_FetchNodes_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_FetchNodes_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_FetchNodes_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_FetchNodes_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_FetchNodes_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) HasMetrics() *Connection_HasMetrics_OngoingVerification {
func (verifier *VerifierMockConnection) HasMetrics() *MockConnection_HasMetrics_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "HasMetrics", params, verifier.timeout)
return &Connection_HasMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_HasMetrics_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_HasMetrics_OngoingVerification struct {
type MockConnection_HasMetrics_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_HasMetrics_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_HasMetrics_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_HasMetrics_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_HasMetrics_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) IsNamespaced(_param0 string) *Connection_IsNamespaced_OngoingVerification {
func (verifier *VerifierMockConnection) IsNamespaced(_param0 string) *MockConnection_IsNamespaced_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "IsNamespaced", params, verifier.timeout)
return &Connection_IsNamespaced_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_IsNamespaced_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_IsNamespaced_OngoingVerification struct {
type MockConnection_IsNamespaced_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_IsNamespaced_OngoingVerification) GetCapturedArguments() string {
func (c *MockConnection_IsNamespaced_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Connection_IsNamespaced_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockConnection_IsNamespaced_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -529,57 +588,57 @@ func (c *Connection_IsNamespaced_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierConnection) MXDial() *Connection_MXDial_OngoingVerification {
func (verifier *VerifierMockConnection) MXDial() *MockConnection_MXDial_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "MXDial", params, verifier.timeout)
return &Connection_MXDial_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_MXDial_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_MXDial_OngoingVerification struct {
type MockConnection_MXDial_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_MXDial_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_MXDial_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_MXDial_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_MXDial_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) NSDialOrDie() *Connection_NSDialOrDie_OngoingVerification {
func (verifier *VerifierMockConnection) NSDialOrDie() *MockConnection_NSDialOrDie_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "NSDialOrDie", params, verifier.timeout)
return &Connection_NSDialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_NSDialOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_NSDialOrDie_OngoingVerification struct {
type MockConnection_NSDialOrDie_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_NSDialOrDie_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_NSDialOrDie_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_NSDialOrDie_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_NSDialOrDie_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) NodePods(_param0 string) *Connection_NodePods_OngoingVerification {
func (verifier *VerifierMockConnection) NodePods(_param0 string) *MockConnection_NodePods_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "NodePods", params, verifier.timeout)
return &Connection_NodePods_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_NodePods_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_NodePods_OngoingVerification struct {
type MockConnection_NodePods_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_NodePods_OngoingVerification) GetCapturedArguments() string {
func (c *MockConnection_NodePods_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Connection_NodePods_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockConnection_NodePods_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -590,57 +649,57 @@ func (c *Connection_NodePods_OngoingVerification) GetAllCapturedArguments() (_pa
return
}
func (verifier *VerifierConnection) RestConfigOrDie() *Connection_RestConfigOrDie_OngoingVerification {
func (verifier *VerifierMockConnection) RestConfigOrDie() *MockConnection_RestConfigOrDie_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "RestConfigOrDie", params, verifier.timeout)
return &Connection_RestConfigOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_RestConfigOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_RestConfigOrDie_OngoingVerification struct {
type MockConnection_RestConfigOrDie_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_RestConfigOrDie_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_RestConfigOrDie_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_RestConfigOrDie_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_RestConfigOrDie_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) ServerVersion() *Connection_ServerVersion_OngoingVerification {
func (verifier *VerifierMockConnection) ServerVersion() *MockConnection_ServerVersion_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ServerVersion", params, verifier.timeout)
return &Connection_ServerVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_ServerVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_ServerVersion_OngoingVerification struct {
type MockConnection_ServerVersion_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_ServerVersion_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_ServerVersion_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_ServerVersion_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_ServerVersion_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierConnection) SupportsRes(_param0 string, _param1 []string) *Connection_SupportsRes_OngoingVerification {
func (verifier *VerifierMockConnection) SupportsRes(_param0 string, _param1 []string) *MockConnection_SupportsRes_OngoingVerification {
params := []pegomock.Param{_param0, _param1}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SupportsRes", params, verifier.timeout)
return &Connection_SupportsRes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_SupportsRes_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_SupportsRes_OngoingVerification struct {
type MockConnection_SupportsRes_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_SupportsRes_OngoingVerification) GetCapturedArguments() (string, []string) {
func (c *MockConnection_SupportsRes_OngoingVerification) GetCapturedArguments() (string, []string) {
_param0, _param1 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1]
}
func (c *Connection_SupportsRes_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]string) {
func (c *MockConnection_SupportsRes_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -655,23 +714,23 @@ func (c *Connection_SupportsRes_OngoingVerification) GetAllCapturedArguments() (
return
}
func (verifier *VerifierConnection) SupportsResource(_param0 string) *Connection_SupportsResource_OngoingVerification {
func (verifier *VerifierMockConnection) SupportsResource(_param0 string) *MockConnection_SupportsResource_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SupportsResource", params, verifier.timeout)
return &Connection_SupportsResource_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_SupportsResource_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_SupportsResource_OngoingVerification struct {
type MockConnection_SupportsResource_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_SupportsResource_OngoingVerification) GetCapturedArguments() string {
func (c *MockConnection_SupportsResource_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Connection_SupportsResource_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockConnection_SupportsResource_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -682,23 +741,23 @@ func (c *Connection_SupportsResource_OngoingVerification) GetAllCapturedArgument
return
}
func (verifier *VerifierConnection) SwitchContextOrDie(_param0 string) *Connection_SwitchContextOrDie_OngoingVerification {
func (verifier *VerifierMockConnection) SwitchContextOrDie(_param0 string) *MockConnection_SwitchContextOrDie_OngoingVerification {
params := []pegomock.Param{_param0}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SwitchContextOrDie", params, verifier.timeout)
return &Connection_SwitchContextOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_SwitchContextOrDie_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_SwitchContextOrDie_OngoingVerification struct {
type MockConnection_SwitchContextOrDie_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_SwitchContextOrDie_OngoingVerification) GetCapturedArguments() string {
func (c *MockConnection_SwitchContextOrDie_OngoingVerification) GetCapturedArguments() string {
_param0 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1]
}
func (c *Connection_SwitchContextOrDie_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockConnection_SwitchContextOrDie_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@ -709,19 +768,19 @@ func (c *Connection_SwitchContextOrDie_OngoingVerification) GetAllCapturedArgume
return
}
func (verifier *VerifierConnection) ValidNamespaces() *Connection_ValidNamespaces_OngoingVerification {
func (verifier *VerifierMockConnection) ValidNamespaces() *MockConnection_ValidNamespaces_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ValidNamespaces", params, verifier.timeout)
return &Connection_ValidNamespaces_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockConnection_ValidNamespaces_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Connection_ValidNamespaces_OngoingVerification struct {
type MockConnection_ValidNamespaces_OngoingVerification struct {
mock *MockConnection
methodInvocations []pegomock.MethodInvocation
}
func (c *Connection_ValidNamespaces_OngoingVerification) GetCapturedArguments() {
func (c *MockConnection_ValidNamespaces_OngoingVerification) GetCapturedArguments() {
}
func (c *Connection_ValidNamespaces_OngoingVerification) GetAllCapturedArguments() {
func (c *MockConnection_ValidNamespaces_OngoingVerification) GetAllCapturedArguments() {
}