summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-04-19 21:09:07 -0300
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-06-20 08:08:32 -0300
commit1c2cf009f9c191ec2f90c565c9e29b230b66815f (patch)
tree8786dffdaff9b4935271e942d390589039e12771
parentfffd3a94c968cecb0e77d0583a684d3b83fa6b6b (diff)
downloadmullvadvpn-1c2cf009f9c191ec2f90c565c9e29b230b66815f.tar.xz
mullvadvpn-1c2cf009f9c191ec2f90c565c9e29b230b66815f.zip
Test if daemon starts in not connected state
-rw-r--r--Cargo.lock1
-rw-r--r--mullvad-tests/Cargo.toml1
-rw-r--r--mullvad-tests/tests/startup.rs16
3 files changed, 18 insertions, 0 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 40a33d9083..10cb559070 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -834,6 +834,7 @@ dependencies = [
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
"mullvad-ipc-client 0.1.0",
"mullvad-paths 0.1.0",
+ "mullvad-types 0.1.0",
"notify 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"os_pipe 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/mullvad-tests/Cargo.toml b/mullvad-tests/Cargo.toml
index ae57e6cdc7..2ef906fd01 100644
--- a/mullvad-tests/Cargo.toml
+++ b/mullvad-tests/Cargo.toml
@@ -9,6 +9,7 @@ license = "GPL-3.0"
duct = "0.10"
mullvad-ipc-client = { path = "../mullvad-ipc-client" }
mullvad-paths = { path = "../mullvad-paths" }
+mullvad-types = { path = "../mullvad-types" }
notify = "4.0"
os_pipe = "0.6"
tempfile = "3.0"
diff --git a/mullvad-tests/tests/startup.rs b/mullvad-tests/tests/startup.rs
index 34657a5d79..5bef9a58c5 100644
--- a/mullvad-tests/tests/startup.rs
+++ b/mullvad-tests/tests/startup.rs
@@ -2,12 +2,14 @@
extern crate mullvad_paths;
extern crate mullvad_tests;
+extern crate mullvad_types;
use std::fs::{self, Metadata};
use std::io;
use std::time::Duration;
use mullvad_tests::DaemonRunner;
+use mullvad_types::states::{DaemonState, SecurityState, TargetState};
use platform_specific::*;
@@ -34,6 +36,20 @@ fn rpc_info_file_permissions() {
);
}
+#[test]
+fn starts_in_not_connected_state() {
+ let mut daemon = DaemonRunner::spawn();
+ let mut rpc_client = daemon.rpc_client().expect("Failed to create RPC client");
+
+ let state = rpc_client.get_state().expect("Failed to read daemon state");
+ let not_connected_state = DaemonState {
+ state: SecurityState::Unsecured,
+ target_state: TargetState::Unsecured,
+ };
+
+ assert_eq!(state, not_connected_state);
+}
+
#[cfg(unix)]
mod platform_specific {
extern crate libc;