Skip to content

Commit

Permalink
e2e testing improvement (kubernetes-sigs#743)
Browse files Browse the repository at this point in the history
* Bump kind version
* Remove docker load in favor of kind load for e2e cluster

Signed-off-by: Chuck Ha <[email protected]>
  • Loading branch information
chuckha authored and detiber committed May 2, 2019
1 parent 3316d29 commit 01aa43f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ go_repository(
go_repository(
name = "io_k8s_sigs_kind",
importpath = "sigs.k8s.io/kind",
tag = "0.1.0",
tag = "0.2.1",
)

go_repository(
Expand Down
24 changes: 5 additions & 19 deletions test/e2e/util/kind/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ var (
managerImageTar = flag.String("managerImageTar", "", "a script to load the manager Docker image into Docker")
)

const kindContainerName = "kind-1-control-plane"

// Cluster represents the running state of a KIND cluster.
// An empty struct is enough to call Setup() on.
type Cluster struct {
Expand All @@ -73,28 +71,16 @@ func (c *Cluster) Setup() {
fmt.Fprintf(ginkgo.GinkgoWriter, "export KUBECONFIG=%s\n", c.kubepath)

if *managerImageTar != "" {
c.loadImage()
fmt.Fprintf(
ginkgo.GinkgoWriter,
"loading image %q into Kind node\n",
*managerImageTar)
c.run(exec.Command(*kindBinary, "load", "image-archive", *managerImageTar))
}

c.applyYAML()
}

func (c *Cluster) loadImage() {
// TODO(EKF): once kind supports loading images directly, remove this hack
fmt.Fprintf(
ginkgo.GinkgoWriter,
"loading image %q into nested docker instance\n",
*managerImageTar)
file, err := os.Open(*managerImageTar)
gomega.Expect(err).To(gomega.BeNil())

// Pipe the tar file into the kind container then docker-load it
cmd := exec.Command("docker", "exec", "--interactive", kindContainerName, "docker", "load")
cmd.Stdin = file
cmd.Stdout = ginkgo.GinkgoWriter
c.run(cmd)
}

// Teardown attempts to delete the KIND cluster
func (c *Cluster) Teardown() {
c.run(exec.Command(*kindBinary, "delete", "cluster"))
Expand Down

0 comments on commit 01aa43f

Please sign in to comment.