func (r *registry) registerControls() { controls.Register(StopContainer, captureContainerID(r.stopContainer)) controls.Register(StartContainer, captureContainerID(r.startContainer)) controls.Register(RestartContainer, captureContainerID(r.restartContainer)) controls.Register(PauseContainer, captureContainerID(r.pauseContainer)) controls.Register(UnpauseContainer, captureContainerID(r.unpauseContainer)) controls.Register(RemoveContainer, captureContainerID(r.removeContainer)) controls.Register(AttachContainer, captureContainerID(r.attachContainer)) controls.Register(ExecContainer, captureContainerID(r.execContainer)) }
func TestControls(t *testing.T) { controls.Register("foo", func(req xfer.Request) xfer.Response { return xfer.Response{ Value: "bar", } }) defer controls.Rm("foo") want := xfer.Response{ Value: "bar", } have := controls.HandleControlRequest(xfer.Request{ Control: "foo", }) if !reflect.DeepEqual(want, have) { t.Fatal(test.Diff(want, have)) } }
func (r *Reporter) registerControls() { controls.Register(GetLogs, r.CapturePod(r.GetLogs)) controls.Register(DeletePod, r.CapturePod(r.deletePod)) controls.Register(ScaleUp, r.CaptureResource(r.ScaleUp)) controls.Register(ScaleDown, r.CaptureResource(r.ScaleDown)) }
func (r *Reporter) registerControls() { controls.Register(ExecHost, r.execHost) }