提交 63868dba 编写于 作者: M Medya Gh

add integrationn tests for cache

上级 7902d528
......@@ -21,14 +21,11 @@ require (
github.com/docker/machine v0.7.1-0.20190718054102-a555e4f7a8f5 // version is 0.7.1 to pin to a555e4f7a8f5
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f
github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/google/btree v1.0.0 // indirect
github.com/google/go-cmp v0.3.0
github.com/gorilla/mux v1.7.1 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.5.0 // indirect
github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce // indirect
github.com/hashicorp/go-getter v1.4.0
github.com/hashicorp/go-multierror v0.0.0-20160811015721-8c5f0ad93604 // indirect
......
......@@ -308,17 +308,41 @@ func validateDNS(ctx context.Context, t *testing.T, profile string) {
}
}
// validateCacheCmd asserts basic "ssh" command functionality
// validateCacheCmd tests functionality of cache command (cache add, delete, list)
func validateCacheCmd(ctx context.Context, t *testing.T, profile string) {
if NoneDriver() {
t.Skipf("skipping: cache unsupported by none")
}
for _, img := range []string{"busybox", "busybox:1.28.4-glibc", "mysql:5.6", "gcr.io/hello-minikube-zero-install/hello-node"} {
rr, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "cache", "add", img))
for _, img := range []string{"busybox", "busybox:1.28.4-glibc", "k8s.gcr.io/pause:latest"} {
_, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "cache", "add", img))
if err != nil {
t.Errorf("%s failed: %v", rr.Args, err)
t.Errorf("failed to add %q to cache", img)
}
}
rr, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "ssh", "docker", "images"))
if err != nil {
t.Errorf("failed to get docker images through ssh %v", err)
}
if !strings.Contains(rr.Output(), "busybox:1.28.4-glibc") {
t.Errorf("expected busybox:1.28.4-glibc to be loaded by docker inside minikube node. but got %s", rr.Output())
}
_, err = Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "cache", "delete", "busybox:1.28.4-glibc"))
if err != nil {
t.Errorf("failed to delete image busybox:1.28.4-glibc from cache: %v", err)
}
rr, err = Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "cache", "list"))
if err != nil {
t.Errorf("cache list failed: %v", err)
}
if !strings.Contains(rr.Output(), "k8s.gcr.io/pause") {
t.Errorf("cache list did not include k8s.gcr.io/pause")
}
if strings.Contains(rr.Output(), "busybox:1.28.4-glibc") {
t.Errorf("cache list should not include busybox:1.28.4-glibc")
}
}
// validateConfigCmd asserts basic "config" command functionality
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册