Skip to content

Commit

Permalink
e2e: Fix the case of having multiple kubeconfig files
Browse files Browse the repository at this point in the history
Having multiple kubeconfig files confuses k3d, which doesn't know what
kubeconfig file to use. Instruct it to always use the
`$HOME/.kube/config` file.

Github-PR: #31

Signed-off-by: Yannis Zarkadas <[email protected]>
Reviewed-by: Alex Pyrgiotis <[email protected]>
  • Loading branch information
yanniszark authored and apyrgio committed Jul 13, 2020
1 parent 42c20fc commit 0f09bb5
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,24 @@ import (
"context"
"crypto/tls"
"fmt"
"github.com/cenkalti/backoff/v4"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
appsv1 "k8s.io/api/apps/v1"
"k8s.io/apimachinery/pkg/types"
"net/http"
"net/url"
"os"
"os/exec"
controllerruntime "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"path"
"strconv"
"strings"
"testing"
"time"

"github.com/cenkalti/backoff/v4"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
appsv1 "k8s.io/api/apps/v1"
"k8s.io/apimachinery/pkg/types"
controllerruntime "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
)

type E2ETestSuite struct {
Expand Down Expand Up @@ -250,7 +252,9 @@ func createK3DCluster() error {
if err != nil {
return err
}
return exec.Command("k3d", "get", "kubeconfig", "e2e-test-cluster", "--switch").Run()
kubeconfigPath := path.Join(os.Getenv("HOME"), ".kube/config")
return exec.Command("k3d", "get", "kubeconfig", "e2e-test-cluster",
"--switch", "--output", kubeconfigPath).Run()
}

func deleteK3DCluster() error {
Expand Down

0 comments on commit 0f09bb5

Please sign in to comment.