diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2017-11-01 14:38:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-01 14:38:21 -0400 |
commit | f5019df3f5da9030ce21e5c8ad3d3921a6585e7f (patch) | |
tree | 05412dcc190ca026dbe51a4ef72bb91ff646e7c6 /cmd/kpod/common_test.go | |
parent | 2b74391cd5281f6fdf391ff8ad50fd1490f6bf89 (diff) | |
parent | eab0737f1189a7b88f0a37a6b894ca4345b6853f (diff) | |
download | podman-f5019df3f5da9030ce21e5c8ad3d3921a6585e7f.tar.gz podman-f5019df3f5da9030ce21e5c8ad3d3921a6585e7f.tar.bz2 podman-f5019df3f5da9030ce21e5c8ad3d3921a6585e7f.zip |
Merge pull request #1 from mheon/master
Initial checkin
Diffstat (limited to 'cmd/kpod/common_test.go')
-rw-r--r-- | cmd/kpod/common_test.go | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/cmd/kpod/common_test.go b/cmd/kpod/common_test.go new file mode 100644 index 000000000..663bc41e1 --- /dev/null +++ b/cmd/kpod/common_test.go @@ -0,0 +1,51 @@ +package main + +import ( + "os/exec" + "os/user" + "testing" + + "flag" + + "github.com/urfave/cli" +) + +func TestGetStore(t *testing.T) { + t.Skip("FIX THIS!") + + //cmd/kpod/common_test.go:27: cannot use c (type *cli.Context) as type *libkpod.Config in argument to getStore + + // Make sure the tests are running as root + skipTestIfNotRoot(t) + + set := flag.NewFlagSet("test", 0) + globalSet := flag.NewFlagSet("test", 0) + globalSet.String("root", "", "path to the root directory in which data, including images, is stored") + globalCtx := cli.NewContext(nil, globalSet, nil) + command := cli.Command{Name: "imagesCommand"} + c := cli.NewContext(nil, set, globalCtx) + c.Command = command + + //_, err := getStore(c) + //if err != nil { + //t.Error(err) + //} +} + +func skipTestIfNotRoot(t *testing.T) { + u, err := user.Current() + if err != nil { + t.Skip("Could not determine user. Running without root may cause tests to fail") + } else if u.Uid != "0" { + t.Skip("tests will fail unless run as root") + } +} + +func pullTestImage(name string) error { + cmd := exec.Command("crioctl", "image", "pull", name) + err := cmd.Run() + if err != nil { + return err + } + return nil +} |