Run serial_tests after all other discovered tests

In order to avoid blocking plugin tests execution
serial tests should be run after plugin tests
in each worker.

Change-Id: Ie9f984a86fbb433008e09bd2a818de5860798f35
Related-Prod: https://mirantis.jira.com/browse/PRODX-38846
diff --git a/tempest/test_discover/test_discover.py b/tempest/test_discover/test_discover.py
index 679d58b..20896bb 100644
--- a/tempest/test_discover/test_discover.py
+++ b/tempest/test_discover/test_discover.py
@@ -24,8 +24,8 @@
     suite = unittest.TestSuite()
     base_path = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0]
     base_path = os.path.split(base_path)[0]
-    # Load local tempest tests
-    for test_dir in ['api', 'scenario', 'serial_tests']:
+    # Load local parallel tempest tests
+    for test_dir in ['api', 'scenario']:
         full_test_dir = os.path.join(base_path, 'tempest', test_dir)
         if not pattern:
             suite.addTests(loader.discover(full_test_dir,
@@ -33,17 +33,25 @@
         else:
             suite.addTests(loader.discover(full_test_dir, pattern=pattern,
                                            top_level_dir=base_path))
-
-    plugin_load_tests = ext_plugins.get_plugin_load_tests_tuple()
-    if not plugin_load_tests:
-        return suite
-
     # Load any installed plugin tests
-    for plugin in plugin_load_tests:
-        test_dir, top_path = plugin_load_tests[plugin]
-        if not pattern:
-            suite.addTests(loader.discover(test_dir, top_level_dir=top_path))
-        else:
-            suite.addTests(loader.discover(test_dir, pattern=pattern,
-                                           top_level_dir=top_path))
+    plugin_load_tests = ext_plugins.get_plugin_load_tests_tuple()
+    if plugin_load_tests:
+        for plugin in plugin_load_tests:
+            test_dir, top_path = plugin_load_tests[plugin]
+            if not pattern:
+                suite.addTests(loader.discover(
+                    test_dir, top_level_dir=top_path))
+            else:
+                suite.addTests(loader.discover(test_dir, pattern=pattern,
+                                               top_level_dir=top_path))
+    # Serial tests can block execution of tests which are loaded after,
+    # so loading them always in the end
+    serial_test_dir = os.path.join(base_path, 'tempest', 'serial_tests')
+    if not pattern:
+        suite.addTests(loader.discover(serial_test_dir,
+                                       top_level_dir=base_path))
+    else:
+        suite.addTests(loader.discover(serial_test_dir, pattern=pattern,
+                                       top_level_dir=base_path))
+
     return suite