From 5ae32837f778ba1f88e4d56f1ce5c1ee86b5f70e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 12 Jun 2018 15:06:36 +0200 Subject: [PATCH] agent/proxy: set the proper arguments so we only run the helper process --- agent/proxy/manager_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/agent/proxy/manager_test.go b/agent/proxy/manager_test.go index 19ba42139a..22c3b73305 100644 --- a/agent/proxy/manager_test.go +++ b/agent/proxy/manager_test.go @@ -368,6 +368,14 @@ func testManager(t *testing.T) (*Manager, func()) { // (expected to be from the helperProcess function call). It returns the // ID for deregistration. func testStateProxy(t *testing.T, state *local.State, service string, cmd *exec.Cmd) string { + // *exec.Cmd must manually set args[0] to the binary. We automatically + // set this when constructing the command for the proxy, so we must strip + // the zero index. We do this unconditionally (anytime len is > 0) because + // index zero should ALWAYS be the binary. + if len(cmd.Args) > 0 { + cmd.Args = cmd.Args[1:] + } + command := []string{cmd.Path} command = append(command, cmd.Args...)