Skip to content

Commit

Permalink
tests: upgrade oidc-server-mock to run tests on Mac M1
Browse files Browse the repository at this point in the history
  • Loading branch information
AleF83 committed Mar 19, 2023
1 parent 738715c commit 3ec3389
Show file tree
Hide file tree
Showing 30 changed files with 8,132 additions and 5,509 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/addons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ name: Addons Tests
on:
push:
paths:
- 'addons/**'
- '.github/workflows/addons.yaml'
- 'addons/**'
- '.github/workflows/addons.yaml'
jobs:
run-context-tests:
runs-on: ubuntu-latest
container: mcr.microsoft.com/dotnet/sdk:5.0
env:
DOTNET_CLI_TELEMETRY_OPTOUT: "true"
REDIS_TEST_CONNECTION: "redis:6379"
MONGODB_TEST_CONNECTION: "mongodb://mongo:27017"
COUCHBASE_TEST_URL: "http://couchbase:8091"
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
REDIS_TEST_CONNECTION: 'redis:6379'
MONGODB_TEST_CONNECTION: 'mongodb://mongo:27017'
COUCHBASE_TEST_URL: 'http://couchbase:8091'

services:
redis:
Expand All @@ -23,17 +23,20 @@ jobs:
mongo:
image: mongo:3.6-jessie
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Test redis driver
working-directory: addons/Context/Tweek.Drivers.Context.Redis.IntegrationTests
run: |
dotnet test
dotnet test
- name: Test Couchbase driver
working-directory: addons/Context/Tweek.Drivers.Context.Couchbase.IntegrationTests
run: |
curl --retry 3 --retry-max-time 10 -v http://couchbase:8091/settings/web -d port=8091 -d username=Administrator -d password=password
curl --retry 3 --retry-max-time 10 -v -u Administrator:password -X POST http://couchbase:8091/pools/default/buckets -d authType=sasl -d name=testbucket -d ramQuotaMB=100 -d saslPassword=password
dotnet test
- name: Test Mongo driver
working-directory: addons/Context/Tweek.Drivers.Context.MongoDb.IntegrationTests
run: |
Expand Down
72 changes: 49 additions & 23 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,146 +3,172 @@ name: Main
on:
push:
paths-ignore:
- 'docs/**'
- README.md
- 'docs/**'
- README.md
jobs:
build-images:
runs-on: ubuntu-latest
strategy:
matrix:
image: ["authoring", "gateway", "publishing", "api", "editor"]
image: ['authoring', 'gateway', 'publishing', 'api', 'editor']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Login Docker DH
if: ${{ github.repository == 'soluto/tweek' }}
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKER_TOKEN }}
DOCKERHUB_USER: ${{ secrets.DOCKER_USER }}
run: echo $DOCKERHUB_TOKEN | docker login --username $DOCKERHUB_USER --password-stdin

- name: build
run: |
echo $GITHUB_REPOSITORY
yarn docker-compose build ${{ matrix.image }} && \
docker save -o ${{ matrix.image }}-${{ github.sha }}.tar soluto/tweek-${{ matrix.image }} && \
echo cp -a ${{ matrix.image }}-${{ github.sha }}.tar .github/workflows/
cp -a ${{ matrix.image }}-${{ github.sha }}.tar .github/workflows/
- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: build-images
path: |
.github/workflows/${{ matrix.image }}-${{ github.sha }}.tar
run-e2e-ui:
needs: ["build-images"]
needs: ['build-images']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Download build images
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: build-images

- name: load images into docker
run: echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker load -i {}-$GITHUB_SHA.tar

- name: run tests
run: yarn && yarn test:docker:ui

run-e2e-integration:
needs: ["build-images"]
needs: ['build-images']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Download build images
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: build-images

- name: load images into docker
run: echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker load -i {}-$GITHUB_SHA.tar

- name: run integration tests
working-directory: e2e/integration
run: |
yarn && yarn start gateway && yarn test:docker
run-net-tests:
needs: ["build-images"]
needs: ['build-images']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Download build images
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: build-images

