Add test -short for non-integration tests

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-05-24 16:05:24 -07:00
parent 01c4c86414
commit 8cd882c570
5 changed files with 47 additions and 40 deletions

View File

@@ -8,6 +8,9 @@ import (
const defaultAddress = "/run/containerd/containerd.sock"
func TestNewClient(t *testing.T) {
if testing.Short() {
return
}
client, err := New(defaultAddress)
if err != nil {
t.Fatal(err)
@@ -20,42 +23,10 @@ func TestNewClient(t *testing.T) {
}
}
func TestNewContainer(t *testing.T) {
client, err := New(defaultAddress)
if err != nil {
t.Fatal(err)
}
defer client.Close()
id := "test"
spec, err := GenerateSpec(WithHostname(id))
if err != nil {
t.Error(err)
return
}
container, err := client.NewContainer(context.Background(), id, spec)
if err != nil {
t.Error(err)
return
}
if container.ID() != id {
t.Errorf("expected container id %q but received %q", id, container.ID())
}
if spec, err = container.Spec(); err != nil {
t.Error(err)
return
}
if spec.Hostname != id {
t.Errorf("expected spec hostname id %q but received %q", id, container.ID())
return
}
if err := container.Delete(context.Background()); err != nil {
t.Error(err)
return
}
}
func TestImagePull(t *testing.T) {
if testing.Short() {
return
}
client, err := New(defaultAddress)
if err != nil {
t.Fatal(err)