packer: try to fix flaky test
This commit is contained in:
parent
590997df44
commit
da694a6ea8
|
@ -115,16 +115,16 @@ func (r *RemoteCmd) StartWithUi(c Communicator, ui Ui) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the channels we'll use for data
|
// Create the channels we'll use for data
|
||||||
exitCh := make(chan int, 1)
|
exitCh := make(chan struct{})
|
||||||
stdoutCh := iochan.DelimReader(stdout_r, '\n')
|
stdoutCh := iochan.DelimReader(stdout_r, '\n')
|
||||||
stderrCh := iochan.DelimReader(stderr_r, '\n')
|
stderrCh := iochan.DelimReader(stderr_r, '\n')
|
||||||
|
|
||||||
// Start the goroutine to watch for the exit
|
// Start the goroutine to watch for the exit
|
||||||
go func() {
|
go func() {
|
||||||
|
defer close(exitCh)
|
||||||
defer stdout_w.Close()
|
defer stdout_w.Close()
|
||||||
defer stderr_w.Close()
|
defer stderr_w.Close()
|
||||||
r.Wait()
|
r.Wait()
|
||||||
exitCh <- r.ExitStatus
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Loop and get all our output
|
// Loop and get all our output
|
||||||
|
|
|
@ -33,7 +33,7 @@ func TestRemoteCmd_StartWithUi(t *testing.T) {
|
||||||
rc.Wait()
|
rc.Wait()
|
||||||
|
|
||||||
expected := strings.TrimSpace(data)
|
expected := strings.TrimSpace(data)
|
||||||
if uiOutput.String() != expected+"\n" {
|
if strings.TrimSpace(uiOutput.String()) != expected {
|
||||||
t.Fatalf("bad output: '%s'", uiOutput.String())
|
t.Fatalf("bad output: '%s'", uiOutput.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue