]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pytest dns_aging: add windows_variation
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Sat, 19 Jun 2021 03:43:29 +0000 (15:43 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 22 Jun 2021 01:14:37 +0000 (01:14 +0000)
We want to sometimes be able to say "we know Windows fails, it fails
like this, it is OK", so that when we run the tests on Windows we know
the failures are not unexpected.

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

index cad2c8743dcdd1f1d897d19b82198f9db8c27e5f..17ce1c0518dd5b9a23f1975302fc3a309993691f 100644 (file)
@@ -33,7 +33,7 @@ from samba.tests.dns_base import DNSTest
 import samba.getopt as options
 import optparse
 import time
-
+from samba.colour import c_RED, c_GREEN, c_DARK_YELLOW
 
 parser = optparse.OptionParser(
     "dns_aging.py <server name> <server ip> [options]")
@@ -2622,6 +2622,18 @@ class TestDNSAging(DNSTest):
     def test_dns_delete_simple_10_0_days_no_aging_touch(self):
         self._test_dns_delete_simple(10, 1e9, False, True)
 
+    def windows_variation(self, fn, *args, msg=None, **kwargs):
+        try:
+            fn(*args, **kwargs)
+        except AssertionError as e:
+            print("Expected success on Windows only, failed as expected:\n" +
+                  c_GREEN(e))
+            return
+        print(c_RED("known Windows failure"))
+        if msg is not None:
+            print(c_DARK_YELLOW(msg))
+        print("Expected success on Windows:\n" +
+              c_GREEN(f"{fn.__name__} {args} {kwargs}"))
 
     def _test_dns_add_sibling(self, a_days, refresh, aging=True, touch=False):
         # Here we show that with aging enabled, the timestamp of