add configurable ns

This commit is contained in:
Andrew Dolgov 2023-10-22 13:42:41 +03:00
parent ce3eb32076
commit db05575b2d
No known key found for this signature in database
GPG Key ID: 1A56B4FA25D4AF2A
2 changed files with 6 additions and 10 deletions

View File

@ -66,6 +66,7 @@ integration-test:
SELENIUM_GRID_ENDPOINT: http://selenium-hub.selenium-grid.svc.cluster.local:4444/wd/hub SELENIUM_GRID_ENDPOINT: http://selenium-hub.selenium-grid.svc.cluster.local:4444/wd/hub
extends: .integration-test extends: .integration-test
script: script:
- export K8S_NAMESPACE=$(kubectl get pods -o=custom-columns=NS:.metadata.namespace | tail -1)
- python3 tests/integration/selenium_test.py - python3 tests/integration/selenium_test.py
rules: rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

View File

@ -9,19 +9,14 @@ from selenium.webdriver.common.by import By
CI_COMMIT_SHORT_SHA = os.getenv("CI_COMMIT_SHORT_SHA") CI_COMMIT_SHORT_SHA = os.getenv("CI_COMMIT_SHORT_SHA")
SELENIUM_GRID_ENDPOINT = os.getenv("SELENIUM_GRID_ENDPOINT") SELENIUM_GRID_ENDPOINT = os.getenv("SELENIUM_GRID_ENDPOINT")
K8S_NAMESPACE = os.getenv("K8S_NAMESPACE")
if not CI_COMMIT_SHORT_SHA or not SELENIUM_GRID_ENDPOINT:
print("both CI_COMMIT_SHORT_SHA snd SELENIUM_GRID_ENDPOINT env vars should be defined")
exit(1)
driver = webdriver.Remote(command_executor=SELENIUM_GRID_ENDPOINT, options=webdriver.ChromeOptions()) driver = webdriver.Remote(command_executor=SELENIUM_GRID_ENDPOINT, options=webdriver.ChromeOptions())
app_url = f"http://tt-rss-{CI_COMMIT_SHORT_SHA}-app.gitlab-fakecake.svc.cluster.local/tt-rss"
print(f"requesting base url: {app_url}")
try: try:
driver.get(app_url) base_url = f"http://tt-rss-{CI_COMMIT_SHORT_SHA}-app.{K8S_NAMESPACE}.svc.cluster.local/tt-rss"
print(f"requesting base url: {base_url}")
driver.get(base_url)
print("filling in login information...") print("filling in login information...")
@ -37,7 +32,7 @@ try:
print("checking for feedTree...") print("checking for feedTree...")
assert driver.find_element(by=By.CSS_SELECTOR, value="#feedTree") assert driver.find_element(by=By.CSS_SELECTOR, value="#zfeedTree")
print("all done.") print("all done.")