diff --git a/tests/integration/states/archive.py b/tests/integration/states/archive.py index 9a86c768f0..7829747ca2 100644 --- a/tests/integration/states/archive.py +++ b/tests/integration/states/archive.py @@ -10,6 +10,7 @@ import os import platform import socket import threading +import tornado.httpserver import tornado.ioloop import tornado.web @@ -35,7 +36,6 @@ PORT = 9999 ARCHIVE_TAR_SOURCE = 'http://localhost:{0}/custom.tar.gz'.format(PORT) UNTAR_FILE = os.path.join(ARCHIVE_DIR, 'custom/README') ARCHIVE_TAR_HASH = 'md5=7643861ac07c30fe7d2310e9f25ca514' -STATE_DIR = os.path.join(integration.FILES, 'file', 'base') REDHAT7 = False QUERY_OS = platform.dist() @@ -59,7 +59,8 @@ class ArchiveTest(integration.ModuleCase, ''' application = tornado.web.Application([(r"/(.*)", tornado.web.StaticFileHandler, {"path": STATE_DIR})]) - application.listen(PORT) + cls.server = tornado.httpserver.HTTPServer(application) + cls.server.listen(PORT) tornado.ioloop.IOLoop.instance().start() @classmethod @@ -83,6 +84,7 @@ class ArchiveTest(integration.ModuleCase, def tearDownClass(cls): tornado.ioloop.IOLoop.instance().stop() cls.server_thread.join() + cls.server.stop() def setUp(self): self._clear_archive_dir() diff --git a/tests/integration/states/file.py b/tests/integration/states/file.py index 3a443623ad..aad7fac441 100644 --- a/tests/integration/states/file.py +++ b/tests/integration/states/file.py @@ -19,6 +19,7 @@ import stat import tempfile import textwrap import threading +import tornado.httpserver import tornado.ioloop import tornado.web import filecmp @@ -2403,7 +2404,6 @@ class FileTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn): PORT = 9999 FILE_SOURCE = 'http://localhost:{0}/grail/scene33'.format(PORT) FILE_HASH = 'd2feb3beb323c79fc7a0f44f1408b4a3' -STATE_DIR = os.path.join(integration.FILES, 'file', 'base') class RemoteFileTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn): @@ -2419,7 +2419,8 @@ class RemoteFileTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn) application = tornado.web.Application([ (r'/(.*)', tornado.web.StaticFileHandler, {'path': STATE_DIR}) ]) - application.listen(PORT) + cls.server = tornado.httpserver.HTTPServer(application) + cls.server.listen(PORT) tornado.ioloop.IOLoop.instance().start() @classmethod @@ -2442,6 +2443,7 @@ class RemoteFileTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn) def tearDownClass(cls): tornado.ioloop.IOLoop.instance().stop() cls.server_thread.join() + cls.server.stop() def setUp(self): fd_, self.name = tempfile.mkstemp(dir=integration.TMP) @@ -2499,4 +2501,4 @@ class RemoteFileTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn) if __name__ == '__main__': from integration import run_tests - run_tests(FileTest) + run_tests(FileTest, RemoteFileTest)