From 50bacea31ccc7dd5cf1b2a5fe4a0546189a14956 Mon Sep 17 00:00:00 2001 From: Stephen Finucane <stephenfin@redhat.com> Date: Thu, 15 Jul 2021 11:52:00 +0100 Subject: [PATCH] tests: Silence noisy tests Some of our gabbit tests have the 'verbose' flag set, which means they are rather noisy, dumping the (mostly) raw HTTP requests to stdout. Resolve this by dropping the 'verbose' flag. Tests for the 'placement-status' command don't capture stdout which means we see their output. Resolve this by simply capturing stdout. Change-Id: If6c1f88fbb94cb13459c9506c04cfbeee7ac9619 Signed-off-by: Stephen Finucane <stephenfin@redhat.com> --- placement/tests/functional/cmd/test_status.py | 8 +++++++- .../tests/functional/gabbits/aggregate-legacy-rbac.yaml | 1 - .../tests/functional/gabbits/aggregate-secure-rbac.yaml | 1 - 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/placement/tests/functional/cmd/test_status.py b/placement/tests/functional/cmd/test_status.py index a276f08f3..8bf294277 100644 --- a/placement/tests/functional/cmd/test_status.py +++ b/placement/tests/functional/cmd/test_status.py @@ -10,6 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. +import io + +import fixtures from oslo_config import cfg from oslo_upgradecheck import upgradecheck from oslo_utils.fixture import uuidsentinel @@ -24,12 +27,15 @@ from placement.tests.functional.db import test_consumer class UpgradeCheckIncompleteConsumersTestCase( - base.TestCase, test_consumer.CreateIncompleteAllocationsMixin): + base.TestCase, test_consumer.CreateIncompleteAllocationsMixin, +): """Tests the "Incomplete Consumers" check for the "placement-status upgrade check" command. """ def setUp(self): super(UpgradeCheckIncompleteConsumersTestCase, self).setUp() + self.output = io.StringIO() + self.useFixture(fixtures.MonkeyPatch('sys.stdout', self.output)) config = cfg.ConfigOpts() conf.register_opts(config) config(args=[], project='placement') diff --git a/placement/tests/functional/gabbits/aggregate-legacy-rbac.yaml b/placement/tests/functional/gabbits/aggregate-legacy-rbac.yaml index c65f1dbcd..84fd4f768 100644 --- a/placement/tests/functional/gabbits/aggregate-legacy-rbac.yaml +++ b/placement/tests/functional/gabbits/aggregate-legacy-rbac.yaml @@ -49,7 +49,6 @@ tests: - name: system admin can create new resource provider POST: /resource_providers request_headers: *system_admin_headers - verbose: True data: name: $ENVIRON['RP_NAME'] uuid: $ENVIRON['RP_UUID'] diff --git a/placement/tests/functional/gabbits/aggregate-secure-rbac.yaml b/placement/tests/functional/gabbits/aggregate-secure-rbac.yaml index 298e603ab..4089537ac 100644 --- a/placement/tests/functional/gabbits/aggregate-secure-rbac.yaml +++ b/placement/tests/functional/gabbits/aggregate-secure-rbac.yaml @@ -49,7 +49,6 @@ tests: - name: system admin can create new resource provider POST: /resource_providers request_headers: *system_admin_headers - verbose: true data: name: $ENVIRON['RP_NAME'] uuid: $ENVIRON['RP_UUID']