X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=rwlaunchpad%2Fplugins%2Frwpkgmgr%2Ftest%2Futest_publisher_dts.py;fp=rwlaunchpad%2Fplugins%2Frwpkgmgr%2Ftest%2Futest_publisher_dts.py;h=518b9276a78b037e62edb29aed4fc2bc1a82cbb7;hb=88879e8fb1aa64ad710781a9fde3e49f3bed21a7;hp=a02e5c665a7c01f38fe9a0a836e06ecfb208e5c8;hpb=ac9e53bb04d1cd79e8c936597dca18c19b4d3e0d;p=osm%2FSO.git diff --git a/rwlaunchpad/plugins/rwpkgmgr/test/utest_publisher_dts.py b/rwlaunchpad/plugins/rwpkgmgr/test/utest_publisher_dts.py index a02e5c66..518b9276 100755 --- a/rwlaunchpad/plugins/rwpkgmgr/test/utest_publisher_dts.py +++ b/rwlaunchpad/plugins/rwpkgmgr/test/utest_publisher_dts.py @@ -145,7 +145,7 @@ class TestCase(rift.test.dts.AbstractDTSTest): assert download_id is not None # Waiting for 5 secs to be sure that the file is downloaded - yield from asyncio.sleep(5, loop=self.loop) + yield from asyncio.sleep(10, loop=self.loop) xpath = "/download-jobs/job[download-id='{}']".format( download_id) result = yield from self.read_xpath(xpath) @@ -153,6 +153,32 @@ class TestCase(rift.test.dts.AbstractDTSTest): assert result.status == "COMPLETED" assert len(self.job_handler.tasks) == 0 + @rift.test.dts.async_test + def test_url_download_unreachable_ip(self): + """ + Integration Test: + Ensure that a bad IP does not block forever + """ + yield from self.job_handler.register() + + proxy = mock.MagicMock() + + # Here, we are assuming that there is no HTTP server at 10.1.2.3 + url = "http://10.1.2.3/common/unittests/plantuml.jar" + url_downloader = downloader.PackageFileDownloader(url, "1", "/", "VNFD", proxy) + + download_id = yield from self.job_handler.register_downloader(url_downloader) + assert download_id is not None + + # Waiting for 10 secs to be sure all reconnect attempts have been exhausted + yield from asyncio.sleep(10, loop=self.loop) + xpath = "/download-jobs/job[download-id='{}']".format( + download_id) + result = yield from self.read_xpath(xpath) + self.log.debug("Test result before complete check - %s", result) + assert result.status == "FAILED" + assert len(self.job_handler.tasks) == 0 + @rift.test.dts.async_test def test_cancelled(self):