Skip to content

Commit

Permalink
Merge pull request #30 from troy0820/troy0820/fix-mage-deploy
Browse files Browse the repository at this point in the history
Use context when switching to kind-porter
  • Loading branch information
schristoff authored Aug 22, 2023
2 parents b038ebe + 09cdbf3 commit 77c3a69
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,13 @@ func CreateTestCluster() {
}
}
}
homeDir, err := os.UserHomeDir()
if err != nil {
mgx.Must(fmt.Errorf("error retrieving the home directory of the current user %w", err))
}
kubeConfig := homeDir + "/.kube/config:" + filepath.Join(pwd(), Kubeconfig)

os.Setenv("KUBECONFIG", filepath.Join(pwd(), Kubeconfig))
os.Setenv("KUBECONFIG", kubeConfig)
kindCfgTmpl, err := template.New("kind.config.yaml").Parse(templateKindConfig)
if err != nil {
mgx.Must(fmt.Errorf("error parsing EnsureKind config template: %w", err))
Expand All @@ -127,6 +132,7 @@ func CreateTestCluster() {
kubectl("apply", "-f", "-").
Stdin(strings.NewReader(templateLocalRegistry)).
Run()
kubectl("config", "use-context", "kind-porter").Run()
}

// Delete the KIND cluster named porter.
Expand Down

0 comments on commit 77c3a69

Please sign in to comment.