"Fossies" - the Fresh Open Source Software Archive

Member "wire-server-2021-10-01/docs/developer/how-to.md" (4 Oct 2021, 7397 Bytes) of package /linux/misc/wire-server-2021-10-01.tar.gz:

As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field.

Developer how-to's

The following assume you have a working developer environment with all the dependencies listed in ./dependencies.md available to you.

How to look at the swagger docs / UI locally

Terminal 1:

Terminal 2:

Open your browser at:

Swagger json (for swagger 2.0 endpoints) is available under http://localhost:8080/api/swagger.json

How to run federation tests across two backends


The process consists of:

  1. Inspect/change the multi-backend tests
  2. Decide on code to use by means of using docker images made available by CI, or making docker images available yourself.
  3. Run multi-backend test half-locally half-on-kubernetes or fully on kubernetes

(1) Inspect/change the multi-backend test code

Refer to services/brig/test/integration/API/Federation/End2End.hs for the current multi-backend tests.

Note that they only run if INTEGRATION_FEDERATION_TESTS is set to 1. This is currently configured to be OFF when running regular brig integration tests (e.g. via make -C services/brig integration) but is by default ON when running tests on kubernetes or on CI, or when using the services/brig/federation-tests.sh script.

(2) Decide on code version

Decide which code you would like to use for these tests by setting the DOCKER_TAG environment variable. The following options are detailed in the subsections below.

(A) Use the latest compiled code from develop

First, find the latest CI-compiled code made available as docker images:

# Run all commands from the top directory of wire-server
make latest-tag

Output might be

latest tag for brig:
latest tag for nginz:

Let's assume the tags are the same(*) for both, then export an environment variable:

export DOCKER_TAG=2.104.11

make latest-tag gives different tags for brig and nginz:

(B) Use code from your pull request

Note: CI already runs multi-backend federation integration tests on your PR, so this section may not be often useful in practice. This is still documented for completeness and to help understand the relation between source code and compiled docker images on CI.

Check CI for the latest tag that has been created on your PR (expect this to take at least 30-60 minutes from the last time you pushed to your branch). Example:

Look at a successful job in the wire-server-pr pipeline from a job build matching your desired PR and commit hash. Then, find the actual docker tag used.


# PR 1438 commit 7a183b2dbcf019df1af3d3b97604edac72eca762 translates to
export DOCKER_TAG=0.0.1-pr.3684

(C) Use your local code and kind

This can be useful to get quicker feedback while working on multi-backend code or configuration (e.g. helm charts) than to wait an hour for CI. This allows you to test code without uploading it to github and waiting an hour for CI.

FUTUREWORK: this process is in development (update this section after it's confirmed to work):

(i) Build images
  1. Ensure buildah is available on your system.
  2. Compile the image using make buildah-docker. This will try to upload the images into a kind cluster. If you'd prefer uploading images to quay.io, you can run it with make buildah-docker BUILDAH_PUSH=1 BUILDAH_KIND_LOAD=0
(ii) Run tests in kind
  1. Create a local kind cluster with make kind-cluster
  2. Install wire-server using make kind-integration-setup.
  3. Run tests using make kind-integration-test.
  4. Run end2end integration tests: make kind-integration-e2e.

NOTE: debug this process further as some images (e.g. nginz) are missing from the default buildah steps.

(3) Run multi-backend tests

Once you have chosen the code to test and set DOCKER_TAG accordingly, run the following, which will create two full installations of wire-server on the kubernetes cluster you've configured to connect to, and should take ~10 minutes.

make kube-integration-setup

Next, you can choose to either run all integration tests, which also includes running the multi-backend integration tests by default. Or you can instead choose to only run the multi-backend tests.

Run all integration tests on kubernetes

make kube-integration-test

Run only the multi-backend tests

  1. ensure you have compiled brig-integration: make -C services/brig fast
  2. ensure you have telepresence installed (see developer dependencies documentation)
  3. Run the actual tests, (takes half a minute):
./services/brig/federation-tests.sh test-$USER

Note that this runs your locally compiled brig-integration, so this allows to easily change test code locally with the following process:

  1. change code under services/brig/test/integration/Federation/
  2. recompile: make -C services/brig fast
  3. run ./services/brig/federation-tests.sh test-$USER again.