make e2e setup work

This commit is contained in:
Elio Bischof 2022-07-08 15:20:35 +02:00
parent 2cb47b7877
commit f8444ff04f
No known key found for this signature in database
GPG Key ID: 7B383FDE4DDBF1BD
4 changed files with 13 additions and 5 deletions

View File

@ -3,9 +3,10 @@ package main
import (
"errors"
"fmt"
"github.com/zitadel/zitadel/internal/crypto"
"regexp"
"github.com/zitadel/zitadel/internal/crypto"
"github.com/zitadel/zitadel/internal/id"
"github.com/zitadel/zitadel/internal/database"
@ -47,6 +48,7 @@ func (c Config) Validate() error {
type E2EConfig struct {
Org string
MachineKeyPath string
InstanceID string
ZitadelProjectResourceID string
APIURL string
IssuerURL string
@ -70,7 +72,7 @@ func (e E2EConfig) Validate() (err error) {
}
audPattern := "number-[0-9]{17}"
matched, err := regexp.MatchString("number-[0-9]{17}", e.ZitadelProjectResourceID)
matched, err := regexp.MatchString("bignumber-[0-9]{17}", e.ZitadelProjectResourceID)
if err != nil {
return fmt.Errorf("validating ZitadelProjectResourceID failed: %w", err)
}

View File

@ -1,10 +1,11 @@
E2E:
InstanceID: ""
ZitadelProjectResourceID: ""
Org: "e2e-tests"
MachineKeyPath: ".keys/e2e.json"
ZitadelProjectResourceID: ""
APIURL: "http://localhost:8080"
IssuerURL: "http://localhost:8080/oauth/v2"
Audience: ""
Audience: "http://localhost:8080"
OrgOwnerPassword: "Password1!"
OrgOwnerViewerPassword: "Password1!"
OrgProjectCreatorPassword: "Password1!"

View File

@ -7,6 +7,8 @@ import (
"path/filepath"
"time"
"github.com/zitadel/zitadel/internal/api/authz"
"github.com/zitadel/zitadel/internal/command"
"github.com/zitadel/zitadel/internal/domain"
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
@ -14,6 +16,8 @@ import (
func execute(ctx context.Context, cmd *command.Commands, cfg E2EConfig, users []userData) error {
ctx = authz.WithInstanceID(ctx, cfg.InstanceID)
orgOwner := newHuman(users[0])
orgOwnerID, org, err := cmd.SetUpOrg(ctx, &command.OrgSetup{
@ -75,7 +79,7 @@ func execute(ctx context.Context, cmd *command.Commands, cfg E2EConfig, users []
}
for idx := range users[1:] {
user := users[idx]
user := users[idx+1]
createdHuman, err := cmd.AddHuman(ctx, org.ResourceOwner, newHuman(user))
if err != nil {

View File

@ -12,3 +12,4 @@ ZITADEL_E2E_ACCOUNTSURL="http://localhost:8080"
ZITADEL_E2E_ISSUERURL="http://localhost:8080/oauth/v2"
ZITADEL_E2E_OTHERZITADELIDPINSTANCE=false
ZITADEL_E2E_ZITADELPROJECTRESOURCEID="bignumber-$(echo -n $(./e2e/docker-compose.sh exec --no-TTY db cockroach sql --database zitadel --insecure --execute "select aggregate_id from eventstore.events where event_type = 'project.added' and event_data = '{\"name\": \"ZITADEL\"}';" --format tsv) | cut -d " " -f 2)"
ZITADEL_E2E_INSTANCEID="$(echo -n $(./e2e/docker-compose.sh exec --no-TTY db cockroach sql --database zitadel --insecure --execute "select aggregate_id from eventstore.events where event_type = 'instance.added' and event_data = '{\"name\": \"Localhost\"}';" --format tsv) | cut -d " " -f 2)"