Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update stepup config after install #18

Merged
merged 4 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/stepup-behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
env:
DOCKER_COMPOSE: docker compose -f docker-compose.yml -f docker-compose-behat.yml
DOCKER_COMPOSE: docker compose -f docker-compose.yml
steps:
- name: Checkout
uses: actions/checkout@v1
Expand All @@ -30,13 +30,13 @@ jobs:
- name: Install composer dependencies on the Behat container
run: |
cd stepup
${DOCKER_COMPOSE} exec -T behat bash -lc "composer install --ignore-platform-reqs -n"
${DOCKER_COMPOSE} exec behat composer install --ignore-platform-reqs -n
- name: Sleep for 10 seconds
run: sleep 10s
- name: Run Behat tests
run: |
cd stepup
docker exec -t stepup-behat-1 bash -lc "./behat"
${DOCKER_COMPOSE} exec behat ./behat
- name: Output logs on failure
if: failure()
run: |
Expand Down
19 changes: 10 additions & 9 deletions stepup/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# OpenConext Stepup config for development and testing purposes

This folder contains configuration that is needed to get an OpenConext Stepup developmentenvironment up and running.
This folder contains configuration that is needed to get an OpenConext Stepup developmentenvironment up and running.

The main configuration for each app can be found in each application repository. The extension .dist is used for that (parameters.yaml.dist for instance). The idea is that these configuration files contain everything necessary to get a development environment up and running and that there is no need to change that. The containers will have a working copy of those .dist configuration files.
This repository contains the docker-compose.yml to get all containers that are used for development up and running.

* The application containers
* The application containers
* A loadbalancer in front of it
* A MariaDB container for the databases.

A SQL in the directory dbschema which creates databases and users needed for OpenConext Stepup development is mounted in the MariaDB container.
A SQL in the directory dbschema which creates databases and users needed for OpenConext Stepup development is mounted in the MariaDB container.

The application config directories contain the SAML key material. Those are not shipped with the application containers to prevent accidental usage of that key material in a production environment. The docker-compose mounts the application specific directory in /config.
The application config directories contain the SAML key material. Those are not shipped with the application containers to prevent accidental usage of that key material in a production environment. The docker-compose mounts the application specific directory in /config.

# Getting everything up and running

Expand Down Expand Up @@ -75,7 +75,7 @@ You can add as many services+local code paths that you need.
The recommended way is to use absolute paths and the script requires the name of the service and local code path to be separated by a `:`, for each service.

# Accessing the database from your IDE
The Maria DB container exposes her 3306 port to the outside. So you should be able to connect to the database with
The Maria DB container exposes her 3306 port to the outside. So you should be able to connect to the database with
your favorite DBA tool. In PHPStorm I was able to connect to the `mariadb` host by using these setting.

