From 6924a16ac778545aadf5a810a56b83a798554ad9 Mon Sep 17 00:00:00 2001 From: Somtochi Onyekwere Date: Wed, 14 Dec 2022 01:26:27 +0100 Subject: [PATCH 1/2] use proper paths for committing Signed-off-by: Somtochi Onyekwere --- tests/azure/azure_test.go | 4 ++-- tests/azure/util_test.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/azure/azure_test.go b/tests/azure/azure_test.go index 1397dd02..492fd4f8 100644 --- a/tests/azure/azure_test.go +++ b/tests/azure/azure_test.go @@ -283,7 +283,7 @@ func TestAzureDevOpsCloning(t *testing.T) { name: foobar namespace: %s `, tt.name) - name := fmt.Sprintf("./cloning-test/%s/configmap.yaml", tt.name) + name := fmt.Sprintf("cloning-test/%s/configmap.yaml", tt.name) files[name] = strings.NewReader(manifest) } @@ -554,7 +554,7 @@ stringData: require.NoError(t, err) files := make(map[string]io.Reader) - files["./key-vault-sops/secret.enc.yaml"] = r + files["key-vault-sops/secret.enc.yaml"] = r err = commitAndPushAll(repo, files, name) require.NoError(t, err) diff --git a/tests/azure/util_test.go b/tests/azure/util_test.go index 55ae7be8..ba6b88dc 100644 --- a/tests/azure/util_test.go +++ b/tests/azure/util_test.go @@ -168,9 +168,9 @@ patchesStrategicMerge: ` files := make(map[string]io.Reader) - files["./clusters/e2e/flux-system/kustomization.yaml"] = strings.NewReader(kustomizeYaml) - files["./clusters/e2e/flux-system/gotk-components.yaml"] = strings.NewReader("") - files["./clusters/e2e/flux-system/gotk-sync.yaml"] = strings.NewReader("") + files["clusters/e2e/flux-system/kustomization.yaml"] = strings.NewReader(kustomizeYaml) + files["clusters/e2e/flux-system/gotk-components.yaml"] = strings.NewReader("") + files["clusters/e2e/flux-system/gotk-sync.yaml"] = strings.NewReader("") err = commitAndPushAll(repo, files, defaultBranch) if err != nil { return err From 645f9df4f0efc65eee1ba37a5e15e92d61804328 Mon Sep 17 00:00:00 2001 From: Somtochi Onyekwere Date: Wed, 14 Dec 2022 01:30:29 +0100 Subject: [PATCH 2/2] add detail to returned error Signed-off-by: Somtochi Onyekwere --- tests/azure/util_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/azure/util_test.go b/tests/azure/util_test.go index ba6b88dc..2983b403 100644 --- a/tests/azure/util_test.go +++ b/tests/azure/util_test.go @@ -129,7 +129,7 @@ func installFlux(ctx context.Context, kubeClient client.Client, kubeconfigPath, //// Install Flux and push files to git repository repo, _, err := getRepository(repoUrl, defaultBranch, true, azdoPat) if err != nil { - return err + return fmt.Errorf("error cloning repositoriy: %w", err) } kustomizeYaml := ` @@ -173,14 +173,14 @@ patchesStrategicMerge: files["clusters/e2e/flux-system/gotk-sync.yaml"] = strings.NewReader("") err = commitAndPushAll(repo, files, defaultBranch) if err != nil { - return err + return fmt.Errorf("error commiting and pushing manifests: %w", err) } bootstrapCmd := fmt.Sprintf("flux bootstrap git --url=%s --password=%s --kubeconfig=%s"+ " --token-auth --path=clusters/e2e --components-extra image-reflector-controller,image-automation-controller", repoUrl, azdoPat, kubeconfigPath) if err := runCommand(context.Background(), 10*time.Minute, "./", bootstrapCmd); err != nil { - return err + return fmt.Errorf("error running bootstrap: %w", err) } return nil