//New returns a new Runner ready to be Announced and run tests locally. func New(runner, tracker, hosted string) *Runner { n := &Runner{ tcl: client.New(tracker, http.DefaultClient, client.JsonCodec), base: hosted, runner: runner, rpc: gorpc.NewServer(), rq: rpc.NewRunnerQueue(), resp: make(chan rpc.Output), } //register the run service in the rpc if err := n.rpc.RegisterService(n.rq, ""); err != nil { panic(err) } //register the pinger if err := n.rpc.RegisterService(pinger.Pinger{}, ""); err != nil { panic(err) } //register ourselves in the rpc if err := n.rpc.RegisterService(n, ""); err != nil { panic(err) } //register the codec n.rpc.RegisterCodec(json.NewCodec(), "application/json") //start processing go n.run() return n }
//New returns a new Runner ready to be Announced and run tests on the //heroku dyno grid. func New(app, api string, tracker, hosted string) *Runner { n := &Runner{ app: app, api: api, tcl: client.New(tracker, http.DefaultClient, client.JsonCodec), base: hosted, rpc: gorpc.NewServer(), rq: rpc.NewRunnerQueue(), mc: heroku.NewManaged(app, api, 2, 2*time.Minute), tm: &runnerTaskMap{items: map[string]*runnerTask{}}, } //register the run service in the rpc if err := n.rpc.RegisterService(n.rq, ""); err != nil { panic(err) } //register the pinger if err := n.rpc.RegisterService(pinger.Pinger{}, ""); err != nil { panic(err) } //register ourselves in the rpc if err := n.rpc.RegisterService(n, ""); err != nil { panic(err) } //register the codec n.rpc.RegisterCodec(json.NewCodec(), "application/json") //start processing go n.run() return n }