Allow to set env variables through the API

This commit is contained in:
Marcos Lilljedahl
2020-06-19 08:26:12 -03:00
parent 0810809166
commit 833e71330f
4 changed files with 6 additions and 2 deletions

View File

@@ -171,6 +171,7 @@ func TestInstanceNew_WithNotAllowedImage(t *testing.T) {
ServerKey: nil,
CACert: nil,
Privileged: true,
Envs: []string{"HELLO=WORLD"},
Networks: []string{session.Id},
}
_d.On("ContainerCreate", expectedContainerOpts).Return(nil)
@@ -178,7 +179,7 @@ func TestInstanceNew_WithNotAllowedImage(t *testing.T) {
_s.On("InstancePut", mock.AnythingOfType("*types.Instance")).Return(nil)
_e.M.On("Emit", event.INSTANCE_NEW, "aaaabbbbcccc", []interface{}{"aaaabbbb_aaaabbbbcccc", "10.0.0.1", "node1", "ip10-0-0-1-aaaabbbbcccc"}).Return()
instance, err := p.InstanceNew(session, types.InstanceConfig{ImageName: "redis"})
instance, err := p.InstanceNew(session, types.InstanceConfig{ImageName: "redis", Envs: []string{"HELLO=WORLD"}})
assert.Nil(t, err)
assert.Equal(t, expectedInstance, *instance)

View File

@@ -39,4 +39,5 @@ type InstanceConfig struct {
PlaygroundFQDN string
Type string
DindVolumeSize string
Envs []string
}