From 19ac89479a30845eb0c85927582ab21d6ad1df04 Mon Sep 17 00:00:00 2001 From: Allan CORNET Date: Tue, 2 Nov 2021 20:11:09 +0100 Subject: [PATCH] fix #536 'test_websave_3' failed randomly due to distant server. --- CHANGELOG.md | 2 ++ modules/webtools/tests/test_websave_3.m | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9497c9e073..6b417f20c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ - [#533](http://github.com/Nelson-numerical-software/nelson/issues/533): `find` with one lhs did not return expected result with complex. +- [#536](http://github.com/Nelson-numerical-software/nelson/issues/536): `test_websave_3` failed randomly due to distant server. + # 0.5.10 (2021-10-30) - Polynomial functions: diff --git a/modules/webtools/tests/test_websave_3.m b/modules/webtools/tests/test_websave_3.m index b2a54d10d9..5cd8b21b8f 100644 --- a/modules/webtools/tests/test_websave_3.m +++ b/modules/webtools/tests/test_websave_3.m @@ -25,15 +25,20 @@ %============================================================================= url = 'http://neowms.sci.gsfc.nasa.gov/wms/wms'; filename = [tempdir(), 'earth.jpg']; -haveFails = false; -try +testPass = false; +i = 0; +retry = true; +while (retry) + try destination_filename = websave(filename, url, 'Time', '2019-06-01', 'Service', 'WMS', 'Layers', 'BlueMarbleNG-TB', 'CRS', 'CRS:84', 'Format', 'image/jpeg', 'Height',768, 'Width', 1024,'BBOX','-180.0,-90.0,180.0,90.0','Version','1.3.0','Request','GetMap'); -catch ex - if strcmp(ex.message, "Bad Request (400)") == 0 - haveFails = false; - else - haveFails = true; + catch ex + testPass = (strcmp(ex.message, 'Bad Request (400)') == 1); + if ~testPass + testPass = (strcmp(ex.message, _('Timeout was reached')) == 1); end + end + i = i + 1; + retry = ~testPass && (i < 5); end -assert_istrue(haveFails); +assert_istrue(testPass) %=============================================================================