Example #1
0
		logger        *lagertest.TestLogger

		killer *runrunc.Killer
	)

	BeforeEach(func() {
		runcBinary = new(fakes.FakeRuncBinary)
		commandRunner = fake_command_runner.New()
		runner = new(fakes.FakeRuncCmdRunner)
		logger = lagertest.NewTestLogger("test")

		killer = runrunc.NewKiller(runner, runcBinary)

		runcBinary.KillCommandStub = func(id, signal, logFile string) *exec.Cmd {
			return exec.Command("funC", "--log", logFile, "kill", id, signal)
		}

		runner.RunAndLogStub = func(_ lager.Logger, fn runrunc.LoggingCmd) error {
			return commandRunner.Run(fn("potato.log"))
		}
	})

	It("runs 'runc kill' in the container directory using the logging runner", func() {
		Expect(killer.Kill(logger, "some-container")).To(Succeed())
		Expect(commandRunner).To(HaveExecutedSerially(fake_command_runner.CommandSpec{
			Path: "funC",
			Args: []string{"--log", "potato.log", "kill", "some-container", "KILL"},
		}))
	})
})