diff options
| author | Taavi Ansper <taaviansperr@gmail.com> | 2026-02-06 14:07:48 +0200 |
|---|---|---|
| committer | Taavi Ansper <taaviansperr@gmail.com> | 2026-04-15 12:23:10 +0000 |
| commit | 1264c46c67690abb900d74552d100746fcfa921e (patch) | |
| tree | e79c5afa68bd258c6cf163fd7b5b0b6a06a5497c /tests/testinfra | |
| parent | a80b14c1e9ddc39ee7cf0e6050400d6daf43fe24 (diff) | |
| download | kolla-ansible-1264c46c67690abb900d74552d100746fcfa921e.tar.gz kolla-ansible-1264c46c67690abb900d74552d100746fcfa921e.zip | |
Fix keystone with IDP configured.
1. Add CI coverage for keystone_identity_providers under federation
scenario.
2. Add fix for federation config in keystone role if keystone_identity_providers is
defined.
3. Update Horizon tests with federation example.
4. Use openstack.cloud ansible modules instead of python-openstackclient
in register_identity_providers.yml
Closes-Bug: #2134455
Change-Id: Id03bc5770c3856c7c09a34e327b33786d7b7d859
Signed-off-by: Taavi Ansper <taaviansperr@gmail.com>
Diffstat (limited to 'tests/testinfra')
| -rw-r--r-- | tests/testinfra/test_horizon.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/testinfra/test_horizon.py b/tests/testinfra/test_horizon.py index 9b27e4700..0c1527a9d 100644 --- a/tests/testinfra/test_horizon.py +++ b/tests/testinfra/test_horizon.py @@ -12,13 +12,17 @@ # License for the specific language governing permissions and limitations # under the License. +import os +import pytest import time import yaml from pathlib import Path from selenium.common.exceptions import TimeoutException +from selenium.common.exceptions import WebDriverException from selenium import webdriver from selenium.webdriver.common.by import By +from selenium.webdriver.support.ui import Select from selenium.webdriver.support.ui import WebDriverWait home = Path.home() @@ -122,3 +126,50 @@ def test_horizon_login(host): raise e finally: driver.quit() + + +@pytest.mark.skipif( + os.getenv("SCENARIO") != "federation", + reason=( + "Current scenario is not federation. " + "Not running test." + ) +) +def test_horizon_login_federation(host): + + firefox_options = webdriver.FirefoxOptions() + selenium_url = host.environment().get( + 'SELENIUM_REMOTE_URL', 'http://localhost:4500/wd/hub') + + driver = webdriver.Remote( + command_executor=selenium_url, + options=firefox_options) + + horizon_proto = host.environment().get('HORIZON_PROTO') + horizon_url = horizon_proto + "://192.0.2.10" + login_url = '/'.join(( + horizon_url, + 'auth', + 'login')) + + try: + driver.get(login_url) + auth_type_field = driver.find_element(By.ID, 'id_auth_type') + select = Select(auth_type_field) + select.select_by_value('example_provider_openid') + button = driver.find_element(By.CSS_SELECTOR, '.btn-primary') + + try: + button.click() + except WebDriverException as e: + if "Reached error page" in str(e) or "dnsNotFound" in str(e): + pass # This is expected behavior, so we ignore the exception + else: + raise # Re-raise if it failed for an unexpected reason + + assert "idp.example.org" in driver.current_url # nosec B101 + + except TimeoutException as e: + raise e + finally: + driver.quit() |
