Add NetworkInspect to DockerAPI
This commit is contained in:
@@ -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())
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user