summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-12-13 15:29:03 +0100
committerLinus Färnstrand <linus@mullvad.net>2018-12-13 15:29:03 +0100
commit7af7a95bb36db22fc6f717e3b9d7027f74d53528 (patch)
treefeab3c5e9975d98a9c7b8ae773d90bb1832050ed
parent5deb78b57102d9df398a57d18996dfdab2c7edbd (diff)
downloadmullvadvpn-7af7a95bb36db22fc6f717e3b9d7027f74d53528.tar.xz
mullvadvpn-7af7a95bb36db22fc6f717e3b9d7027f74d53528.zip
Upgrade mullvad-tests to Rust 2018
-rw-r--r--mullvad-tests/Cargo.toml1
-rw-r--r--mullvad-tests/src/bin/mock_openvpn.rs20
-rw-r--r--mullvad-tests/src/lib.rs40
-rw-r--r--mullvad-tests/src/mock_openvpn/mod.rs10
-rw-r--r--mullvad-tests/tests/account.rs11
-rw-r--r--mullvad-tests/tests/connection.rs17
-rw-r--r--mullvad-tests/tests/startup.rs7
7 files changed, 41 insertions, 65 deletions
diff --git a/mullvad-tests/Cargo.toml b/mullvad-tests/Cargo.toml
index 95aa6bb56f..37ada0d6fd 100644
--- a/mullvad-tests/Cargo.toml
+++ b/mullvad-tests/Cargo.toml
@@ -4,6 +4,7 @@ version = "0.1.0"
authors = ["Mullvad VPN <admin@mullvad.net>"]
description = "Mullvad test specific modules and binaries"
license = "GPL-3.0"
+edition = "2018"
[features]
integration-tests = []
diff --git a/mullvad-tests/src/bin/mock_openvpn.rs b/mullvad-tests/src/bin/mock_openvpn.rs
index cbc5b6caf6..042065d3be 100644
--- a/mullvad-tests/src/bin/mock_openvpn.rs
+++ b/mullvad-tests/src/bin/mock_openvpn.rs
@@ -1,14 +1,14 @@
-extern crate mullvad_tests;
-
-use std::env;
-use std::fs::{self, File};
-use std::io::{self, Read, Write};
-use std::path::PathBuf;
-use std::sync::mpsc;
-use std::thread;
-use std::time::Duration;
-
use mullvad_tests::{watch_event, PathWatcher};
+use std::{
+ env,
+ fs::{self, File},
+ io::{self, Read, Write},
+ path::PathBuf,
+ sync::mpsc,
+ thread,
+ time::Duration,
+};
+
const MAX_EVENT_TIME: Duration = Duration::from_secs(60);
diff --git a/mullvad-tests/src/lib.rs b/mullvad-tests/src/lib.rs
index c9752d5a58..c13c67b6ce 100644
--- a/mullvad-tests/src/lib.rs
+++ b/mullvad-tests/src/lib.rs
@@ -1,40 +1,26 @@
-extern crate duct;
-extern crate jsonrpc_client_core;
-extern crate jsonrpc_client_ipc;
-#[cfg(unix)]
-extern crate libc;
-extern crate mullvad_ipc_client;
-extern crate mullvad_paths;
-extern crate notify;
-extern crate openvpn_plugin;
-extern crate talpid_ipc;
-extern crate tempfile;
-
-extern crate futures;
-extern crate tokio;
-
-pub mod mock_openvpn;
-
-use std::collections::HashMap;
-use std::fs::{self, File};
-use std::path::{Path, PathBuf};
-use std::sync::{mpsc, Arc};
-use std::time::{Duration, Instant};
-use std::{cmp, thread};
-
+use self::mock_openvpn::MOCK_OPENVPN_ARGS_FILE;
+use self::platform_specific::*;
use futures::sync::oneshot;
use jsonrpc_client_core::{Future, Transport};
use jsonrpc_client_ipc::IpcTransport;
use mullvad_ipc_client::{DaemonRpcClient, ResultExt};
use mullvad_paths::resources::API_CA_FILENAME;
use notify::{RawEvent, RecommendedWatcher, RecursiveMode, Watcher};
+use std::{
+ collections::HashMap,
+ fs::{self, File},
+ path::{Path, PathBuf},
+ sync::{mpsc, Arc},
+ time::{Duration, Instant},
+ {cmp, thread},
+};
use tempfile::TempDir;
use tokio::reactor::Handle;
-use self::mock_openvpn::MOCK_OPENVPN_ARGS_FILE;
-use self::platform_specific::*;
+pub use notify::op::{self as watch_event, Op as WatchEvent};
+
-pub use self::notify::op::{self as watch_event, Op as WatchEvent};
+pub mod mock_openvpn;
type Result<T> = ::std::result::Result<T, String>;
diff --git a/mullvad-tests/src/mock_openvpn/mod.rs b/mullvad-tests/src/mock_openvpn/mod.rs
index 56e2514970..9c84496e66 100644
--- a/mullvad-tests/src/mock_openvpn/mod.rs
+++ b/mullvad-tests/src/mock_openvpn/mod.rs
@@ -1,8 +1,10 @@
-pub const MOCK_OPENVPN_ARGS_FILE: &str = "mock_openvpn_args";
+use std::{
+ fs::File,
+ io::{self, BufRead, BufReader},
+ path::Path,
+};
-use std::fs::File;
-use std::io::{self, BufRead, BufReader};
-use std::path::Path;
+pub const MOCK_OPENVPN_ARGS_FILE: &str = "mock_openvpn_args";
pub fn search_openvpn_args<P: AsRef<Path>>(
openvpn_args_file_path: P,
diff --git a/mullvad-tests/tests/account.rs b/mullvad-tests/tests/account.rs
index 35e8baa6cf..16b877bb76 100644
--- a/mullvad-tests/tests/account.rs
+++ b/mullvad-tests/tests/account.rs
@@ -1,13 +1,12 @@
#![cfg(feature = "integration-tests")]
-extern crate mullvad_tests;
-
-use std::fs::File;
-use std::io::{BufRead, BufReader};
-use std::path::Path;
-
use mullvad_tests::mock_openvpn::search_openvpn_args;
use mullvad_tests::{watch_event, DaemonRunner, PathWatcher};
+use std::{
+ fs::File,
+ io::{BufRead, BufReader},
+ path::Path,
+};
#[test]
fn uses_account_token() {
diff --git a/mullvad-tests/tests/connection.rs b/mullvad-tests/tests/connection.rs
index e2b14be965..6556e9753b 100644
--- a/mullvad-tests/tests/connection.rs
+++ b/mullvad-tests/tests/connection.rs
@@ -1,19 +1,12 @@
#![cfg(feature = "integration-tests")]
-extern crate mullvad_ipc_client;
-extern crate mullvad_tests;
-extern crate talpid_types;
-
-use std::fs;
-use std::path::Path;
-use std::sync::mpsc;
-use std::time::Duration;
-
+use mullvad_tests::{
+ mock_openvpn::search_openvpn_args, watch_event, DaemonRunner, MockOpenVpnPluginRpcClient,
+ PathWatcher,
+};
+use std::{fs, path::Path, sync::mpsc, time::Duration};
use talpid_types::tunnel::TunnelStateTransition;
-use mullvad_tests::mock_openvpn::search_openvpn_args;
-use mullvad_tests::{watch_event, DaemonRunner, MockOpenVpnPluginRpcClient, PathWatcher};
-
#[cfg(target_os = "linux")]
const OPENVPN_PLUGIN_NAME: &str = "libtalpid_openvpn_plugin.so";
diff --git a/mullvad-tests/tests/startup.rs b/mullvad-tests/tests/startup.rs
index 3281489b6d..3e6ad205ce 100644
--- a/mullvad-tests/tests/startup.rs
+++ b/mullvad-tests/tests/startup.rs
@@ -1,12 +1,7 @@
#![cfg(feature = "integration-tests")]
-extern crate mullvad_paths;
-extern crate mullvad_tests;
-extern crate talpid_types;
-
-use talpid_types::tunnel::TunnelStateTransition;
-
use mullvad_tests::DaemonRunner;
+use talpid_types::tunnel::TunnelStateTransition;
#[test]
fn starts_in_disconnected_state() {