]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
gp: Ensure Firewalld tests don't flop
authorDavid Mulder <dmulder@samba.org>
Fri, 6 Jan 2023 21:49:19 +0000 (14:49 -0700)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 31 Jul 2023 09:58:30 +0000 (09:58 +0000)
This test was failing depending on the system it
was run on, since the result depends on whether
firewalld python bindings were installed. This
wasn't failing in CI (and so there is no flopping
test marked), but does fail on some local systems.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/gpo.py

index f5e25e71041583696cb74c843f7342d2617a081a..eb1b53a78332014d69d13cb854bed891ffb0fed4 100644 (file)
@@ -7125,9 +7125,13 @@ class GPOTests(tests.TestCase):
         cmd = [firewall_cmd, '--zone=work', '--list-rich-rules']
         p = Popen(cmd, stdout=PIPE, stderr=PIPE)
         out, err = p.communicate()
-        rule = b'rule family=ipv4 source address=172.25.1.7 ' + \
-               b'service name=ftp reject'
-        self.assertEquals(rule, out.strip(), 'Failed to set rich rule')
+        # Firewalld will report the rule one of two ways:
+        rules = [b'rule family=ipv4 source address=172.25.1.7 ' + \
+                 b'service name=ftp reject',
+                 b'rule family="ipv4" source address="172.25.1.7" ' + \
+                 b'service name="ftp" reject']
+        self.assertIn(out.strip(), rules, 'Failed to set rich rule')
+
 
         # Verify RSOP does not fail
         ext.rsop([g for g in gpos if g.name == guid][0])