diff --git a/cmd/e2e-setup/config.go b/cmd/e2e-setup/config.go index f05d84d39b..fd3c25b4d0 100644 --- a/cmd/e2e-setup/config.go +++ b/cmd/e2e-setup/config.go @@ -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) } diff --git a/cmd/e2e-setup/defaults.yaml b/cmd/e2e-setup/defaults.yaml index ed57077278..d7c6a37eb3 100644 --- a/cmd/e2e-setup/defaults.yaml +++ b/cmd/e2e-setup/defaults.yaml @@ -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!" diff --git a/cmd/e2e-setup/execute.go b/cmd/e2e-setup/execute.go index 6febec706f..8063d5d1f9 100644 --- a/cmd/e2e-setup/execute.go +++ b/cmd/e2e-setup/execute.go @@ -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 { diff --git a/e2e/local.env b/e2e/local.env index 243fb463a6..d73a051500 100644 --- a/e2e/local.env +++ b/e2e/local.env @@ -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)"