func TestPreConditionNotFound(t *testing.T) { var ctx = NewContext() var svc = api.Service{Name: "Foo", Command: "echo"} var link = api.Link{Name: "test", Alias: "bar"} svc.Links = []*api.Link{&link} deployment := createDeployment(&svc, nil) deployment.name = "TestLink" requirementState(&deployment, &ctx) assert.Equal(t, DEPLOY, deployment.status.code) }
func TestPreConditionFound(t *testing.T) { var ctx = NewContext() var fooMap = make(map[string]string) fooMap["PORT_3306_TCP_PORT"] = "3000" ctx.AddKey("foo", fooMap) var svc = api.Service{Name: "Bar", Command: "echo"} var link = api.Link{Name: "foo", Alias: "bar"} svc.Links = []*api.Link{&link} deployment := createDeployment(&svc, nil) deployment.name = "TestLinked" requirementState(&deployment, &ctx) assert.Equal(t, DEPLOY, deployment.status.code) }