Add NetworkInspect to DockerAPI

This commit is contained in:
Marcos Lilljedahl
2017-08-24 16:45:12 -03:00
parent 1bdda6948e
commit 52d523ac92
2 changed files with 10 additions and 0 deletions

View File

@@ -32,6 +32,7 @@ const (
type DockerApi interface {
CreateNetwork(id string, opts types.NetworkCreate) error
ConnectNetwork(container, network, ip string) (string, error)
NetworkInspect(id string) (types.NetworkResource, error)
GetDaemonInfo() (types.Info, error)
GetDaemonHost() string
GetSwarmPorts() ([]string, []uint16, error)
@@ -99,6 +100,10 @@ func (d *docker) ConnectNetwork(containerId, networkId, ip string) (string, erro
return n.IPAddress, nil
}
func (d *docker) NetworkInspect(id string) (types.NetworkResource, error) {
return d.c.NetworkInspect(context.Background(), id, types.NetworkInspectOptions{})
}
func (d *docker) GetDaemonInfo() (types.Info, error) {
return d.c.Info(context.Background())
}

View File

@@ -23,6 +23,11 @@ func (m *Mock) ConnectNetwork(container, network, ip string) (string, error) {
return args.String(0), args.Error(1)
}
func (m *Mock) NetworkInspect(id string) (types.NetworkResource, error) {
args := m.Called(id)
return args.Get(0).(types.NetworkResource), args.Error(1)
}
func (m *Mock) GetDaemonInfo() (types.Info, error) {
args := m.Called()
return args.Get(0).(types.Info), args.Error(1)