2020-02-29 00:43:59 +00:00
|
|
|
---
|
|
|
|
layout: default
|
|
|
|
title: Suites
|
|
|
|
parent: Contributing
|
2021-04-11 11:25:03 +00:00
|
|
|
nav_order: 5
|
2020-02-29 00:43:59 +00:00
|
|
|
---
|
|
|
|
|
2019-03-02 23:25:40 +00:00
|
|
|
# Suites
|
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
Authelia is a single component in interaction with many others in a complete
|
|
|
|
ecosystem. Consequently, testing the features is not as easy as we might
|
|
|
|
think. In order to solve this problem, Authelia came up with the concept of
|
|
|
|
suite which is a kind of virtual environment for Authelia and a set of tests.
|
|
|
|
A suite can setup components such as nginx, redis or mariadb in which
|
|
|
|
Authelia can run and be tested.
|
2019-03-02 23:25:40 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
This abstraction allows to prepare an environment for manual testing during
|
|
|
|
development and also to craft and run integration tests efficiently.
|
2019-03-02 23:25:40 +00:00
|
|
|
|
|
|
|
## Start a suite.
|
|
|
|
|
2019-11-16 10:38:21 +00:00
|
|
|
Starting a suite called *Standalone* is done with the following command:
|
2019-03-02 23:25:40 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
$ authelia-scripts suites setup Standalone
|
2019-03-02 23:25:40 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
This command deploys the environment of the suite.
|
2019-03-02 23:25:40 +00:00
|
|
|
|
|
|
|
## Run tests of a suite
|
|
|
|
|
|
|
|
### Run tests of running suite
|
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
If a suite is already running, you can simply type the test command
|
|
|
|
that will run the test related to the currently running suite:
|
2019-03-02 23:25:40 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
$ authelia-scripts suites test
|
2019-03-02 23:25:40 +00:00
|
|
|
|
|
|
|
### Run tests of non-running suite
|
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
However, if no suite is running yet and you just want to run the tests of a
|
|
|
|
specific suite like *HighAvailability*, you can do so with the next command:
|
2019-03-02 23:25:40 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
# Set up the env, run the tests and tear down the env
|
|
|
|
$ authelia-scripts suites test HighAvailability
|
2019-03-02 23:25:40 +00:00
|
|
|
|
|
|
|
### Run all tests of all suites
|
|
|
|
|
2019-03-03 22:51:52 +00:00
|
|
|
Running all tests is easy. Make sure that no suite is already running and run:
|
2019-03-02 23:25:40 +00:00
|
|
|
|
2020-04-11 04:46:07 +00:00
|
|
|
$ authelia-scripts suites test
|
2019-03-03 22:51:52 +00:00
|
|
|
|
|
|
|
### Run tests in headless mode
|
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
As you might have noticed, the tests are run using chromedriver and selenium. It means
|
|
|
|
that the tests open an instance of Chrome that might interfere with your other activities.
|
|
|
|
In order to run the tests in headless mode to avoid the interference, use the following
|
|
|
|
command:
|
2019-03-03 22:51:52 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
$ authelia-scripts suites test --headless
|
2019-03-02 23:25:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
## Create a suite
|
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
Creating a suite is as easy. Let's take the example of the **Standalone** suite:
|
|
|
|
|
|
|
|
* **suite_standalone.go** - It defines the setup and teardown phases. It likely uses
|
|
|
|
docker-compose to setup the ecosystem. This file also defines the timeouts.
|
|
|
|
* **suite_standalone_test.go** - It defines the set of tests to run against the suite.
|
|
|
|
* **Standalone** directory - It contains resources required by the suite and likely
|
|
|
|
mounted in the containers.
|
2019-03-02 23:25:40 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
A suite can also be much more complex like setting up a complete Kubernetes ecosystem.
|
|
|
|
You can check the Kubernetes suite as example.
|