From a600895ba3fd392f7e3cf68752f6e810f3afd3a0 Mon Sep 17 00:00:00 2001
From: Julia Kreger <juliaashleykreger@gmail.com>
Date: Wed, 28 Jun 2023 06:29:53 -0700
Subject: [PATCH] Execute tests by class, not randomly

The default test runner behavior is to distribute various classes
across many runners, which is fine. But when you have lots of setup
to ensure an environment is correct for tests in a class, you
generally want to execute that together instead of separately.

As such, set the --parallel-class execution option for stestr.

Change-Id: I5a65accfb7e2033690b2934d874141db7f4bf383
---
 tox.ini | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tox.ini b/tox.ini
index aa2fa79f20..2666e5b32e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -22,7 +22,7 @@ deps =
   -r{toxinidir}/requirements.txt
   -r{toxinidir}/test-requirements.txt
 commands =
-    stestr run --slowest {posargs}
+    stestr run --slowest --parallel-class {posargs}
 passenv = http_proxy
           HTTP_PROXY
           https_proxy
@@ -67,7 +67,7 @@ setenv = VIRTUAL_ENV={envdir}
          PYTHON=coverage run --source ironic --omit='*tests*' --parallel-mode
 commands =
   coverage erase
-  stestr run {posargs}
+  stestr run --parallel-class {posargs}
   coverage combine
   coverage report --omit='*tests*'
   coverage html -d ./cover --omit='*tests*'