Fix tests

This commit is contained in:
Dennis Schwerdel 2020-09-25 22:11:28 +02:00
parent 1298ea5765
commit 941ac62bac
1 changed files with 13 additions and 10 deletions

View File

@ -325,7 +325,7 @@ pub struct Args {
pub mode: Option<Mode>, pub mode: Option<Mode>,
/// The shared password to encrypt all traffic /// The shared password to encrypt all traffic
#[structopt(short, long, required_unless_one = &["private-key", "config"], env)] #[structopt(short, long, required_unless_one = &["private-key", "config", "genkey", "version"], env)]
pub password: Option<String>, pub password: Option<String>,
/// The private key to use /// The private key to use
@ -515,9 +515,10 @@ pub struct ConfigFile {
#[test] #[test]
fn config_file() { fn config_file() {
let config_file = " let config_file = "
device-type: tun device:
device-name: vpncloud%d type: tun
device-path: /dev/net/tun name: vpncloud%d
path: /dev/net/tun
ip: 10.0.1.1/16 ip: 10.0.1.1/16
ifup: ifconfig $IFNAME 10.0.1.1/16 mtu 1400 up ifup: ifconfig $IFNAME 10.0.1.1/16 mtu 1400 up
ifdown: 'true' ifdown: 'true'
@ -527,10 +528,11 @@ peers:
peer-timeout: 600 peer-timeout: 600
keepalive: 840 keepalive: 840
switch-timeout: 300 switch-timeout: 300
beacon-store: /run/vpncloud.beacon.out beacon:
beacon-load: /run/vpncloud.beacon.in store: /run/vpncloud.beacon.out
beacon-interval: 3600 load: /run/vpncloud.beacon.in
beacon-password: test123 interval: 3600
password: test123
mode: normal mode: normal
claims: claims:
- 10.0.1.0/24 - 10.0.1.0/24
@ -539,8 +541,9 @@ user: nobody
group: nogroup group: nogroup
pid-file: /run/vpncloud.run pid-file: /run/vpncloud.run
stats-file: /var/log/vpncloud.stats stats-file: /var/log/vpncloud.stats
statsd-server: example.com:1234 statsd:
statsd-prefix: prefix server: example.com:1234
prefix: prefix
"; ";
assert_eq!(serde_yaml::from_str::<ConfigFile>(config_file).unwrap(), ConfigFile { assert_eq!(serde_yaml::from_str::<ConfigFile>(config_file).unwrap(), ConfigFile {
device: Some(ConfigFileDevice { device: Some(ConfigFileDevice {