Add test flag for setting containerd address

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-05-25 11:40:35 -07:00
parent 89037568d3
commit cebe099358
6 changed files with 34 additions and 16 deletions

View File

@@ -2,17 +2,22 @@ package containerd
import (
"context"
"flag"
"testing"
)
const defaultAddress = "/run/containerd/containerd.sock"
func init() {
flag.StringVar(&address, "address", "/run/containerd/containerd.sock", "The address to the containerd socket for use in the tests")
flag.Parse()
}
var address string
func TestNewClient(t *testing.T) {
if testing.Short() {
t.Skip()
return
}
client, err := New(defaultAddress)
client, err := New(address)
if err != nil {
t.Fatal(err)
}
@@ -27,9 +32,8 @@ func TestNewClient(t *testing.T) {
func TestImagePull(t *testing.T) {
if testing.Short() {
t.Skip()
return
}
client, err := New(defaultAddress)
client, err := New(address)
if err != nil {
t.Fatal(err)
}