Activate kubernetes only when experimental cli is enabled

* Refactor tests on version and kubernetes switch
* Fix rebase errors
* Refactor for gocyclo linter

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
This commit is contained in:
Silvin Lubecki
2017-12-26 15:40:17 +01:00
parent 5d375b348a
commit ad409767bf
11 changed files with 163 additions and 65 deletions

View File

@ -15,6 +15,7 @@ import (
)
type notaryClientFuncType func(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error)
type clientInfoFuncType func() command.ClientInfo
// FakeCli emulates the default DockerCli
type FakeCli struct {
@ -26,6 +27,7 @@ type FakeCli struct {
err *bytes.Buffer
in *command.InStream
server command.ServerInfo
clientInfoFunc clientInfoFuncType
notaryClientFunc notaryClientFuncType
}
@ -88,6 +90,19 @@ func (c *FakeCli) ServerInfo() command.ServerInfo {
return c.server
}
// ClientInfo returns client information
func (c *FakeCli) ClientInfo() command.ClientInfo {
if c.clientInfoFunc != nil {
return c.clientInfoFunc()
}
return c.DockerCli.ClientInfo()
}
// SetClientInfo sets the internal getter for retrieving a ClientInfo
func (c *FakeCli) SetClientInfo(clientInfoFunc clientInfoFuncType) {
c.clientInfoFunc = clientInfoFunc
}
// OutBuffer returns the stdout buffer
func (c *FakeCli) OutBuffer() *bytes.Buffer {
return c.outBuffer