Skip to content

Commit

Permalink
Skip QEMU graceful shutdown test except on Travis
Browse files Browse the repository at this point in the history
Hopefully we can reuse the SkipSlow helper elsewhere.
  • Loading branch information
schmichael committed Jan 31, 2018
1 parent f4e8d92 commit 60c98e4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 3 additions & 1 deletion client/driver/qemu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,14 @@ func TestQemuDriver_StartOpen_Wait(t *testing.T) {
}

func TestQemuDriver_GracefulShutdown(t *testing.T) {
logger := testLogger()
testutil.SkipSlow(t)
if !testutil.IsTravis() {
t.Parallel()
}
ctestutils.QemuCompatible(t)

logger := testLogger()

// Graceful shutdown may be really slow unfortunately
killTimeout := 3 * time.Minute

Expand Down
2 changes: 1 addition & 1 deletion scripts/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if [ "$RUN_STATIC_CHECKS" ]; then
fi
fi

make test
NOMAD_SLOW_TEST=1 make test
TEST_OUTPUT=$?

kill $PING_LOOP_PID
Expand Down
15 changes: 15 additions & 0 deletions testutil/slow.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package testutil

import (
"os"

testing "github.com/mitchellh/go-testing-interface"
)

// SkipSlow skips a slow test unless the NOMAD_SLOW_TEST environment variable
// is set.
func SkipSlow(t testing.T) {
if os.Getenv("NOMAD_SLOW_TEST") == "" {
t.Skip("Skipping slow test. Set NOMAD_SLOW_TEST=1 to run.")
}
}

0 comments on commit 60c98e4

Please sign in to comment.