mirror of
https://github.com/zitadel/zitadel.git
synced 2025-04-25 14:41:00 +00:00
make e2e setup work
This commit is contained in:
parent
2cb47b7877
commit
f8444ff04f
@ -3,9 +3,10 @@ package main
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/zitadel/zitadel/internal/crypto"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zitadel/zitadel/internal/crypto"
|
||||||
|
|
||||||
"github.com/zitadel/zitadel/internal/id"
|
"github.com/zitadel/zitadel/internal/id"
|
||||||
|
|
||||||
"github.com/zitadel/zitadel/internal/database"
|
"github.com/zitadel/zitadel/internal/database"
|
||||||
@ -47,6 +48,7 @@ func (c Config) Validate() error {
|
|||||||
type E2EConfig struct {
|
type E2EConfig struct {
|
||||||
Org string
|
Org string
|
||||||
MachineKeyPath string
|
MachineKeyPath string
|
||||||
|
InstanceID string
|
||||||
ZitadelProjectResourceID string
|
ZitadelProjectResourceID string
|
||||||
APIURL string
|
APIURL string
|
||||||
IssuerURL string
|
IssuerURL string
|
||||||
@ -70,7 +72,7 @@ func (e E2EConfig) Validate() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
audPattern := "number-[0-9]{17}"
|
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 {
|
if err != nil {
|
||||||
return fmt.Errorf("validating ZitadelProjectResourceID failed: %w", err)
|
return fmt.Errorf("validating ZitadelProjectResourceID failed: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
E2E:
|
E2E:
|
||||||
|
InstanceID: ""
|
||||||
|
ZitadelProjectResourceID: ""
|
||||||
Org: "e2e-tests"
|
Org: "e2e-tests"
|
||||||
MachineKeyPath: ".keys/e2e.json"
|
MachineKeyPath: ".keys/e2e.json"
|
||||||
ZitadelProjectResourceID: ""
|
|
||||||
APIURL: "http://localhost:8080"
|
APIURL: "http://localhost:8080"
|
||||||
IssuerURL: "http://localhost:8080/oauth/v2"
|
IssuerURL: "http://localhost:8080/oauth/v2"
|
||||||
Audience: ""
|
Audience: "http://localhost:8080"
|
||||||
OrgOwnerPassword: "Password1!"
|
OrgOwnerPassword: "Password1!"
|
||||||
OrgOwnerViewerPassword: "Password1!"
|
OrgOwnerViewerPassword: "Password1!"
|
||||||
OrgProjectCreatorPassword: "Password1!"
|
OrgProjectCreatorPassword: "Password1!"
|
||||||
|
@ -7,6 +7,8 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/zitadel/zitadel/internal/api/authz"
|
||||||
|
|
||||||
"github.com/zitadel/zitadel/internal/command"
|
"github.com/zitadel/zitadel/internal/command"
|
||||||
"github.com/zitadel/zitadel/internal/domain"
|
"github.com/zitadel/zitadel/internal/domain"
|
||||||
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
|
"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 {
|
func execute(ctx context.Context, cmd *command.Commands, cfg E2EConfig, users []userData) error {
|
||||||
|
|
||||||
|
ctx = authz.WithInstanceID(ctx, cfg.InstanceID)
|
||||||
|
|
||||||
orgOwner := newHuman(users[0])
|
orgOwner := newHuman(users[0])
|
||||||
|
|
||||||
orgOwnerID, org, err := cmd.SetUpOrg(ctx, &command.OrgSetup{
|
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:] {
|
for idx := range users[1:] {
|
||||||
user := users[idx]
|
user := users[idx+1]
|
||||||
|
|
||||||
createdHuman, err := cmd.AddHuman(ctx, org.ResourceOwner, newHuman(user))
|
createdHuman, err := cmd.AddHuman(ctx, org.ResourceOwner, newHuman(user))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -12,3 +12,4 @@ ZITADEL_E2E_ACCOUNTSURL="http://localhost:8080"
|
|||||||
ZITADEL_E2E_ISSUERURL="http://localhost:8080/oauth/v2"
|
ZITADEL_E2E_ISSUERURL="http://localhost:8080/oauth/v2"
|
||||||
ZITADEL_E2E_OTHERZITADELIDPINSTANCE=false
|
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_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)"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user