Просмотр исходного кода

e2e: resolve operational merge conflicts

Moritz Johner 1 месяц назад
Родитель
Сommit
c24e4dee90
2 измененных файлов с 11 добавлено и 36 удалено
  1. 9 30
      e2e/framework/addon/chart.go
  2. 2 6
      e2e/makefile_test.go

+ 9 - 30
e2e/framework/addon/chart.go

@@ -20,6 +20,7 @@ import (
 	"bytes"
 	"fmt"
 	"os"
+	"os/exec"
 	"path/filepath"
 	"strings"
 
@@ -28,7 +29,6 @@ import (
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 
 	"github.com/external-secrets/external-secrets-e2e/framework/log"
-	frameworkutil "github.com/external-secrets/external-secrets-e2e/framework/util"
 )
 
 // HelmChart installs the specified Chart into the cluster.
@@ -69,10 +69,7 @@ func (c *HelmChart) Install() error {
 			"dependency", "update", filepath.Join(AssetDir(), "deploy/charts/external-secrets"),
 		}
 		log.Logf("updating chart dependencies with args: %+q", args)
-		cmd, err := frameworkutil.Command("helm", args...)
-		if err != nil {
-			return fmt.Errorf("resolve helm executable: %w", err)
-		}
+		cmd := exec.Command("helm", args...)
 		output, err := cmd.CombinedOutput()
 		if err != nil {
 			return fmt.Errorf("unable to run update cmd: %w: %s", err, string(output))
@@ -154,18 +151,12 @@ func (c *HelmChart) releaseStatusArgs() []string {
 
 func (c *HelmChart) runInstall(args []string) ([]byte, error) {
 	log.Logf("installing chart with args: %+q", args)
-	cmd, err := frameworkutil.Command("helm", args...)
-	if err != nil {
-		return nil, fmt.Errorf("resolve helm executable: %w", err)
-	}
+	cmd := exec.Command("helm", args...)
 	return cmd.CombinedOutput()
 }
 
 func (c *HelmChart) cleanupExistingRelease() error {
-	cmd, err := frameworkutil.Command("helm", c.cleanupUninstallArgs()...)
-	if err != nil {
-		return fmt.Errorf("resolve helm executable: %w", err)
-	}
+	cmd := exec.Command("helm", c.cleanupUninstallArgs()...)
 	output, err := cmd.CombinedOutput()
 	if err != nil && !strings.Contains(string(output), "release: not found") {
 		statusOutput, statusErr := c.releaseStatus()
@@ -181,10 +172,7 @@ func (c *HelmChart) cleanupExistingRelease() error {
 }
 
 func (c *HelmChart) releaseStatus() ([]byte, error) {
-	cmd, err := frameworkutil.Command("helm", c.releaseStatusArgs()...)
-	if err != nil {
-		return nil, fmt.Errorf("resolve helm executable: %w", err)
-	}
+	cmd := exec.Command("helm", c.releaseStatusArgs()...)
 	return cmd.CombinedOutput()
 }
 
@@ -202,10 +190,7 @@ func canIgnoreHelmCleanupError(statusOutput string) bool {
 
 // Uninstall removes the chart aswell as the repo.
 func (c *HelmChart) Uninstall() error {
-	cmd, err := frameworkutil.Command("helm", c.uninstallArgs()...)
-	if err != nil {
-		return fmt.Errorf("resolve helm executable: %w", err)
-	}
+	cmd := exec.Command("helm", c.uninstallArgs()...)
 	output, err := cmd.CombinedOutput()
 	if err != nil {
 		return fmt.Errorf("unable to uninstall helm release: %w: %s", err, string(output))
@@ -219,13 +204,10 @@ func (c *HelmChart) addRepo() error {
 	}
 	var sout, serr bytes.Buffer
 	args := []string{"repo", "add", c.Repo.Name, c.Repo.URL}
-	cmd, err := frameworkutil.Command("helm", args...)
-	if err != nil {
-		return fmt.Errorf("resolve helm executable: %w", err)
-	}
+	cmd := exec.Command("helm", args...)
 	cmd.Stdout = &sout
 	cmd.Stderr = &serr
-	err = cmd.Run()
+	err := cmd.Run()
 	if err != nil {
 		return fmt.Errorf("unable to add helm repo: %w: %s, %s", err, sout.String(), serr.String())
 	}
@@ -238,10 +220,7 @@ func (c *HelmChart) removeRepo() error {
 	}
 
 	args := []string{"repo", "remove", c.Repo.Name}
-	cmd, err := frameworkutil.Command("helm", args...)
-	if err != nil {
-		return fmt.Errorf("resolve helm executable: %w", err)
-	}
+	cmd := exec.Command("helm", args...)
 	output, err := cmd.CombinedOutput()
 	if err != nil {
 		return fmt.Errorf("unable to remove repo: %w: %s", err, string(output))

+ 2 - 6
e2e/makefile_test.go

@@ -18,10 +18,9 @@ package e2e
 
 import (
 	"os"
+	"os/exec"
 	"strings"
 	"testing"
-
-	frameworkutil "github.com/external-secrets/external-secrets-e2e/framework/util"
 )
 
 const (
@@ -163,10 +162,7 @@ func runMakeDryRunWithEnv(t *testing.T, extraEnv []string, target string, extraA
 	t.Helper()
 
 	args := append([]string{"-n", target}, extraArgs...)
-	cmd, err := frameworkutil.Command("make", args...)
-	if err != nil {
-		t.Fatalf("resolve make: %v", err)
-	}
+	cmd := exec.Command("make", args...)
 	cmd.Dir = "."
 	cmd.Env = append(os.Environ(), extraEnv...)