From c73b1dff01a52e2944434c3cae68c3f5de0f15bd Mon Sep 17 00:00:00 2001 From: punkwalker Date: Thu, 26 Dec 2024 17:21:52 -0800 Subject: [PATCH] fix: e2e test by updating Secret ouput TemplateData Signed-off-by: punkwalker --- .goreleaser.yaml | 2 +- pkg/cmd/get/secrets.go | 10 +++++++--- tests/e2e/e2e.go | 12 ++++++------ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 8cc9ca8c..7e7578b5 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -5,7 +5,7 @@ before: - go mod tidy release: # Mark nightly build as prerelease based on tag - prerelease: '{{ contains .Tag "-nightly" }}' + prerelease: auto builds: - env: diff --git a/pkg/cmd/get/secrets.go b/pkg/cmd/get/secrets.go index e731b24c..6ccecb19 100644 --- a/pkg/cmd/get/secrets.go +++ b/pkg/cmd/get/secrets.go @@ -3,14 +3,15 @@ package get import ( "context" "fmt" - "github.com/cnoe-io/idpbuilder/pkg/entity" - "github.com/cnoe-io/idpbuilder/pkg/printer" "io" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "os" "path/filepath" "strings" + "github.com/cnoe-io/idpbuilder/pkg/entity" + "github.com/cnoe-io/idpbuilder/pkg/printer" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/cnoe-io/idpbuilder/api/v1alpha1" "github.com/cnoe-io/idpbuilder/pkg/build" "github.com/cnoe-io/idpbuilder/pkg/k8s" @@ -46,8 +47,11 @@ var ( ) type TemplateData struct { + IsCore bool `json:"isCore"` Name string `json:"name"` Namespace string `json:"namespace"` + Username string `json:"username"` + Password string `json:"password"` Data map[string]string `json:"data"` } diff --git a/tests/e2e/e2e.go b/tests/e2e/e2e.go index 86c355b8..d8c50c4f 100644 --- a/tests/e2e/e2e.go +++ b/tests/e2e/e2e.go @@ -275,10 +275,10 @@ func GetBasicAuth(ctx context.Context, name string) (BasicAuth, error) { continue } - for i := range secs { - if secs[i].Name == name { - out.Password = secs[i].Data["password"] - out.Username = secs[i].Data["username"] + for _, sec := range secs { + if sec.Name == name { + out.Password = sec.Password + out.Username = sec.Username break } } @@ -388,8 +388,8 @@ func TestGiteaRegistry(ctx context.Context, t *testing.T, cmd, giteaHost, giteaP assert.NoError(t, err) sec := secs[0] - user := sec.Data["username"] - pass := sec.Data["password"] + user := sec.Username + pass := sec.Password login, err := RunCommand(ctx, fmt.Sprintf("%s login %s:%s -u %s -p %s", cmd, giteaHost, giteaPort, user, pass), 10*time.Second) require.NoErrorf(t, err, "%s login err: %s", cmd, login)