Blob Blame History Raw
From f8283f747843e50d6d088bc864ae232744a085d5 Mon Sep 17 00:00:00 2001
From: Eric Garver <eric@garver.life>
Date: Mon, 16 Dec 2019 13:33:08 -0500
Subject: [PATCH 15/37] test: integration: NM zone overrides interface on
 reload

Coverage for rhbz 1773809

(cherry picked from commit ea97fb2bde6fb683b1ba2c41882d6d4f63299255)
(cherry picked from commit 04b8394c0a8344d5225b0716e23dc0558d2fc594)
---
 src/tests/integration/networkmanager.at |  2 ++
 src/tests/integration/rhbz1773809.at    | 27 +++++++++++++++++++++++++
 src/tests/integration/testsuite.at      |  1 +
 3 files changed, 30 insertions(+)
 create mode 100644 src/tests/integration/networkmanager.at
 create mode 100644 src/tests/integration/rhbz1773809.at

diff --git a/src/tests/integration/networkmanager.at b/src/tests/integration/networkmanager.at
new file mode 100644
index 000000000000..08cf6d28451a
--- /dev/null
+++ b/src/tests/integration/networkmanager.at
@@ -0,0 +1,2 @@
+AT_BANNER([NetworkManager (FIREWALL_BACKEND)])
+m4_include([integration/rhbz1773809.at])
diff --git a/src/tests/integration/rhbz1773809.at b/src/tests/integration/rhbz1773809.at
new file mode 100644
index 000000000000..e58a4337c716
--- /dev/null
+++ b/src/tests/integration/rhbz1773809.at
@@ -0,0 +1,27 @@
+FWD_START_TEST([NM overrides interface on reload])
+AT_KEYWORDS(zone reload rhbz1773809)
+
+START_NETWORKMANAGER
+
+NMCLI_CHECK([connection add type dummy con-name dummy0 ifname dummy0 ip4 10.0.0.2 gw4 10.0.0.1], 0, [ignore])
+echo NS_CMD([nmcli connection delete dummy0]) >> ./cleanup
+NMCLI_CHECK([connection show dummy0], 0, [ignore])
+NMCLI_CHECK([connection up dummy0], 0, [ignore])
+
+dnl Use firewall-offline-cmd otherwise the request will be forwarded to
+dnl NetworkManager.
+FWD_OFFLINE_CHECK([-q --zone internal --add-interface dummy0])
+FWD_RELOAD
+
+dnl firewall-cmd should forward the request to NetworkManager.
+FWD_CHECK([-q --permanent --zone trusted --change-interface dummy0])
+NMCLI_CHECK([-f connection.zone connection show dummy0], 0, [dnl
+connection.zone:                        trusted
+])
+
+FWD_RELOAD
+FWD_CHECK([--get-zone-of-interface dummy0], 0, [dnl
+trusted
+])
+
+FWD_END_TEST
diff --git a/src/tests/integration/testsuite.at b/src/tests/integration/testsuite.at
index bbaf07a191b9..6c957033bae2 100644
--- a/src/tests/integration/testsuite.at
+++ b/src/tests/integration/testsuite.at
@@ -8,4 +8,5 @@ m4_define([m4_include], [m4_builtin([include], [$1])])
 m4_include([functions.at])
 
 m4_foreach([FIREWALL_BACKEND], [[nftables], [iptables]], [
+    m4_include([integration/networkmanager.at])
 ])
-- 
2.23.0