summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-05-23 05:01:55 -0300
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-06-20 08:08:32 -0300
commite92c41b73121d491899f63e480505959a7d15f99 (patch)
tree674ed8c397d5cfb0ba847fd562376f78ca5cbcf6
parentf9a07b964ddca6e20bf23f7557e20465b24b9da6 (diff)
downloadmullvadvpn-e92c41b73121d491899f63e480505959a7d15f99.tar.xz
mullvadvpn-e92c41b73121d491899f63e480505959a7d15f99.zip
Separate execution of integration tests
Use a script to run them to ensure they are testing the correct version of the `mullvad-daemon` binary.
-rw-r--r--.travis.yml8
-rw-r--r--README.md7
-rwxr-xr-xintegration-tests.sh13
-rw-r--r--mullvad-tests/Cargo.toml3
-rw-r--r--mullvad-tests/tests/connection.rs2
-rw-r--r--mullvad-tests/tests/startup.rs2
6 files changed, 31 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml
index 6749e60138..80554d2727 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -52,20 +52,24 @@ matrix:
- rustup component add rustfmt-preview
- rustfmt --version
- cargo fmt -- --check --unstable-features
+ - ./integration-tests.sh
- language: rust
rust: beta
os: linux
cache: cargo
before_script: *rust_before_script
- script: *rust_script
+ script: &rust_linux_script
+ - cargo build --verbose
+ - cargo test --verbose
+ - ./integration-tests.sh
- language: rust
rust: stable
os: linux
cache: cargo
before_script: *rust_before_script
- script: *rust_script
+ script: *rust_linux_script
notifications:
diff --git a/README.md b/README.md
index becd35065f..423c6a0f52 100644
--- a/README.md
+++ b/README.md
@@ -171,6 +171,13 @@ the version of the app you are going to release. For example `2018.3-beta1` or `
Please pay attention to the output at the end of the script and make sure the version it says
it built matches what you want to release.
+## Running Integration Tests
+
+The integration tests are located in the `mullvad-tests` crate. It uses a mock OpenVPN binary to
+test the `mullvad-daemon`. To run the tests, the `mullvad-daemon` binary must be built first.
+Afterwards, the tests should be executed with the `integration-tests` feature enabled. To simplify
+this procedure, the `integration-tests.sh` script can be used to run all integration tests.
+
## Command line tools for Electron GUI app development
diff --git a/integration-tests.sh b/integration-tests.sh
new file mode 100755
index 0000000000..cfb5cdfdd8
--- /dev/null
+++ b/integration-tests.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+MULLVAD_DIR="$(cd "$(dirname "$0")"; pwd -P)"
+
+pushd "$MULLVAD_DIR"
+
+cargo build \
+ && cd mullvad-tests \
+ && cargo test --features "integration-tests"
+
+RESULT="$?"
+popd
+exit "$RESULT"
diff --git a/mullvad-tests/Cargo.toml b/mullvad-tests/Cargo.toml
index 2ef906fd01..b114245c32 100644
--- a/mullvad-tests/Cargo.toml
+++ b/mullvad-tests/Cargo.toml
@@ -5,6 +5,9 @@ authors = ["Mullvad VPN <admin@mullvad.net>", "Janito Vaqueiro Ferreira Filho <j
description = "Mullvad test specific modules and binaries"
license = "GPL-3.0"
+[features]
+integration-tests = []
+
[dependencies]
duct = "0.10"
mullvad-ipc-client = { path = "../mullvad-ipc-client" }
diff --git a/mullvad-tests/tests/connection.rs b/mullvad-tests/tests/connection.rs
index a37721e1e1..38dba38c2d 100644
--- a/mullvad-tests/tests/connection.rs
+++ b/mullvad-tests/tests/connection.rs
@@ -1,4 +1,4 @@
-#![cfg(target_os = "linux")]
+#![cfg(all(target_os = "linux", feature = "integration-tests"))]
extern crate mullvad_ipc_client;
extern crate mullvad_tests;
diff --git a/mullvad-tests/tests/startup.rs b/mullvad-tests/tests/startup.rs
index 5bef9a58c5..379755536a 100644
--- a/mullvad-tests/tests/startup.rs
+++ b/mullvad-tests/tests/startup.rs
@@ -1,4 +1,4 @@
-#![cfg(target_os = "linux")]
+#![cfg(all(target_os = "linux", feature = "integration-tests"))]
extern crate mullvad_paths;
extern crate mullvad_tests;