- name: load images into docker
run: echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker load -i {}-$GITHUB_SHA.tar

- name: run smoke tests
run: yarn && yarn test:docker:smoke

push-images:
needs: ["run-net-tests", "run-e2e-integration", "run-e2e-ui"]
needs: ['run-net-tests', 'run-e2e-integration', 'run-e2e-ui']
runs-on: ubuntu-latest
if: ${{ github.repository == 'soluto/tweek' && !startsWith(github.ref, 'refs/heads/dependabot') }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Login Docker DH
if: ${{ github.repository == 'soluto/tweek' }}
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKER_TOKEN }}
DOCKERHUB_USER: ${{ secrets.DOCKER_USER }}
run: echo $DOCKERHUB_TOKEN | docker login --username $DOCKERHUB_USER --password-stdin

- name: Download build images
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: build-images

- name: load images into docker
run: echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker load -i {}-$GITHUB_SHA.tar

- name: push branch
if: ${{ github.ref != 'refs/heads/master' }}
run: |
export GITHUB_BRANCH=$(echo $GITHUB_REF | sed -e "s/refs\/heads\///" -e "s/\//-/")
echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker tag soluto/tweek-{} soluto/tweek-{}:$GITHUB_BRANCH
echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker push soluto/tweek-{}:$GITHUB_BRANCH
- name: push master
if: ${{ github.ref == 'refs/heads/master' }}
run: |
echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker tag soluto/tweek-{} soluto/tweek-{}:latest
echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker push soluto/tweek-{}:latest
echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker tag soluto/tweek-{} soluto/tweek-{}:$GITHUB_SHA
echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker push soluto/tweek-{}:$GITHUB_SHA
- name: check versions
if: ${{ github.ref == 'refs/heads/master' }}
working-directory: ".github/workflows"
working-directory: '.github/workflows'
run: |
./versions_to_deploy.sh
- name: Push new api version
if: ${{ github.ref == 'refs/heads/master' && env.TWEEK_API_VERSION != '' }}
working-directory: ".github/workflows"
working-directory: '.github/workflows'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./push-tag.sh api $TWEEK_API_VERSION
- name: Push new editor version
if: ${{ github.ref == 'refs/heads/master' && env.TWEEK_EDITOR_VERSION != '' }}
working-directory: ".github/workflows"
working-directory: '.github/workflows'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./push-tag.sh editor $TWEEK_EDITOR_VERSION
- name: Push new authoring version
if: ${{ github.ref == 'refs/heads/master' && env.TWEEK_AUTHORING_VERSION != '' }}
working-directory: ".github/workflows"
working-directory: '.github/workflows'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./push-tag.sh authoring $TWEEK_AUTHORING_VERSION
- name: Push new publishing version
if: ${{ github.ref == 'refs/heads/master' && env.TWEEK_PUBLISHING_VERSION != '' }}
working-directory: ".github/workflows"
working-directory: '.github/workflows'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./push-tag.sh publishing $TWEEK_PUBLISHING_VERSION
- name: Push new gateway version
if: ${{ github.ref == 'refs/heads/master' && env.TWEEK_GATEWAY_VERSION != '' }}
working-directory: ".github/workflows"
working-directory: '.github/workflows'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,6 @@ _Pvt_Extensions
#publish profiles
PublishProfiles/
.history/


.yarn/
3 changes: 2 additions & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
docker_compose("./deployments/dev/tilt.yml" )
docker_build("soluto/tweek-gateway", "services/gateway",dockerfile="services/gateway/debug.Dockerfile")
docker_build("soluto/tweek-gateway", "services/gateway",dockerfile="services/gateway/Dockerfile")

docker_build("soluto/tweek-authoring", "services/authoring")
docker_build("soluto/tweek-api", ".", dockerfile="TweekApi.Dockerfile")
Expand All @@ -10,6 +10,7 @@ docker_build("soluto/tweek-editor", "services/editor",dockerfile="services/edito
sync('services/editor/src', '/app/src'),
]
)
docker_build("soluto/tweek-bare-repo", "services/git-service/BareRepository")

