From 933882ee9bc9e38b35b16e0ca2ddad9ca00c45e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 27 Feb 2019 15:38:22 +0100 Subject: [PATCH] tests: fix race condition in firewall formatting test Use fixed timestamp. --- qubes/tests/vm/qubesvm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qubes/tests/vm/qubesvm.py b/qubes/tests/vm/qubesvm.py index bb2f1202..8d843cf3 100644 --- a/qubes/tests/vm/qubesvm.py +++ b/qubes/tests/vm/qubesvm.py @@ -1278,11 +1278,12 @@ class TC_90_QubesVM(QubesVMTestsMixin, qubes.tests.QubesTestCase): '/qubes-service/meminfo-writer': '1', }) + @unittest.mock.patch('datetime.datetime') @unittest.mock.patch('qubes.utils.get_timezone') @unittest.mock.patch('qubes.utils.urandom') @unittest.mock.patch('qubes.vm.qubesvm.QubesVM.untrusted_qdb') def test_621_qdb_vm_with_network(self, mock_qubesdb, mock_urandom, - mock_timezone): + mock_timezone, mock_datetime): mock_urandom.return_value = b'A' * 64 mock_timezone.return_value = 'UTC' template = self.get_vm(cls=qubes.vm.templatevm.TemplateVM, name='template') @@ -1300,6 +1301,8 @@ class TC_90_QubesVM(QubesVMTestsMixin, qubes.tests.QubesTestCase): mock_qubesdb.write.side_effect = test_qubesdb.write mock_qubesdb.rm.side_effect = test_qubesdb.rm self.maxDiff = None + mock_datetime.now.returnvalue = \ + datetime.datetime(2019, 2, 27, 15, 12, 15, 385822) iptables_header = ( '# Generated by Qubes Core on {}\n'