From: Alfonso Martínez Date: Wed, 11 Aug 2021 06:59:13 +0000 (+0200) Subject: mgr/dashboard: set rgw credentials: fix api tests X-Git-Tag: v17.1.0~1139^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=a682b9d7a49fbd50c69494f947a6c0565ad0c78e;p=ceph-ci.git mgr/dashboard: set rgw credentials: fix api tests Fixes: https://tracker.ceph.com/issues/44605 Signed-off-by: Alfonso Martínez --- diff --git a/qa/tasks/mgr/dashboard/test_rgw.py b/qa/tasks/mgr/dashboard/test_rgw.py index b7d650f4160..b973a2be482 100644 --- a/qa/tasks/mgr/dashboard/test_rgw.py +++ b/qa/tasks/mgr/dashboard/test_rgw.py @@ -70,20 +70,11 @@ class RgwApiCredentialsTest(RgwTestCase): AUTH_ROLES = ['rgw-manager'] - def setUp(self): - super(RgwApiCredentialsTest, self).setUp() - # Restart the Dashboard module to ensure that the connection to the - # RGW Admin Ops API is re-established with the new credentials. - self.logout() - self._ceph_cmd(['mgr', 'module', 'disable', 'dashboard']) - self._ceph_cmd(['mgr', 'module', 'enable', 'dashboard', '--force']) - super(RgwApiCredentialsTest, self).setUp() - def test_invalid_credentials(self): self._ceph_cmd_with_secret(['dashboard', 'set-rgw-api-secret-key'], 'invalid') self._ceph_cmd_with_secret(['dashboard', 'set-rgw-api-access-key'], 'invalid') resp = self._get('/api/rgw/user') - self.assertStatus(500) + self.assertStatus(404) self.assertIn('detail', resp) self.assertIn('component', resp) self.assertIn('Error connecting to Object Gateway', resp['detail']) diff --git a/qa/tasks/mgr/dashboard/test_settings.py b/qa/tasks/mgr/dashboard/test_settings.py index 869ea2ca445..d6ad1e762e3 100644 --- a/qa/tasks/mgr/dashboard/test_settings.py +++ b/qa/tasks/mgr/dashboard/test_settings.py @@ -51,15 +51,15 @@ class SettingsTest(DashboardTestCase): def test_bulk_set(self): self._put('/api/settings', { - 'USER_PWD_EXPIRATION_WARNING_1': 12, - 'USER_PWD_EXPIRATION_WARNING_2': 6, + 'RGW_API_ACCESS_KEY': 'dummy-key', + 'RGW_API_SECRET_KEY': 'dummy-secret', }) self.assertStatus(200) - host = self._get('/api/settings/rgw-api-host')['value'] + access_key = self._get('/api/settings/rgw-api-access-key')['value'] self.assertStatus(200) - self.assertEqual('somehost', host) + self.assertEqual('dummy-key', access_key) - port = self._get('/api/settings/rgw-api-port')['value'] + secret_key = self._get('/api/settings/rgw-api-secret-key')['value'] self.assertStatus(200) - self.assertEqual(7777, port) + self.assertEqual('dummy-secret', secret_key) diff --git a/src/pybind/mgr/dashboard/run-backend-api-tests.sh b/src/pybind/mgr/dashboard/run-backend-api-tests.sh index 46ce4ce951e..20abe7ebf01 100755 --- a/src/pybind/mgr/dashboard/run-backend-api-tests.sh +++ b/src/pybind/mgr/dashboard/run-backend-api-tests.sh @@ -43,7 +43,7 @@ setup_teuthology() { ${TEUTHOLOGY_PYTHON_BIN:-/usr/bin/python3} -m venv venv source venv/bin/activate - pip install 'setuptools >= 12' + pip install -U pip 'setuptools >= 12' pip install git+https://github.com/ceph/teuthology#egg=teuthology[test] pushd $CURR_DIR pip install -r requirements.txt -c constraints.txt