dc_resource('minio')
dc_resource('redis')
Expand Down
2 changes: 2 additions & 0 deletions deployments/dev/docker-compose.e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ services:
- editor

environment:
- NODE_TLS_REJECT_UNAUTHORIZED=0
- GATEWAY_URL=http://gateway
- EDITOR_URL=http://gateway
- AUTH_DIGEST_CREDENTIALS=user:pwd
Expand All @@ -90,6 +91,7 @@ services:
depends_on:
- gateway
environment:
- NODE_TLS_REJECT_UNAUTHORIZED=0
- GATEWAY_URL=http://gateway
- MINIO_HOST=minio
- MINIO_PORT=9000
Expand Down
10 changes: 8 additions & 2 deletions deployments/dev/docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ services:
- "5859:5858"
- "4005:3000"
environment:
- NODE_TLS_REJECT_UNAUTHORIZED=0
- GIT_USER=git
- GIT_URL=ssh://git@publishing/tweek/repo
- GIT_PUBLIC_KEY_PATH=/run/secrets/tweek_ssh_public_key
Expand Down Expand Up @@ -112,11 +113,16 @@ services:

oidc-server-mock:
container_name: oidc-server-mock
image: soluto/oidc-server-mock:0.1.0
image: ghcr.io/soluto/oidc-server-mock:0.5.2
ports:
- "8082:80"
- "8082:443"
volumes:
- ./https:/https:ro
environment:
ASPNETCORE_ENVIRONMENT: Development
ASPNETCORE_URLS: https://+:443
ASPNETCORE_Kestrel__Certificates__Default__Password: oidc-server-mock-pwd
ASPNETCORE_Kestrel__Certificates__Default__Path: /https/aspnetapp.pfx
CLIENTS_CONFIGURATION_INLINE: |
[
{
Expand Down
6 changes: 3 additions & 3 deletions deployments/dev/gateway/config/gateway.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"providers": {
"mock": {
"name": "Mock OpenId Connect server",
"issuer": "http://localhost:8082",
"authority": "http://localhost:8082",
"jwks_uri": "http://oidc-server-mock/.well-known/openid-configuration/jwks",
"issuer": "https://localhost:8082",
"authority": "https://localhost:8082",
"jwks_uri": "https://oidc-server-mock/.well-known/openid-configuration/jwks",
"client_id": "tweek-openid-mock-client",
"login_info": {
"login_type": "oidc",
Expand Down
6 changes: 3 additions & 3 deletions deployments/dev/gateway/config/gateway.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"providers": {
"mock": {
"name": "Mock OpenId Connect server",
"issuer": "http://localhost:8082",
"authority": "http://localhost:8082",
"jwks_uri": "http://localhost:8082/.well-known/openid-configuration/jwks",
"issuer": "https://localhost:8082",
"authority": "https://localhost:8082",
"jwks_uri": "https://localhost:8082/.well-known/openid-configuration/jwks",
"client_id": "tweek-openid-mock-client",
"login_info": {
"login_type": "oidc",
Expand Down
6 changes: 3 additions & 3 deletions deployments/dev/gateway/config/gateway.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"providers": {
"mock": {
"name": "Mock OpenId Connect server",
"issuer": "http://oidc-server-mock",
"authority": "http://oidc-server-mock",
"jwks_uri": "http://oidc-server-mock/.well-known/openid-configuration/jwks",
"issuer": "https://oidc-server-mock",
"authority": "https://oidc-server-mock",
"jwks_uri": "https://oidc-server-mock/.well-known/openid-configuration/jwks",
"client_id": "tweek-openid-mock-client",
"login_info": {
"login_type": "oidc",
Expand Down
Binary file added deployments/dev/https/aspnetapp.pfx
Binary file not shown.
Loading

0 comments on commit 3ec3389

Please sign in to comment.