Skip to content

Commit

Permalink
fix: e2e test by updating Secret ouput TemplateData
Browse files Browse the repository at this point in the history
Signed-off-by: punkwalker <[email protected]>
  • Loading branch information
punkwalker committed Dec 27, 2024
1 parent 6f834bc commit c73b1df
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 7 additions & 3 deletions pkg/cmd/get/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"`
}

Expand Down
12 changes: 6 additions & 6 deletions tests/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c73b1df

Please sign in to comment.