Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
muhlemmer committed May 3, 2023
1 parent 4934d6f commit 5f0c1b5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
10 changes: 7 additions & 3 deletions internal/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
)
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 5f0c1b5

Please sign in to comment.