27 lines
353 B
Go
27 lines
353 B
Go
package packer
|
|
|
|
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")
|
|
}
|
|
}
|