packer-cn/packer/communicator_test.go

27 lines
353 B
Go
Raw Normal View History

2013-05-28 21:02:14 -04:00
package packer
2013-06-03 13:49:23 -04:00
import (
"testing"
"time"
)
func TestRemoteCmd_Wait(t *testing.T) {
var cmd RemoteCmd
result := make(chan bool)
go func() {
cmd.Wait()
result <- true
}()
cmd.ExitStatus = 42
cmd.Exited = true
select {
case <-result:
// Success
case <-time.After(500 * time.Millisecond):
t.Fatal("never got exit notification")
}
}