You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for taking the time to contribute to Matrix!
4
+
5
+
This is the repository for Complement, a black box integration testing framework for Matrix homeservers.
6
+
7
+
## Sign off
8
+
9
+
We ask that everybody who contributes to this project signs off their contributions, as explained below.
10
+
11
+
We follow a simple 'inbound=outbound' model for contributions: the act of submitting an 'inbound' contribution means that the contributor agrees to license their contribution under the same terms as the project's overall 'outbound' license - in our case, this is Apache Software License v2 (see [LICENSE](./LICENSE)).
12
+
13
+
In order to have a concrete record that your contribution is intentional and you agree to license it under the same terms as the project's license, we've adopted the same lightweight approach used by the [Linux Kernel](https://www.kernel.org/doc/html/latest/process/submitting-patches.html), [Docker](https://github.com/docker/docker/blob/master/CONTRIBUTING.md), and many other projects: the [Developer Certificate of Origin](https://developercertificate.org/) (DCO). This is a simple declaration that you wrote the contribution or otherwise have the right to contribute it to Matrix:
14
+
15
+
```
16
+
Developer Certificate of Origin
17
+
Version 1.1
18
+
19
+
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
20
+
660 York Street, Suite 102,
21
+
San Francisco, CA 94110 USA
22
+
23
+
Everyone is permitted to copy and distribute verbatim copies of this
24
+
license document, but changing it is not allowed.
25
+
26
+
Developer's Certificate of Origin 1.1
27
+
28
+
By making a contribution to this project, I certify that:
29
+
30
+
(a) The contribution was created in whole or in part by me and I
31
+
have the right to submit it under the open source license
32
+
indicated in the file; or
33
+
34
+
(b) The contribution is based upon previous work that, to the best
35
+
of my knowledge, is covered under an appropriate open source
36
+
license and I have the right under that license to submit that
37
+
work with modifications, whether created in whole or in part
38
+
by me, under the same open source license (unless I am
39
+
permitted to submit under a different license), as indicated
40
+
in the file; or
41
+
42
+
(c) The contribution was provided directly to me by some other
43
+
person who certified (a), (b) or (c) and I have not modified
44
+
it.
45
+
46
+
(d) I understand and agree that this project and the contribution
47
+
are public and that a record of the contribution (including all
48
+
personal information I submit with it, including my sign-off) is
49
+
maintained indefinitely and may be redistributed consistent with
50
+
this project or the open source license(s) involved.
51
+
```
52
+
53
+
If you agree to this for your contribution, then all that's needed is to include the line in your commit or pull request comment:
Git allows you to add this signoff automatically when using the `-s` flag to `git commit`, which uses the name and email set in your `user.name` and `user.email` git configs.
Copy file name to clipboardExpand all lines: ENVIRONMENT.md
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
Complement is configured exclusively through the use of environment variables. These variables are described below.
5
5
6
6
#### `COMPLEMENT_ALWAYS_PRINT_SERVER_LOGS`
7
-
If 1, always prints the Homeserver container logs even on success.
7
+
If 1, always prints the Homeserver container logs even on success. When used with COMPLEMENT_ENABLE_DIRTY_RUNS, server logs are only printed once for reused deployments, at the very end of the test suite.
8
8
- Type: `bool`
9
9
- Default: 0
10
10
@@ -21,6 +21,11 @@ If 1, prints out more verbose logging such as HTTP request/response bodies.
21
21
- Type: `bool`
22
22
- Default: 0
23
23
24
+
#### `COMPLEMENT_ENABLE_DIRTY_RUNS`
25
+
If 1, eligible tests will be provided with reusable deployments rather than a clean deployment. Eligible tests are tests run with `Deploy(t, numHomeservers)`. If enabled, COMPLEMENT_ALWAYS_PRINT_SERVER_LOGS and COMPLEMENT_POST_TEST_SCRIPT are run exactly once, at the end of all tests in the package. The post test script is run with the test name "COMPLEMENT_ENABLE_DIRTY_RUNS", and failed=false. Enabling dirty runs can greatly speed up tests, at the cost of clear server logs and the chance of tests polluting each other. Tests using `OldDeploy` and blueprints will still have a fresh image for each test. Fresh images can still be desirable e.g user directory tests need a clean homeserver else search results can be polluted, tests which can blacklist a server over federation also need isolated deployments to stop failures impacting other tests. For these reasons, there will always be a way for a test to override this setting and get a dedicated deployment. Eventually, dirty runs will become the default running mode of Complement, with an environment variable to disable this behaviour being added later, once this has stablised.
26
+
- Type: `bool`
27
+
- Default: 0
28
+
24
29
#### `COMPLEMENT_HOSTNAME_RUNNING_COMPLEMENT`
25
30
The hostname of Complement from the perspective of a Homeserver running inside a container. This can be useful for container runtimes using another hostname to access the host from a container, like Podman that uses `host.containers.internal` instead.
26
31
- Type: `string`
@@ -35,7 +40,7 @@ A list of space separated blueprint names to not clean up after running. For exa
35
40
- Type: `[]string`
36
41
37
42
#### `COMPLEMENT_POST_TEST_SCRIPT`
38
-
An arbitrary script to execute after a test was executed and before the container is removed. This can be used to extract, for example, server logs or database files. The script is passed the parameters: ContainerID, TestName, TestFailed (true/false)
43
+
An arbitrary script to execute after a test was executed and before the container is removed. This can be used to extract, for example, server logs or database files. The script is passed the parameters: ContainerID, TestName, TestFailed (true/false). When combined with COMPLEMENT_ENABLE_DIRTY_RUNS, the script is called exactly once at the end of the test suite, and is called with the TestName of "COMPLEMENT_ENABLE_DIRTY_RUNS" and TestFailed=false.
If you are only running these tests and no other Complement tests (e.g the main ones in the Complement repo) *in parallel* (i.e `go test ./complement/tests ./myrepo/tests`) then the namespace value doesn't matter. If you _are_ running other tests in parallel the namespace needs to be unique for all possible Complement test packages, otherwise you will get container conflicts. So don't call it "fed" or "csapi" as they are used by the main Complement tests.
60
+
61
+
Now set up a `COMPLEMENT_BASE_IMAGE` and run `COMPLEMENT_BASE_IMAGE=homeserver:latest go test -v ./tests`:
If all the networking tests don't seem to pass, it might be because the default rootless network command `pasta` doesn't work in recent versions of Podman (see [this issue](https://github.com/containers/podman/issues/22653)). If that happens to you, consider changing it in Podman's configuration file located at `/etc/containers/containers.conf`:
52
+
53
+
```
54
+
default_rootless_network_cmd = "slirp4netns"
55
+
```
56
+
66
57
Docker image format is needed because OCI format doesn't support the HEALTHCHECK directive unfortunately.
$ COMPLEMENT_BASE_IMAGE=complement-dendrite:latest go test -v ./tests/...
77
68
```
78
69
79
70
### Running against Synapse
80
71
81
-
If you're looking to run Complement against a local dev instance of Synapse, see [`matrix-org/synapse` -> `scripts-dev/complement.sh`](https://github.com/matrix-org/synapse/blob/develop/scripts-dev/complement.sh).
72
+
If you're looking to run Complement against a local dev instance of Synapse, see [`element-hq/synapse` -> `scripts-dev/complement.sh`](https://github.com/element-hq/synapse/blob/develop/scripts-dev/complement.sh).
82
73
83
74
If you want to develop Complement tests while working on a local dev instance
0 commit comments