Reimplement terminal connections
This commit is contained in:
@@ -51,6 +51,8 @@ type DockerApi interface {
|
||||
Exec(instanceName string, command []string) (int, error)
|
||||
SwarmInit() (*SwarmTokens, error)
|
||||
SwarmJoin(addr, token string) error
|
||||
ConfigCreate(name string, labels map[string]string, data []byte) error
|
||||
ConfigDelete(name string) error
|
||||
}
|
||||
|
||||
type SwarmTokens struct {
|
||||
@@ -62,6 +64,18 @@ type docker struct {
|
||||
c *client.Client
|
||||
}
|
||||
|
||||
func (d *docker) ConfigCreate(name string, labels map[string]string, data []byte) error {
|
||||
config := swarm.ConfigSpec{}
|
||||
config.Name = name
|
||||
config.Labels = labels
|
||||
config.Data = data
|
||||
_, err := d.c.ConfigCreate(context.Background(), config)
|
||||
return err
|
||||
}
|
||||
func (d *docker) ConfigDelete(name string) error {
|
||||
return d.c.ConfigRemove(context.Background(), name)
|
||||
}
|
||||
|
||||
func (d *docker) CreateNetwork(id string, opts types.NetworkCreate) error {
|
||||
_, err := d.c.NetworkCreate(context.Background(), id, opts)
|
||||
|
||||
|
||||
@@ -104,6 +104,14 @@ func (m *Mock) SwarmJoin(addr, token string) error {
|
||||
args := m.Called(addr, token)
|
||||
return args.Error(0)
|
||||
}
|
||||
func (m *Mock) ConfigCreate(name string, labels map[string]string, data []byte) error {
|
||||
args := m.Called(name, labels, data)
|
||||
return args.Error(0)
|
||||
}
|
||||
func (m *Mock) ConfigDelete(name string) error {
|
||||
args := m.Called(name)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
type MockConn struct {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user