Skip to content

Commit 52df061

Browse files
leodidofntlnz
authored andcommitted
fix(integration): use the new kind cluster creation features correctly
Signed-off-by: Leonardo Di Donato <[email protected]>
1 parent 3a56a6f commit 52df061

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

integration/cmd_run_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
)
88

99
func (k *KubectlTraceSuite) TestRunNode(c *check.C) {
10-
nodes, err := k.provider.ListNodes()
10+
nodes, err := k.provider.ListNodes(k.name)
1111
c.Assert(err, check.IsNil)
1212
c.Assert(len(nodes), check.Equals, 1)
1313

integration/suite_test.go

+16-5
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@ import (
44
"crypto/rand"
55
"fmt"
66
"os"
7+
"os/exec"
78
"path/filepath"
89
"strings"
910
"testing"
1011
"time"
1112

1213
"github.com/go-check/check"
1314
"github.com/iovisor/kubectl-trace/pkg/cmd"
15+
"github.com/pkg/errors"
1416
"gotest.tools/icmd"
1517
"sigs.k8s.io/kind/pkg/cluster"
18+
"sigs.k8s.io/kind/pkg/cluster/nodes"
19+
"sigs.k8s.io/kind/pkg/cluster/nodeutils"
1620
"sigs.k8s.io/kind/pkg/fs"
1721
)
1822

@@ -22,10 +26,10 @@ var (
2226

2327
type KubectlTraceSuite struct {
2428
kubeConfigPath string
25-
kindContext *cluster.Context
29+
// kindContext *cluster.Context
2630

2731
provider *cluster.Provider
28-
name string
32+
name string
2933
}
3034

3135
func init() {
@@ -43,10 +47,15 @@ func (k *KubectlTraceSuite) SetUpSuite(c *check.C) {
4347

4448
k.provider = cluster.NewProvider()
4549
// Create the cluster
46-
err := k.provider.Create(
50+
err = k.provider.Create(
4751
k.name,
4852
cluster.CreateWithRetain(false),
4953
cluster.CreateWithWaitForReady(time.Duration(0)),
54+
cluster.CreateWithKubeconfigPath(k.kubeConfigPath),
55+
56+
// todo > we need a logger
57+
// cluster.ProviderWithLogger(logger),
58+
// runtime.GetDefault(logger),
5059
)
5160
c.Assert(err, check.IsNil)
5261

@@ -70,14 +79,16 @@ func (k *KubectlTraceSuite) SetUpSuite(c *check.C) {
7079
}
7180

7281
func (k *KubectlTraceSuite) TearDownSuite(c *check.C) {
73-
err := k.provider.Delete(k.name)
82+
kubeConfig, err := k.provider.KubeConfig(k.name, false)
83+
c.Assert(err, check.IsNil)
84+
err = k.provider.Delete(k.name, kubeConfig)
7485
c.Assert(err, check.IsNil)
7586
}
7687

7788
func Test(t *testing.T) { check.TestingT(t) }
7889

7990
func (k *KubectlTraceSuite) KubectlTraceCmd(c *check.C, args ...string) string {
80-
args = append([]string{fmt.Sprintf("--kubeconfig=%s", k.kindContext.KubeConfigPath())}, args...)
91+
args = append([]string{fmt.Sprintf("--kubeconfig=%s", k.kubeConfigPath)}, args...)
8192
res := icmd.RunCommand(KubectlTraceBinary, args...)
8293
c.Assert(res.ExitCode, check.Equals, icmd.Success.ExitCode)
8394
return res.Combined()

0 commit comments

Comments
 (0)