summaryrefslogtreecommitdiffhomepage
path: root/test/test-manager/docs/config.md
blob: 9f5f779fdd4268124262e019b3ff68dcd48ac305 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Introduction

This document outlines the format of the configuration used by `test-manager` to perform end-to-end tests in virtualized environments.

## Format

The configuration is a JSON document with three values:

```json
{
    "mullvad_host": <optional string>,
    "vms": <document>,
    "test_locations": [ {"test_name": ["relay"] }, .. ],
}
```

The configurable values are prone to change, and for the time being it is probably a good idea to get acquainted with the [Rust struct called "Config"](../src/config.rs) from which the configuration is serialized.
To get started, `test-manager` provides the `test-manager config vm set` command to add and edit VM configurations.
It is also recommended to view the [example section](#Examples) further down this document.

## Location

The configuration is assumed to exist in `$XDG_CONFIG_HOME/mullvad-test/config.json` (most likely `$HOME/.config/mullvad-test/config.json`) on Linux and `$HOME/Library/Application Support/mullvad-test/config.json` on macOS.

## Per-test relay selection

It is possible to configure which relay(s) should be selected on a test-per-test basis by providing the `test_locations`
configuration option. If no explicit configuration is given, no assumption will be made from within the tests themselves.

The format is a list of maps with a single key-value pair, where the key is a [glob pattern](<https://en.wikipedia.org/wiki/Glob_(programming)>)
that will be matched against the test name, and the value is a list of locations to use for the matching tests.
The name of the locations are the same as for the `mullvad relay set location` CLI-command.

### Example

```json
{
  // other fields
  "test_locations": [
    { "*daita*": ["se-got-wg-001", "se-got-wg-002"] },
    { "*": ["se"] }
  ]
}
```

The above example will set the locations for the test `test_daita` to a custom list
containing `se-got-wg-001` and `se-got-wg-002`. The `*` is a wildcard that will match
any test name. The configuration is read from top-to-bottom, and the first match will be used.

### Test location currently used by the GitHub end to end-test workflow

Below is a copy of the test location setting currently used by the machines that
run the GitHub workflow for desktop end to end tests. Make sure to keep it updated!

```json
{
  "test_locations": [
    { "test_wireguard_over_shadowsocks": ["se-got"] },
    { "test_multihop": ["se-got"] },
    { "test_quantum_resistant_tunnel": ["se-got"] },
    { "test_quantum_resistant_multihop_udp2tcp_tunnel": ["se-got"] },
    { "test_quantum_resistant_multihop_shadowsocks_tunnel": ["se-got"] },
    { "test_quantum_resistant_multihop_quic_tunnel": ["se-sto", "ca-tor"] },
    { "test_ui_tunnel_settings": ["se-got"] },
    { "*": ["se", "no", "fi", "dk"] }
  ]
}
```

## Example configurations

### Minimal

The minimal valid configuration does not contain any virtual machines

```json
{
  "mullvad_host": "stagemole.eu",
  "vms": {}
}
```

### Complete

A configuration containing one Debian 12 VM and one Windows 11 VM

```json
{
  "test_locations": [
    { "test_wireguard_over_shadowsocks": ["se-got"] },
    { "test_multihop": ["se-got"] },
    { "test_quantum_resistant_tunnel": ["se-got"] },
    { "test_quantum_resistant_multihop_udp2tcp_tunnel": ["se-got"] },
    { "test_quantum_resistant_multihop_shadowsocks_tunnel": ["se-got"] },
    { "test_ui_tunnel_settings": ["se-got"] },
    { "*": ["se", "no", "fi", "dk"] }
  ],
  "mullvad_host": "stagemole.eu",
  "vms": {
    "debian12": {
      "vm_type": "qemu",
      "image_path": "$VM_IMAGES/debian12.qcow2",
      "os_type": "linux",
      "package_type": "deb",
      "architecture": "x64",
      "provisioner": "ssh",
      "ssh_user": "test",
      "ssh_password": "test",
      "disks": [],
      "artifacts_dir": "/opt/testing",
      "tpm": false
    },
    "windows11": {
      "vm_type": "qemu",
      "image_path": "$VM_IMAGES/windows11.qcow2",
      "os_type": "windows",
      "package_type": null,
      "architecture": "x64",
      "provisioner": "noop",
      "ssh_user": null,
      "ssh_password": null,
      "disks": ["$TESTRUNNER_IMAGES/windows-test-runner.img"],
      "artifacts_dir": "E:\\",
      "tpm": false
    }
  }
}
```