From b2cdc3b0ae2d202084edd46023292a92d45ce140 Mon Sep 17 00:00:00 2001 From: Lorenzo Fontana Date: Wed, 9 Jan 2019 01:12:22 +0100 Subject: [PATCH] feat(integration): copy bpftrace image inside the kind docker daemon Signed-off-by: Lorenzo Fontana --- integration/suite_test.go | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/integration/suite_test.go b/integration/suite_test.go index c6c0426a..25e401ef 100644 --- a/integration/suite_test.go +++ b/integration/suite_test.go @@ -9,6 +9,7 @@ import ( "time" "github.com/go-check/check" + "github.com/iovisor/kubectl-trace/pkg/version" "gotest.tools/icmd" "sigs.k8s.io/kind/pkg/cluster" "sigs.k8s.io/kind/pkg/cluster/config/encoding" @@ -46,10 +47,22 @@ func (k *KubectlTraceSuite) SetUpSuite(c *check.C) { clusterName, err := generateClusterName() c.Assert(err, check.IsNil) - ctx := cluster.NewContext(clusterName) - err = ctx.Create(cfg, retain, wait) + kctx := cluster.NewContext(clusterName) + + err = kctx.Create(cfg, retain, wait) + c.Assert(err, check.IsNil) + k.kindContext = kctx + + nodes, err := kctx.ListNodes() + c.Assert(err, check.IsNil) - k.kindContext = ctx + + // copy the bpftrace image to the nodes + for _, n := range nodes { + loadcomm := fmt.Sprintf("docker save %s | docker exec -i %s docker load", version.ImageNameTag(), n.String()) + res := icmd.RunCommand("bash", "-c", loadcomm) + c.Assert(res.Error, check.IsNil) + } } func (s *KubectlTraceSuite) TearDownSuite(c *check.C) {