diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index f3d360b18e..8f7ba48a11 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -16,7 +16,8 @@ jobs: runs-on: ubuntu-20.04 env: DOCKER_BUILDKIT: 1 - INTEGRATION_DB_FLAVOR: ${{ matrix.db }} + INTEGRATION_DB_FLAVOR: ${{ matrix.db }} + ZITADEL_MASTERKEY: MasterkeyNeedsToHave32Characters steps: - name: Set up Go uses: actions/setup-go@v3 @@ -40,7 +41,7 @@ jobs: - name: Run zitadel init and setup run: | go run main.go init --config internal/integration/config/zitadel.yaml --config internal/integration/config/${INTEGRATION_DB_FLAVOR}.yaml - go run main.go setup --masterkey MasterkeyNeedsToHave32Characters --config internal/integration/config/zitadel.yaml --config internal/integration/config/${INTEGRATION_DB_FLAVOR}.yaml + go run main.go setup --masterkeyFromEnv --config internal/integration/config/zitadel.yaml --config internal/integration/config/${INTEGRATION_DB_FLAVOR}.yaml - name: Run integration tests run: go test -tags=integration -race -parallel 1 -v -coverprofile=profile.cov -coverpkg=./... ./internal/integration ./internal/api/grpc/... - name: Publish go coverage diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3e47e7e4d0..b17d42c0ab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -201,13 +201,13 @@ docker compose --file ./e2e/config/host.docker.internal/docker-compose.yaml down #### Integration tests -In order to run the integrations tests for the gRPC API, PostgreSQL and CockroachDB must be running and initialized. +In order to run the integrations tests for the gRPC API, PostgreSQL and CockroachDB must be started and initialized: ```bash -export INTEGRATION_DB_FLAVOR="cockroach" +export INTEGRATION_DB_FLAVOR="cockroach" ZITADEL_MASTERKEY="MasterkeyNeedsToHave32Characters" docker compose -f internal/integration/config/docker-compose.yaml up --wait ${INTEGRATION_DB_FLAVOR} go run main.go init --config internal/integration/config/zitadel.yaml --config internal/integration/config/${INTEGRATION_DB_FLAVOR}.yaml -go run main.go setup --masterkey MasterkeyNeedsToHave32Characters --config internal/integration/config/zitadel.yaml --config internal/integration/config/${INTEGRATION_DB_FLAVOR}.yaml +go run main.go setup --masterkeyFromEnv --config internal/integration/config/zitadel.yaml --config internal/integration/config/${INTEGRATION_DB_FLAVOR}.yaml go test -tags=integration -race -parallel 1 ./internal/integration ./internal/api/grpc/... docker compose -f internal/integration/config/docker-compose.yaml down ``` diff --git a/internal/integration/integration.go b/internal/integration/integration.go index 39873f3533..67ef9d60b2 100644 --- a/internal/integration/integration.go +++ b/internal/integration/integration.go @@ -72,10 +72,14 @@ type Tester struct { wg sync.WaitGroup // used for shutdown } -const commandLine = `start --masterkey MasterkeyNeedsToHave32Characters` +const commandLine = `start --masterkeyFromEnv` + +func (s *Tester) Host() string { + return fmt.Sprintf("%s:%d", s.Config.ExternalDomain, s.Config.Port) +} func (s *Tester) createClientConn(ctx context.Context) { - target := fmt.Sprintf("localhost:%d", s.Config.Port) + target := s.Host() cc, err := grpc.DialContext(ctx, target, grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials()), ) @@ -126,7 +130,7 @@ const ( func (s *Tester) createSystemUser(ctx context.Context) { var err error - s.Instance, err = s.Queries.InstanceByHost(ctx, "localhost:8080") + s.Instance, err = s.Queries.InstanceByHost(ctx, s.Host()) logging.OnError(err).Fatal("query instance") ctx = authz.WithInstance(ctx, s.Instance)