From 24ba3540bf18a2338e6994817e7bfcf62d3eec9e Mon Sep 17 00:00:00 2001 From: Evan Hazlett Date: Fri, 19 Dec 2014 13:58:23 -0500 Subject: [PATCH] update travis to skip integration tests Signed-off-by: Evan Hazlett --- .travis.yml | 2 +- .../test_vars.go | 4 +- .../utils.go | 1 - integration-test/machine_test.go | 147 ------------------ 4 files changed, 3 insertions(+), 151 deletions(-) rename {integration-test => _integration-test}/test_vars.go (96%) rename {integration-test => _integration-test}/utils.go (98%) delete mode 100644 integration-test/machine_test.go diff --git a/.travis.yml b/.travis.yml index eb6b64aead..7ce858ba9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,4 @@ go: script: - script/validate-dco - script/validate-gofmt -- go test -v ./... +- go test -v -short ./... diff --git a/integration-test/test_vars.go b/_integration-test/test_vars.go similarity index 96% rename from integration-test/test_vars.go rename to _integration-test/test_vars.go index 40f0ce9c52..34c7230132 100644 --- a/integration-test/test_vars.go +++ b/_integration-test/test_vars.go @@ -30,10 +30,10 @@ func init() { } } else { machineTestDrivers = []MachineDriver{ - MachineDriver{ + { name: "virtualbox", }, - MachineDriver{ + { name: "digitalocean", }, } diff --git a/integration-test/utils.go b/_integration-test/utils.go similarity index 98% rename from integration-test/utils.go rename to _integration-test/utils.go index d4004e9ad3..b2abb1cb52 100644 --- a/integration-test/utils.go +++ b/_integration-test/utils.go @@ -3,7 +3,6 @@ package main import ( "fmt" "os/exec" - "strings" "syscall" ) diff --git a/integration-test/machine_test.go b/integration-test/machine_test.go deleted file mode 100644 index f51c205519..0000000000 --- a/integration-test/machine_test.go +++ /dev/null @@ -1,147 +0,0 @@ -package main - -import ( - "fmt" - "os/exec" - "sync" - "testing" -) - -const ( - MACHINE_NAME = "machine-integration-test-%s" -) - -func machineCreate(name string, t *testing.T, wg *sync.WaitGroup) { - mName := fmt.Sprintf(MACHINE_NAME, name) - fmt.Printf(" - testing create for %s (%s)\n", name, mName) - runCmd := exec.Command(machineBinary, "create", "-d", name, mName) - out, exitCode, err := runCommandWithOutput(runCmd) - if err != nil { - t.Error(out, err) - } - if exitCode != 0 { - t.Errorf("error creating machine: driver: %s; exit code: %d; output: %s", name, exitCode, out) - } - wg.Done() -} - -func machineStop(name string, t *testing.T, wg *sync.WaitGroup) { - mName := fmt.Sprintf(MACHINE_NAME, name) - fmt.Printf(" - testing stop for %s (%s)\n", name, mName) - runCmd := exec.Command(machineBinary, "stop", mName) - out, exitCode, err := runCommandWithOutput(runCmd) - if err != nil { - t.Error(out, err) - } - if exitCode != 0 { - t.Errorf("error stopping machine: driver: %s; exit code: %d; output: %s", name, exitCode, out) - } - wg.Done() -} - -func machineStart(name string, t *testing.T, wg *sync.WaitGroup) { - mName := fmt.Sprintf(MACHINE_NAME, name) - fmt.Printf(" - testing start for %s (%s)\n", name, mName) - runCmd := exec.Command(machineBinary, "start", mName) - out, exitCode, err := runCommandWithOutput(runCmd) - if err != nil { - t.Error(out, err) - } - if exitCode != 0 { - t.Errorf("error starting machine: driver: %s; exit code: %d; output: %s", name, exitCode, out) - } - wg.Done() -} - -func machineKill(name string, t *testing.T, wg *sync.WaitGroup) { - mName := fmt.Sprintf(MACHINE_NAME, name) - fmt.Printf(" - testing kill for %s (%s)\n", name, mName) - runCmd := exec.Command(machineBinary, "kill", mName) - out, exitCode, err := runCommandWithOutput(runCmd) - if err != nil { - t.Error(out, err) - } - if exitCode != 0 { - t.Errorf("error killing machine: driver: %s; exit code: %d; output: %s", name, exitCode, out) - } - wg.Done() -} - -func machineRm(name string, t *testing.T, wg *sync.WaitGroup) { - mName := fmt.Sprintf(MACHINE_NAME, name) - fmt.Printf(" - testing rm for %s (%s)\n", name, mName) - runCmd := exec.Command(machineBinary, "rm", "-f", mName) - out, exitCode, err := runCommandWithOutput(runCmd) - if err != nil { - t.Error(out, err) - } - if exitCode != 0 { - t.Errorf("error removing machine: driver: %s; exit code: %d; output: %s", name, exitCode, out) - } - wg.Done() -} - -func TestMachineCreate(t *testing.T) { - if testing.Short() { - t.Skip("skipping integration test") - } - - var wg sync.WaitGroup - for _, d := range machineTestDrivers { - wg.Add(1) - go machineCreate(d.name, t, &wg) - } - wg.Wait() -} - -func TestMachineStop(t *testing.T) { - if testing.Short() { - t.Skip("skipping integration test") - } - - var wg sync.WaitGroup - for _, d := range machineTestDrivers { - wg.Add(1) - go machineStop(d.name, t, &wg) - } - wg.Wait() -} - -func TestMachineStart(t *testing.T) { - if testing.Short() { - t.Skip("skipping integration test") - } - - var wg sync.WaitGroup - for _, d := range machineTestDrivers { - wg.Add(1) - go machineStart(d.name, t, &wg) - } - wg.Wait() -} - -func TestMachineKill(t *testing.T) { - if testing.Short() { - t.Skip("skipping integration test") - } - - var wg sync.WaitGroup - for _, d := range machineTestDrivers { - wg.Add(1) - go machineKill(d.name, t, &wg) - } - wg.Wait() -} - -func TestMachineRemove(t *testing.T) { - if testing.Short() { - t.Skip("skipping integration test") - } - - var wg sync.WaitGroup - for _, d := range machineTestDrivers { - wg.Add(1) - go machineRm(d.name, t, &wg) - } - wg.Wait() -}