[NetworkManager-openvpn: 5/8] properties/test: test import/export of compress property
- From: Beniamino Galvani <bgalvani src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [NetworkManager-openvpn: 5/8] properties/test: test import/export of compress property
- Date: Thu, 27 Feb 2020 21:26:16 +0000 (UTC)
commit 4c91cfd5ebf399273db71697f2caf1861b94a16b
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Thu Jul 12 21:43:31 2018 +0200
properties/test: test import/export of compress property
Together with the deprecated comp-lzo one.
Co-authored-by: Beniamino Galvani <bgalvani redhat com>
Makefile.am | 1 +
properties/tests/conf/compress.ovpn | 6 ++++
properties/tests/conf/connect-timeout.ovpn | 2 +-
properties/tests/conf/crl-dir.ovpn | 2 +-
properties/tests/conf/crl-file.ovpn | 2 +-
properties/tests/conf/device-notype.ovpn | 2 +-
properties/tests/conf/device.ovpn | 2 +-
properties/tests/conf/keepalive.ovpn | 2 +-
properties/tests/conf/keysize.ovpn | 2 +-
properties/tests/conf/mtu-disc.ovpn | 2 +-
properties/tests/conf/ping-with-exit.ovpn | 2 +-
properties/tests/conf/ping-with-restart.ovpn | 2 +-
properties/tests/conf/pkcs12.ovpn | 2 +-
properties/tests/conf/port.ovpn | 2 +-
properties/tests/conf/route.ovpn | 2 +-
properties/tests/conf/rport.ovpn | 2 +-
properties/tests/conf/server-poll-timeout.ovpn | 2 +-
properties/tests/conf/tls-inline.ovpn | 2 +-
properties/tests/conf/tls.ovpn | 2 +-
properties/tests/conf/tls2.ovpn | 2 +-
properties/tests/test-import-export.c | 41 +++++++++++++++++++++++---
21 files changed, 62 insertions(+), 22 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 972e7a1..ebf250e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -285,6 +285,7 @@ properties_tests_test_import_export_glib_LDADD = \
EXTRA_DIST += \
+ properties/tests/conf/compress.ovpn \
properties/tests/conf/iso885915.ovpn \
properties/tests/conf/mtu-disc.ovpn \
properties/tests/conf/password.conf \
diff --git a/properties/tests/conf/compress.ovpn b/properties/tests/conf/compress.ovpn
new file mode 100644
index 0000000..4c2a4ab
--- /dev/null
+++ b/properties/tests/conf/compress.ovpn
@@ -0,0 +1,6 @@
+remote 173.8.149.245 666
+dev tun
+client
+
+comp-lzo
+compress lzo
diff --git a/properties/tests/conf/connect-timeout.ovpn b/properties/tests/conf/connect-timeout.ovpn
index 67efe83..2371483 100644
--- a/properties/tests/conf/connect-timeout.ovpn
+++ b/properties/tests/conf/connect-timeout.ovpn
@@ -20,6 +20,6 @@ key keys/clee.key
tls-auth keys/46.key 1
tls-remote "/CN=myvpn.company.com"
-comp-lzo
+compress
verb 4
diff --git a/properties/tests/conf/crl-dir.ovpn b/properties/tests/conf/crl-dir.ovpn
index d27220a..e18883c 100644
--- a/properties/tests/conf/crl-dir.ovpn
+++ b/properties/tests/conf/crl-dir.ovpn
@@ -16,7 +16,7 @@ ca keys/mg8.ca
cert keys/clee.crt
key keys/clee.key
-comp-lzo
+compress
verb 3
crl-verify /home/user/.cert/crls/ dir
\ No newline at end of file
diff --git a/properties/tests/conf/crl-file.ovpn b/properties/tests/conf/crl-file.ovpn
index 2054b21..e917563 100644
--- a/properties/tests/conf/crl-file.ovpn
+++ b/properties/tests/conf/crl-file.ovpn
@@ -16,7 +16,7 @@ ca keys/mg8.ca
cert keys/clee.crt
key keys/clee.key
-comp-lzo
+compress
verb 3
crl-verify /home/user/.cert/crl.pem
\ No newline at end of file
diff --git a/properties/tests/conf/device-notype.ovpn b/properties/tests/conf/device-notype.ovpn
index 1236323..29b5180 100644
--- a/properties/tests/conf/device-notype.ovpn
+++ b/properties/tests/conf/device-notype.ovpn
@@ -9,7 +9,7 @@ persist-key
persist-tun
user openvpn
group openvpn
-comp-lzo
+compress
tun-mtu 1500
mssfix 1450
auth-user-pass
diff --git a/properties/tests/conf/device.ovpn b/properties/tests/conf/device.ovpn
index ffc5898..5b55661 100644
--- a/properties/tests/conf/device.ovpn
+++ b/properties/tests/conf/device.ovpn
@@ -10,7 +10,7 @@ persist-key
persist-tun
user openvpn
group openvpn
-comp-lzo
+compress
tun-mtu 1500
mssfix 1450
auth-user-pass
diff --git a/properties/tests/conf/keepalive.ovpn b/properties/tests/conf/keepalive.ovpn
index 5bd1ed2..d9b1f32 100644
--- a/properties/tests/conf/keepalive.ovpn
+++ b/properties/tests/conf/keepalive.ovpn
@@ -19,7 +19,7 @@ key keys/clee.key
tls-auth keys/46.key 1
tls-remote "/CN=myvpn.company.com"
-comp-lzo
+compress
verb 3
keepalive 10 30
diff --git a/properties/tests/conf/keysize.ovpn b/properties/tests/conf/keysize.ovpn
index 3efd91d..da0aa86 100644
--- a/properties/tests/conf/keysize.ovpn
+++ b/properties/tests/conf/keysize.ovpn
@@ -6,7 +6,7 @@ resolv-retry infinite
nobind
persist-key
persist-tun
-comp-lzo
+compress
tun-mtu 1500
mssfix 1450
auth-user-pass
diff --git a/properties/tests/conf/mtu-disc.ovpn b/properties/tests/conf/mtu-disc.ovpn
index 0370b11..240df87 100644
--- a/properties/tests/conf/mtu-disc.ovpn
+++ b/properties/tests/conf/mtu-disc.ovpn
@@ -10,7 +10,7 @@ persist-key
persist-tun
user openvpn
group openvpn
-comp-lzo
+compress
tun-mtu 1500
mssfix 1450
auth-user-pass
diff --git a/properties/tests/conf/ping-with-exit.ovpn b/properties/tests/conf/ping-with-exit.ovpn
index b34e02d..24bf9d4 100644
--- a/properties/tests/conf/ping-with-exit.ovpn
+++ b/properties/tests/conf/ping-with-exit.ovpn
@@ -19,7 +19,7 @@ key keys/clee.key
tls-auth keys/46.key 1
tls-remote "/CN=myvpn.company.com"
-comp-lzo
+compress
verb 3
ping 10
diff --git a/properties/tests/conf/ping-with-restart.ovpn b/properties/tests/conf/ping-with-restart.ovpn
index 7194cc1..aa96d14 100644
--- a/properties/tests/conf/ping-with-restart.ovpn
+++ b/properties/tests/conf/ping-with-restart.ovpn
@@ -19,7 +19,7 @@ key keys/clee.key
tls-auth keys/46.key 1
tls-remote "/CN=myvpn.company.com"
-comp-lzo
+compress
verb 3
ping 10
diff --git a/properties/tests/conf/pkcs12.ovpn b/properties/tests/conf/pkcs12.ovpn
index 12281b0..8542174 100644
--- a/properties/tests/conf/pkcs12.ovpn
+++ b/properties/tests/conf/pkcs12.ovpn
@@ -12,6 +12,6 @@ tls-client
pkcs12 keys/mine.p12
-comp-lzo
+compress
verb 3
diff --git a/properties/tests/conf/port.ovpn b/properties/tests/conf/port.ovpn
index 3fbbf5c..27eaf60 100644
--- a/properties/tests/conf/port.ovpn
+++ b/properties/tests/conf/port.ovpn
@@ -19,6 +19,6 @@ key keys/clee.key
tls-auth keys/46.key 1
tls-remote "/CN=myvpn.company.com"
-comp-lzo
+compress
verb 3
diff --git a/properties/tests/conf/route.ovpn b/properties/tests/conf/route.ovpn
index 4c09c3d..3579412 100644
--- a/properties/tests/conf/route.ovpn
+++ b/properties/tests/conf/route.ovpn
@@ -21,6 +21,6 @@ key keys/clee.key
tls-auth keys/46.key 1
tls-remote "/CN=myvpn.company.com"
-comp-lzo
+compress
verb 3
diff --git a/properties/tests/conf/rport.ovpn b/properties/tests/conf/rport.ovpn
index 4d09b5a..e9f1f3e 100644
--- a/properties/tests/conf/rport.ovpn
+++ b/properties/tests/conf/rport.ovpn
@@ -19,6 +19,6 @@ key keys/clee.key
tls-auth keys/46.key 1
tls-remote "/CN=myvpn.company.com"
-comp-lzo
+compress
verb 3
diff --git a/properties/tests/conf/server-poll-timeout.ovpn b/properties/tests/conf/server-poll-timeout.ovpn
index fa705c8..3a10c34 100644
--- a/properties/tests/conf/server-poll-timeout.ovpn
+++ b/properties/tests/conf/server-poll-timeout.ovpn
@@ -20,6 +20,6 @@ key keys/clee.key
tls-auth keys/46.key 1
tls-remote "/CN=myvpn.company.com"
-comp-lzo
+compress
verb 4
diff --git a/properties/tests/conf/tls-inline.ovpn b/properties/tests/conf/tls-inline.ovpn
index d946992..1db6a8c 100644
--- a/properties/tests/conf/tls-inline.ovpn
+++ b/properties/tests/conf/tls-inline.ovpn
@@ -152,6 +152,6 @@ rYw1t2eucHvGjH8PnTh0aJPJaI67jmNbSI4CnHNcRgZ+1ow1GS+RAK7kotS+dZz9
remote-cert-tls server
tls-remote "/CN=myvpn.company.com"
-comp-lzo
+compress
verb 3
diff --git a/properties/tests/conf/tls.ovpn b/properties/tests/conf/tls.ovpn
index 0e51a22..625b2cb 100644
--- a/properties/tests/conf/tls.ovpn
+++ b/properties/tests/conf/tls.ovpn
@@ -23,6 +23,6 @@ verify-x509-name "C=US, L=Cambridge, CN=GNOME, emailAddress=networkmanager-list@
key-direction 1
-comp-lzo
+comp-lzo no
verb 3
diff --git a/properties/tests/conf/tls2.ovpn b/properties/tests/conf/tls2.ovpn
index af21457..3a67f85 100644
--- a/properties/tests/conf/tls2.ovpn
+++ b/properties/tests/conf/tls2.ovpn
@@ -21,6 +21,6 @@ remote-cert-tls server
tls-remote "/CN=myvpn.company.com"
verify-x509-name "C=US, L=Cambridge, CN=GNOME, emailAddress=networkmanager-list gnome org" subject
-comp-lzo
+compress lz4
verb 3
diff --git a/properties/tests/test-import-export.c b/properties/tests/test-import-export.c
index 49107ea..09d2483 100644
--- a/properties/tests/test-import-export.c
+++ b/properties/tests/test-import-export.c
@@ -214,6 +214,7 @@ test_password_import (void)
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, "0");
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "test.server.com:443");
@@ -309,7 +310,8 @@ test_tls_import (void)
_check_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE, NM_OPENVPN_CONTYPE_TLS);
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, NULL);
- _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, "adaptive");
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, "no-by-default");
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "173.8.149.245:1194");
@@ -355,7 +357,8 @@ test_tls_import_2 (void)
_check_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE, NM_OPENVPN_CONTYPE_TLS);
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, NULL);
- _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, "adaptive");
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, "lz4");
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "173.8.149.245:1194");
@@ -469,7 +472,8 @@ test_tls_inline_import (void)
_check_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE, NM_OPENVPN_CONTYPE_TLS);
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, NULL);
- _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, "adaptive");
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "173.8.149.245:1194");
@@ -520,7 +524,8 @@ test_pkcs12_import (void)
_check_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE, NM_OPENVPN_CONTYPE_TLS);
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, NULL);
- _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, "adaptive");
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "173.8.149.245:1194");
@@ -587,6 +592,7 @@ test_static_key_import (gconstpointer test_data)
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "10.11.12.13");
@@ -694,6 +700,7 @@ test_proxy_http_import (void)
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, "0");
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "[aa:bb::1]:1194:udp");
@@ -757,6 +764,7 @@ test_proxy_http_with_auth_import (void)
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, "0");
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "test.server.com:443");
@@ -794,6 +802,7 @@ test_proxy_socks_import (void)
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, "0");
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "test.server.com:443");
@@ -973,6 +982,27 @@ test_route_import (void)
#endif
}
+static void
+test_compress_import (void)
+{
+ _CREATE_PLUGIN (plugin);
+ NMConnection *connection;
+ NMSettingVpn *s_vpn;
+
+ connection = get_basic_connection (plugin, SRCDIR, "compress.ovpn");
+ g_assert (connection);
+
+ /* VPN setting */
+ s_vpn = nm_connection_get_setting_vpn (connection);
+ g_assert (s_vpn);
+
+ /* Data items */
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, "adaptive");
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, "lzo");
+
+ g_object_unref (connection);
+}
+
/*****************************************************************************/
static void
@@ -1155,6 +1185,9 @@ int main (int argc, char **argv)
_add_test_func_simple (test_route_import);
_add_test_func ("route-export", test_export_compare, "route.ovpn", "route.ovpntest");
+ _add_test_func_simple (test_compress_import);
+ _add_test_func ("compress-export", test_export_compare, "compress.ovpn", "compress.ovpntest");
+
_add_test_func_simple (test_args_parse_line);
result = g_test_run ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]