]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: set rgw credentials: fix api tests
authorAlfonso Martínez <almartin@redhat.com>
Wed, 11 Aug 2021 06:59:13 +0000 (08:59 +0200)
committerSebastian Wagner <sewagner@redhat.com>
Thu, 2 Sep 2021 14:24:38 +0000 (16:24 +0200)
Fixes: https://tracker.ceph.com/issues/44605
Signed-off-by: Alfonso Martínez <almartin@redhat.com>
(cherry picked from commit a682b9d7a49fbd50c69494f947a6c0565ad0c78e)

qa/tasks/mgr/dashboard/test_rgw.py
qa/tasks/mgr/dashboard/test_settings.py
src/pybind/mgr/dashboard/run-backend-api-tests.sh

index b1a53a72140f0e23a1cdfbb95d5f4acb4518a6ff..1bfb995065968c866d06f3b94bf09d59f530ef3d 100644 (file)
@@ -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'])
index 869ea2ca445fb8b4de88e66791ee536a1739b424..d6ad1e762e38e7d2b8a99f2747b406a6ae7fc4fc 100644 (file)
@@ -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)
index 7ce0aa6d95f35a3a85ca7e4f5cac252425d8d2f1..4e8497793c3f3bd37ae29754c670c2694e8c85b9 100755 (executable)
@@ -43,7 +43,7 @@ setup_teuthology() {
 
     virtualenv --python=${TEUTHOLOGY_PYTHON_BIN:-/usr/bin/python3} 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