When playground is created or modified it emits an event. (#225)

The scheduler listens to playground events and updates it's
configuration immediately.
This commit is contained in:
Jonathan Leibiusky
2017-11-23 13:40:06 -03:00
committed by Marcos Nils
parent 65b8364ef2
commit d758c1a303
4 changed files with 24 additions and 3 deletions

View File

@@ -25,6 +25,8 @@ func TestPlaygroundNew(t *testing.T) {
ipf := provisioner.NewInstanceProvisionerFactory(provisioner.NewWindowsASG(_f, _s), provisioner.NewDinD(_g, _f, _s))
sp := provisioner.NewOverlaySessionProvisioner(_f)
var nilArgs []interface{}
_e.M.On("Emit", event.PLAYGROUND_NEW, uuid.NewV5(uuid.NamespaceOID, "localhost").String(), nilArgs).Return()
_s.On("PlaygroundPut", mock.AnythingOfType("*types.Playground")).Return(nil)
p := NewPWD(_f, _e, _s, sp, ipf)
@@ -52,6 +54,8 @@ func TestPlaygroundGet(t *testing.T) {
_g := &id.MockGenerator{}
_e := &event.Mock{}
var nilArgs []interface{}
_e.M.On("Emit", event.PLAYGROUND_NEW, uuid.NewV5(uuid.NamespaceOID, "localhost").String(), nilArgs).Return()
_s.On("PlaygroundPut", mock.AnythingOfType("*types.Playground")).Return(nil)
ipf := provisioner.NewInstanceProvisionerFactory(provisioner.NewWindowsASG(_f, _s), provisioner.NewDinD(_g, _f, _s))
@@ -86,6 +90,8 @@ func TestPlaygroundFindByDomain(t *testing.T) {
_g := &id.MockGenerator{}
_e := &event.Mock{}
var nilArgs []interface{}
_e.M.On("Emit", event.PLAYGROUND_NEW, uuid.NewV5(uuid.NamespaceOID, "localhost").String(), nilArgs).Return()
_s.On("PlaygroundPut", mock.AnythingOfType("*types.Playground")).Return(nil)
ipf := provisioner.NewInstanceProvisionerFactory(provisioner.NewWindowsASG(_f, _s), provisioner.NewDinD(_g, _f, _s))
@@ -120,6 +126,9 @@ func TestPlaygroundList(t *testing.T) {
_g := &id.MockGenerator{}
_e := &event.Mock{}
var nilArgs []interface{}
_e.M.On("Emit", event.PLAYGROUND_NEW, uuid.NewV5(uuid.NamespaceOID, "localhost1").String(), nilArgs).Return()
_e.M.On("Emit", event.PLAYGROUND_NEW, uuid.NewV5(uuid.NamespaceOID, "localhost2").String(), nilArgs).Return()
_s.On("PlaygroundPut", mock.AnythingOfType("*types.Playground")).Return(nil)
ipf := provisioner.NewInstanceProvisionerFactory(provisioner.NewWindowsASG(_f, _s), provisioner.NewDinD(_g, _f, _s))