*_test.go: fix test conditions

- add `testutil.RequiresRoot()` to TestMain
- moved `if testing.Short{ t.Skip() }` from each of the tests into a
common `newClient()`

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
Akihiro Suda
2017-06-29 06:37:33 +00:00
parent 8a00710af8
commit eeb74d4e23
6 changed files with 46 additions and 76 deletions

View File

@@ -6,10 +6,7 @@ import (
)
func BenchmarkContainerCreate(b *testing.B) {
if testing.Short() {
b.Skip()
}
client, err := New(address)
client, err := newClient(b, address)
if err != nil {
b.Fatal(err)
}
@@ -52,10 +49,7 @@ func BenchmarkContainerCreate(b *testing.B) {
}
func BenchmarkContainerStart(b *testing.B) {
if testing.Short() {
b.Skip()
}
client, err := New(address)
client, err := newClient(b, address)
if err != nil {
b.Fatal(err)
}