Skip to content

Commit

Permalink
Merge branch 'document-default-test-locations'
Browse files Browse the repository at this point in the history
  • Loading branch information
Serock3 committed Jan 22, 2025
2 parents 8c94061 + 04b3d9c commit 0144118
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 40 deletions.
85 changes: 55 additions & 30 deletions test/test-manager/docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,25 @@ The above example will set the locations for the test `test_daita` to a custom l
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_ui_tunnel_settings": ["se-got"] },
{ "*": ["se", "no", "fi", "dk"] }
]
}
```

## Example configurations

### Minimal
Expand All @@ -66,36 +85,42 @@ A configuration containing one Debian 12 VM and one Windows 11 VM

```json
{
"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
}
"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
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/test-manager/src/tests/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,15 +460,15 @@ pub async fn connect_and_wait(
}

pub async fn disconnect_and_wait(mullvad_client: &mut MullvadProxyClient) -> Result<(), Error> {
log::debug!("Disconnecting");
log::trace!("Disconnecting");
mullvad_client.disconnect_tunnel().await?;

wait_for_tunnel_state(mullvad_client.clone(), |state| {
matches!(state, TunnelState::Disconnected { .. })
})
.await?;

log::debug!("Disconnected");
log::trace!("Disconnected");

Ok(())
}
Expand Down
10 changes: 2 additions & 8 deletions test/test-manager/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,12 @@ pub async fn set_test_location(
})
.try_collect()?;

log::debug!(
"Creating custom list {} with locations '{:?}'",
test.name,
locations
);

// Add the custom list to the current app instance
// NOTE: This const is actually defined in, `mullvad_types::custom_list`, but we cannot import it.
const CUSTOM_LIST_NAME_MAX_SIZE: usize = 30;
let mut custom_list_name = test.name.to_string();
custom_list_name.truncate(CUSTOM_LIST_NAME_MAX_SIZE);
log::debug!("Creating custom list {custom_list_name} with locations '{locations:?}'");
log::debug!("Creating custom list `{custom_list_name}` with locations '{locations:?}'");

let list_id = mullvad_client
.create_custom_list(custom_list_name.clone())
Expand All @@ -202,7 +196,7 @@ pub async fn set_test_location(
custom_list.locations.insert(location);
}
mullvad_client.update_custom_list(custom_list).await?;
log::debug!("Added custom list");
log::trace!("Added custom list");

set_location(mullvad_client, LocationConstraint::CustomList { list_id })
.await
Expand Down

0 comments on commit 0144118

Please sign in to comment.