fix fakerunner runcmd unit test
parent
7709c77c8b
commit
9df56183fd
|
@ -49,12 +49,12 @@ func NewFakeCommandRunner() *FakeCommandRunner {
|
||||||
|
|
||||||
// RunCmd implements the Command Runner interface to run a exec.Cmd object
|
// RunCmd implements the Command Runner interface to run a exec.Cmd object
|
||||||
func (f *FakeCommandRunner) RunCmd(cmd *exec.Cmd) (*RunResult, error) {
|
func (f *FakeCommandRunner) RunCmd(cmd *exec.Cmd) (*RunResult, error) {
|
||||||
rr := &RunResult{Args: cmd.Args}
|
rr := &RunResult{Args: cmd.Args[2:]} // to get rid of /bin/bash -c part
|
||||||
glog.Infof("(FakeCommandRunner) Run: %v", rr.Command())
|
glog.Infof("(FakeCommandRunner) Run: %v", rr.Command())
|
||||||
|
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
||||||
out, ok := f.cmdMap.Load(strings.Join(cmd.Args, " "))
|
out, ok := f.cmdMap.Load(strings.Join(rr.Args, " "))
|
||||||
buf := new(bytes.Buffer) // creating a buffer reader to convert out to rr.stdout
|
buf := new(bytes.Buffer) // creating a buffer reader to convert out to rr.stdout
|
||||||
outStr := ""
|
outStr := ""
|
||||||
if out != nil {
|
if out != nil {
|
||||||
|
|
Loading…
Reference in New Issue