command: stabilize tests

This commit is contained in:
Mitchell Hashimoto 2014-07-02 17:08:58 -07:00
parent 8fba438cf0
commit f1dce8f076
1 changed files with 7 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"os" "os"
"reflect" "reflect"
"testing" "testing"
"time"
"github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
"github.com/mitchellh/cli" "github.com/mitchellh/cli"
@ -132,6 +133,12 @@ func TestApply_shutdown(t *testing.T) {
go func() { go func() {
<-stopCh <-stopCh
shutdownCh <- struct{}{} shutdownCh <- struct{}{}
// This is really dirty, but we have no other way to assure that
// tf.Stop() has been called. This doesn't assure it either, but
// it makes it much more certain.
time.Sleep(50 * time.Millisecond)
close(stopReplyCh) close(stopReplyCh)
}() }()