|
53 | 53 | projectRootDir string |
54 | 54 | chartsRoot string |
55 | 55 | testRoot string |
| 56 | + kubeconfigPath string |
56 | 57 | ) |
57 | 58 |
|
58 | 59 | // TestE2E runs the end-to-end (e2e) test suite for the project. These tests execute in an isolated, |
@@ -98,6 +99,20 @@ var _ = BeforeSuite(func() { |
98 | 99 | err = utils.LoadImageToKindClusterWithName(kindClusterName, frontendImage) |
99 | 100 | ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to load the frontend API image into Kind") |
100 | 101 |
|
| 102 | + By("getting the kubeconfig from Kind") |
| 103 | + cmd = exec.Command("kind", "get", "kubeconfig", "--name", kindClusterName) |
| 104 | + kubeconfig, err := utils.Run(cmd) |
| 105 | + Expect(err).NotTo(HaveOccurred(), "Failed to get kubeconfig from Kind") |
| 106 | + |
| 107 | + f, err := os.CreateTemp("", "kubeconfig") |
| 108 | + Expect(err).NotTo(HaveOccurred()) |
| 109 | + _, err = f.WriteString(kubeconfig) |
| 110 | + Expect(err).NotTo(HaveOccurred()) |
| 111 | + err = f.Close() |
| 112 | + Expect(err).NotTo(HaveOccurred()) |
| 113 | + kubeconfigPath = f.Name() |
| 114 | + os.Setenv("KUBECONFIG", kubeconfigPath) |
| 115 | + |
101 | 116 | By("updating helm dependencies for the umbrella chart") |
102 | 117 | umbrellaChartPath := filepath.Join(chartsRoot, "kubetasker") |
103 | 118 | cmd = exec.Command("helm", "dependency", "update", umbrellaChartPath) |
@@ -195,6 +210,9 @@ var _ = AfterSuite(func() { |
195 | 210 | // Only remove the files generated during the test, not the whole directory. |
196 | 211 | _ = os.Remove(filepath.Join(projectRootDir, "kustomize", "base", "all.yaml")) |
197 | 212 | _ = os.Remove(filepath.Join(projectRootDir, "kustomize", "base", "crd.yaml")) |
| 213 | + if kubeconfigPath != "" { |
| 214 | + _ = os.Remove(kubeconfigPath) |
| 215 | + } |
198 | 216 | }) |
199 | 217 |
|
200 | 218 | // logDebugInfoOnFailure checks if the current Ginkgo spec has failed. If it has, it captures |
|
0 commit comments