Add network opts to CreateNetwork API

This commit is contained in:
Marcos Lilljedahl
2017-08-24 16:20:32 -03:00
parent 438fe9f6e7
commit 1bdda6948e
6 changed files with 18 additions and 14 deletions

View File

@@ -30,7 +30,7 @@ const (
)
type DockerApi interface {
CreateNetwork(id string) error
CreateNetwork(id string, opts types.NetworkCreate) error
ConnectNetwork(container, network, ip string) (string, error)
GetDaemonInfo() (types.Info, error)
GetDaemonHost() string
@@ -60,8 +60,7 @@ type docker struct {
c *client.Client
}
func (d *docker) CreateNetwork(id string) error {
opts := types.NetworkCreate{Driver: "overlay", Attachable: true}
func (d *docker) CreateNetwork(id string, opts types.NetworkCreate) error {
_, err := d.c.NetworkCreate(context.Background(), id, opts)
if err != nil {

View File

@@ -13,8 +13,8 @@ type Mock struct {
mock.Mock
}
func (m *Mock) CreateNetwork(id string) error {
args := m.Called(id)
func (m *Mock) CreateNetwork(id string, opts types.NetworkCreate) error {
args := m.Called(id, opts)
return args.Error(0)
}