Merge pull request #270 from ehazlett/allow-diff-test-interval

allow for arbitrary test interval
This commit is contained in:
Evan Hazlett 2015-01-13 12:17:14 -05:00
commit d0c18b6c52
2 changed files with 18 additions and 3 deletions

View File

@ -9,9 +9,7 @@ import (
)
const (
machineName = "machine-integration-test-%s"
waitInterval = 30
waitDuration = time.Duration(waitInterval * time.Second)
machineName = "machine-integration-test-%s"
)
func machineCreate(name string, t *testing.T, wg *sync.WaitGroup) {

View File

@ -4,7 +4,9 @@ import (
"fmt"
"os"
"os/exec"
"strconv"
"strings"
"time"
)
type (
@ -16,6 +18,8 @@ type (
var (
machineBinary = "machine"
machineTestDrivers []MachineDriver
waitInterval int
waitDuration time.Duration
)
func init() {
@ -39,6 +43,19 @@ func init() {
}
}
interval := os.Getenv("MACHINE_TEST_DURATION")
if interval == "" {
interval = "30"
}
wait, err := strconv.Atoi(interval)
if err != nil {
fmt.Printf("invalid interval: %s\n", err)
os.Exit(1)
}
waitInterval = wait
waitDuration = time.Duration(time.Duration(waitInterval) * time.Second)
// find machine binary
if machineBin := os.Getenv("MACHINE_BINARY"); machineBin != "" {
machineBinary = machineBin