diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 00000000..8d039cb1 --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,6 @@ +FROM golang:1.21 +WORKDIR /work +COPY go.* . +RUN go mod download +COPY . . +RUN --mount=type=cache,target=/root/.cache/go-build make test diff --git a/Makefile b/Makefile index 2ea69536..64956dc0 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,10 @@ build: test: build go test -cover ./... +.PHONY: test-in-docker +test-in-docker: + docker build -f Dockerfile.test --progress plain . + .PHONY: lint-structs lint-structs: @golangci-lint run --enable exhaustruct ./cmd --tests=false || \ diff --git a/README.md b/README.md index 32cecc79..7125501f 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ contexts: ``` Optional you can specify `issuer_type: generic` if you use other issuers as Dex, e.g. Keycloak (this will request scopes `openid,profile,email`): + ```bash contexts: prod: @@ -101,6 +102,7 @@ contexts: ``` If you must specify special scopes for your issuer, you can use `custom_scopes`: + ```bash contexts: prod: @@ -118,3 +120,9 @@ Full documentation is generated out of the cobra command implementation with: `metalctl markdown` generated markdown is [here](docs/metalctl.md) and [here](https://docs.metal-stack.io/stable/external/metalctl/README/) + +## Development + +For MacOS users, running the tests might throw an error because tests are utilizing [go-mpatch](https://github.com/undefinedlabs/go-mpatch) in order to manipulate the `time.Now` function. The patch allows testing with fixed timestamps. + +Instead, MacOS users can utilize the `make test-in-docker` target to execute the tests.