From bc2c19bb2db901af0c48d34fb15a335f4e343361 Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Wed, 24 Mar 2021 12:04:51 +0100 Subject: [PATCH] Reset global wsgi app state in unit test Since I2bd360dcc6501feea7baf02d4510b282205fc061 there is a global state set during the wsgi_app init making our unit test cases non-deterministic based on the order of them. This patch makes sure that the global state is reset for each test case. Change-Id: Ie2ba746a7697a70fdbc6594f02257f78becfe962 Closes-Bug: #1921098 --- nova/test.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nova/test.py b/nova/test.py index ee8a34f6625e..e3ecb6563c3d 100644 --- a/nova/test.py +++ b/nova/test.py @@ -53,6 +53,7 @@ from oslotest import mock_fixture from sqlalchemy.dialects import sqlite import testtools +from nova.api.openstack import wsgi_app from nova.compute import rpcapi as compute_rpcapi from nova import context from nova.db.sqlalchemy import api as sqlalchemy_api @@ -284,6 +285,10 @@ class TestCase(base.BaseTestCase): self.useFixture(nova_fixtures.GenericPoisonFixture()) + # make sure that the wsgi app is fully initialized for all testcase + # instead of only once initialized for test worker + wsgi_app.init_global_data.reset() + def _setup_cells(self): """Setup a normal cellsv2 environment.