*_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,13 +6,10 @@ import (
)
func TestCheckpointRestore(t *testing.T) {
if testing.Short() {
t.Skip()
}
if !supportsCriu {
t.Skip("system does not have criu installed")
}
client, err := New(address)
client, err := newClient(t, address)
if err != nil {
t.Fatal(err)
}
@@ -101,13 +98,10 @@ func TestCheckpointRestore(t *testing.T) {
}
func TestCheckpointRestoreNewContainer(t *testing.T) {
if testing.Short() {
t.Skip()
}
if !supportsCriu {
t.Skip("system does not have criu installed")
}
client, err := New(address)
client, err := newClient(t, address)
if err != nil {
t.Fatal(err)
}