```
Expand All @@ -89,7 +89,7 @@ The default development container is based on the base image with PHP7.2. You ca

# Functional testing
The stepup application suite comes with a set of Behat (Gherkin) features. These features test the stepup applications
functionally. These tests range from simple smoketests (can we still vet a token), to more bug report driven
functionally. These tests range from simple smoketests (can we still vet a token), to more bug report driven
functional tests. And everything in between.

These tests live in this folder: `stepup/tests/behat/features`
Expand Down Expand Up @@ -117,16 +117,17 @@ STEPUP_VERSION=test
3. Choose if you want to run the containers in the back- or foreground.

3: Once the containers are up and running, you can run the behat tests
1. Open a shell in the `behat` container `$ docker exec -it stepup-behat-1 bash`
2. Run the tests:
1. Install the required dependencies in the container `$ docker compose exec behat composer install`
2. Open a shell in the `behat` container `$ docker compose exec behat bash`
3. Run the tests:
1. `./behat` will run all available behat tests that are not excluded using the `@SKIP` tag
2. `./behat features/ra.feature` will only run the `ra.feature` found in the features folder
3. `./behat features/ra.feature:20` will only run the scenario found on line 20 of the `ra.feature`
4. TODO: `./behat --filter=selfservice` will only run features marked with the `@selfservice` tag

## Writing tests
Many of the step definitions are coded in our own Contexts. These contexts are divided into five main contexts.
It should be straightforward where to add new definitions. The contexts are not following all the clean code or solid principles. This code is messy, be warned.
It should be straightforward where to add new definitions. The contexts are not following all the clean code or solid principles. This code is messy, be warned.

It can be useful during debugging to use the `$this->diePrintingContent();` statement. This outputs the URI of the browser, and the last received html response. As it is hard to step debug the code that is run in a CURL based browser.

Expand Down
12 changes: 0 additions & 12 deletions stepup/docker-compose-behat.yml

This file was deleted.

26 changes: 26 additions & 0 deletions stepup/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ services:
volumes:
- ${PWD}/dbschema:/docker-entrypoint-initdb.d
- stepup_mariadb:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
hostname: mariadb.docker

behat:
Expand All @@ -56,6 +58,9 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"
hostname: webauthn.docker
depends_on:
mariadb:
condition: service_healthy

ssp:
image: ghcr.io/openconext/openconext-devssp/devssp:latest
Expand All @@ -77,6 +82,9 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"
hostname: middleware.docker
depends_on:
mariadb:
condition: service_healthy

gateway:
image: ghcr.io/openconext/stepup-gateway/stepup-gateway:${STEPUP_VERSION:-prod}
Expand All @@ -90,6 +98,9 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"
hostname: gateway.docker
depends_on:
mariadb:
condition: service_healthy

ra:
image: ghcr.io/openconext/stepup-ra/stepup-ra:${STEPUP_VERSION:-prod}
Expand All @@ -102,6 +113,9 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"
hostname: ra.docker
depends_on:
mariadb:
condition: service_healthy

selfservice:
image: ghcr.io/openconext/stepup-selfservice/stepup-selfservice:${STEPUP_VERSION:-prod}
Expand All @@ -114,6 +128,9 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"
hostname: selfservice.docker
depends_on:
mariadb:
condition: service_healthy

demogssp:
image: ghcr.io/openconext/stepup-gssp-example/stepup-gssp-example:${STEPUP_VERSION:-prod}
Expand All @@ -126,6 +143,9 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"
hostname: demogssp.docker
depends_on:
mariadb:
condition: service_healthy

tiqr:
image: ghcr.io/openconext/stepup-tiqr/stepup-tiqr:prod
Expand All @@ -138,6 +158,9 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"
hostname: tiqr.docker
depends_on:
mariadb:
condition: service_healthy

azuremfa:
image: ghcr.io/openconext/stepup-azuremfa/stepup-azuremfa:${STEPUP_VERSION:-prod}
Expand All @@ -150,6 +173,9 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"
hostname: azuremfa.docker
depends_on:
mariadb:
condition: service_healthy

mailcatcher:
image: sj26/mailcatcher:latest
Expand Down
42 changes: 0 additions & 42 deletions stepup/docs/functional-testing.md

This file was deleted.

1 change: 0 additions & 1 deletion stepup/start-dev-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ else
fi

if [ "${STEPUP_VERSION}" == "test" ]; then
extra_compose_args="-f docker-compose-behat.yml"
MODE="test"
echo -e "${GREEN}Starting in test mode${ENDCOLOR}"
else
Expand Down
15 changes: 13 additions & 2 deletions stepup/tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
FROM ghcr.io/openconext/openconext-basecontainers/php72-apache2-node16-composer2:latest
RUN apt-get update && \
apt-get install -y docker.io mariadb-client
RUN apt-get update && \
apt-get install -y mariadb-client && \
apt-get install -y ca-certificates curl && \
install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc && \
chmod a+r /etc/apt/keyrings/docker.asc && \
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt-get update && \
apt install -y docker-ce docker-ce-cli containerd.io

WORKDIR /config/tests/behat
Loading
Loading