# HG changeset patch # User Alain Mazy # Date 1649317584 -7200 # Node ID 29aaa3df718f20776696db44f51c53f30bc9f1ed # Parent 281a599f533812e3e049ee5f3f41140ba39a702e added verbosity and retries for test sometimes failing on CI diff -r 281a599f5338 -r 29aaa3df718f Tests/Tests.py --- a/Tests/Tests.py Wed Mar 30 09:54:11 2022 +0200 +++ b/Tests/Tests.py Thu Apr 07 09:46:24 2022 +0200 @@ -208,7 +208,7 @@ systemInfo = DoGet(_REMOTE, '/system') if systemInfo["Version"] == "mainline": - print "Skipping version checks since you're currently in mainline" + print("Skipping version checks since you're currently in mainline") return self.assertTrue(IsOrthancVersionAbove(_LOCAL, 0, 8, 6)) @@ -2411,6 +2411,9 @@ def test_incoming_jpeg(self): + # since this test fails regularly on CI, enable verbosity + DoPut(_REMOTE, '/tools/log-level', 'verbose') + def storescu(image, acceptUnknownSopClassUid): if acceptUnknownSopClassUid: tmp = [ '-xf', GetDatabasePath('UnknownSopClassUid.cfg'), 'Default' ] @@ -2439,6 +2442,7 @@ else: InstallLuaScriptFromPath(_REMOTE, 'Lua/TransferSyntaxDisable.lua') + # the following line regularly fails on CI ! self.assertRaises(Exception, lambda: storescu('Knix/Loc/IM-0001-0001.dcm', False)) self.assertRaises(Exception, lambda: storescu('UnknownSopClassUid.dcm', True)) self.assertEqual(0, len(DoGet(_REMOTE, '/patients'))) @@ -2456,6 +2460,8 @@ storescu('UnknownSopClassUid.dcm', True) self.assertEqual(2, len(DoGet(_REMOTE, '/patients'))) + # set back normal verbosity + DoPut(_REMOTE, '/tools/log-level', 'default') def test_storescu_jpeg(self): self.assertEqual(0, len(DoGet(_REMOTE, '/exports')['Exports'])) @@ -3717,8 +3723,14 @@ CompareMainDicomTag('1.2.840.113619.2.176.2025.1499492.7040.1171286242.109', a, '', 'SOPInstanceUID') def test_httpClient_lua(self): + retries = 3 + result = '' + with open(GetDatabasePath('Lua/HttpClient.lua'), 'r') as f: - result = DoPost(_REMOTE, '/tools/execute-script', f.read(), 'application/lua') + # retry since this test sometimes fails if httpbin.org is unresponsive + while retries > 0 and not ('OK' in result): + result = DoPost(_REMOTE, '/tools/execute-script', f.read(), 'application/lua') + retries -= 1 self.assertIn('OK', result)