diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ca2f072f014a7c1fb56fd2d494a729d3b5fd1bc6..c88ea55b09631bd6d12a8a5a7e27bf60279a5d95 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,13 +47,12 @@ # using merge request pipelines (see https://gitlab.com/gitlab-org/gitlab/-/issues/326098) .eventrouter_rules: rules: - - changes: - - flux/**/$APP*.yaml - - ansible/roles/apps/templates/settings/$APP.yaml - - ansible/roles/apps/tasks/$APP.yaml - - if: '$TRIGGER_JOBS =~ /enable-eventrouter/' - - if: '$CI_COMMIT_MESSAGE =~ /TRIGGER_JOBS=.*enable-eventrouter/' - - if: '$CI_COMMIT_BRANCH == "master"' + - when: always + + +.loki_stack_rules: + rules: + - when: always .nextcloud_rules: rules: @@ -61,19 +60,14 @@ - flux/**/$APP*.yaml - ansible/roles/apps/templates/settings/$APP.yaml - ansible/roles/apps/tasks/$APP.yaml + - test/behave/features/$APP.feature - if: '$TRIGGER_JOBS =~ /enable-nextcloud/' - if: '$CI_COMMIT_MESSAGE =~ /TRIGGER_JOBS=.*enable-nextcloud/' - if: '$CI_COMMIT_BRANCH == "master"' .prometheus_stack_rules: rules: - - changes: - - flux/**/$APP*.yaml - - ansible/roles/apps/templates/settings/$APP.yaml - - ansible/roles/apps/tasks/$APP.yaml - - if: '$TRIGGER_JOBS =~ /enable-prometheus-stack/' - - if: '$CI_COMMIT_MESSAGE =~ /TRIGGER_JOBS=.*enable-prometheus-stack/' - - if: '$CI_COMMIT_BRANCH == "master"' + - when: always .rocketchat_rules: rules: @@ -81,6 +75,7 @@ - flux/**/$APP*.yaml - ansible/roles/apps/templates/settings/$APP.yaml - ansible/roles/apps/tasks/$APP.yaml + - test/behave/features/$APP.feature - if: '$TRIGGER_JOBS =~ /enable-rocketchat/' - if: '$CI_COMMIT_MESSAGE =~ /TRIGGER_JOBS=.*enable-rocketchat/' - if: '$CI_COMMIT_BRANCH == "master"' @@ -101,6 +96,7 @@ - flux/**/$APP*.yaml - ansible/roles/apps/templates/settings/$APP.yaml - ansible/roles/apps/tasks/$APP.yaml + - test/behave/features/$APP.feature - if: '$TRIGGER_JOBS =~ /enable-wordpress/' - if: '$CI_COMMIT_MESSAGE =~ /TRIGGER_JOBS=.*enable-wordpress/' - if: '$CI_COMMIT_BRANCH == "master"' @@ -169,6 +165,7 @@ ci-test-image-build: - if: '$CI_COMMIT_MESSAGE =~ /TRIGGER_JOBS=.*ci-test-image-build/' extends: - .kaniko_build + interruptible: true # Stage: create-vps # ================= @@ -204,7 +201,7 @@ create-vps: url: https://$FQDN on_stop: terminate-droplet auto_stop_in: 1 week - + interruptible: true # Stage: enable-apps # ================== @@ -223,6 +220,7 @@ create-vps: paths: - ./clusters - ./enabled_apps/$APP + interruptible: true enable-eventrouter: variables: @@ -231,6 +229,13 @@ enable-eventrouter: - .enable_app_template - .eventrouter_rules + +enable-loki-stack: + variables: + APP: "loki-stack" + extends: + - .enable_app_template + - .loki_stack_rules enable-nextcloud: variables: APP: "nextcloud" @@ -278,6 +283,7 @@ test-dns: - flux/**/* - test/**/* - openappstack/**/* + interruptible: true setup-openappstack: stage: setup-cluster @@ -309,6 +315,7 @@ setup-openappstack: - openappstack/**/* extends: - .ssh_setup + interruptible: true # Stage: helm-release @@ -333,6 +340,7 @@ setup-openappstack: when: always extends: - .ssh_setup + interruptible: true eventrouter-helm-release: variables: @@ -341,6 +349,14 @@ eventrouter-helm-release: - .helm-release - .eventrouter_rules + +loki-stack-helm-release: + variables: + APP: "loki-stack" + extends: + - .helm-release + - .loki_stack_rules + nextcloud-helm-release: variables: APP: "nextcloud" @@ -397,6 +413,7 @@ wordpress-helm-release: when: always extends: - .ssh_setup + interruptible: true eventrouter-ready: variables: @@ -407,6 +424,15 @@ eventrouter-ready: - .apps-ready - .eventrouter_rules +loki-stack-ready: + variables: + APP: "loki-stack" + needs: + - job: loki-stack-helm-release + extends: + - .apps-ready + - .loki_stack_rules + nextcloud-ready: variables: APP: "nextcloud" @@ -470,6 +496,7 @@ wordpress-ready: when: always extends: - .ssh_setup + interruptible: true nextcloud-cert: variables: @@ -537,6 +564,7 @@ testinfra: - openappstack/**/* extends: - .ssh_setup + interruptible: true prometheus-stack-alerts: stage: health-test @@ -553,6 +581,7 @@ prometheus-stack-alerts: - .prometheus_stack_rules needs: - job: prometheus-stack-ready + interruptible: true # Stage: integration-test @@ -574,6 +603,7 @@ prometheus-stack-alerts: when: on_failure extends: - .ssh_setup + interruptible: true prometheus-stack-behave: variables: @@ -657,3 +687,4 @@ gitlab-merge-workaround: image: busybox script: - echo "Not building anything, no changes." + interruptible: true diff --git a/ansible/group_vars/all/settings.yml.example b/ansible/group_vars/all/settings.yml.example index 4e51fe811e20a02f4b98aeecba6a1326d78c1b6e..6d711141e1b20b7c66f3588db063455210aedc08 100644 --- a/ansible/group_vars/all/settings.yml.example +++ b/ansible/group_vars/all/settings.yml.example @@ -93,9 +93,9 @@ enabled_applications: - 'local-path-provisioner' # - 'single-sign-on' # - # Monitoring components - - 'prometheus-stack' - - 'loki-stack' + # Monitoring components (auto-enabled by GitLab CI) + # - 'prometheus-stack' + # - 'loki-stack' # - 'eventrouter' # # The backup system Velero is disabled by default, see settings under `backup` above. diff --git a/ansible/roles/apps/tasks/velero.yml b/ansible/roles/apps/tasks/velero.yml index 1d5f3686ec6acef40a39c12f966e30d6389ba4b0..b8b8ddc8f45d78b2a3a1abe70cb812f9180a91ee 100644 --- a/ansible/roles/apps/tasks/velero.yml +++ b/ansible/roles/apps/tasks/velero.yml @@ -64,6 +64,7 @@ remote_src: true src: "/tmp/velero-v{{ velero.version }}.tar.gz" dest: "/tmp/" + when: velero_version.stdout != velero.version - name: Install velero CLI tags: @@ -76,3 +77,4 @@ group: root mode: "0755" become: true + when: velero_version.stdout != velero.version diff --git a/ansible/roles/apps/templates/settings/nextcloud.yaml b/ansible/roles/apps/templates/settings/nextcloud.yaml index 2ce37efc544200dcdd6c241c33252e515a36bf14..26b4d8196b2b495e02d48b1f0b83031fb0d0aee6 100644 --- a/ansible/roles/apps/templates/settings/nextcloud.yaml +++ b/ansible/roles/apps/templates/settings/nextcloud.yaml @@ -13,7 +13,7 @@ nextcloud: smtp: host: "{{ outgoing_mail.smtp.host }}" {% if outgoing_mail.smtp.ssl %} - secure: "ssl" + secure: "tls" {% else %} secure: "" {% endif %} diff --git a/ansible/roles/apps/templates/settings/rocketchat.yaml b/ansible/roles/apps/templates/settings/rocketchat.yaml index 17153b664fa8823b5676209cda6eef9922e92c51..ff34541dbcbaeaedc02b51d7942b7d5f0cd92279 100644 --- a/ansible/roles/apps/templates/settings/rocketchat.yaml +++ b/ansible/roles/apps/templates/settings/rocketchat.yaml @@ -21,45 +21,45 @@ extraEnv: | - name: Accounts_RegistrationForm_LinkReplacementText value: "Create a new account at admin.{{ domain }} to add users" # Custom OAuth rules: - - name: Accounts_OAuth_Custom-Openappstack + - name: Accounts_OAuth_Custom_Openappstack value: "true" - - name: Accounts_OAuth_Custom-Openappstack-url + - name: Accounts_OAuth_Custom_Openappstack_url value: https://sso.{{ domain }} - - name: Accounts_OAuth_Custom-Openappstack-token_path + - name: Accounts_OAuth_Custom_Openappstack_token_path value: /oauth2/token - - name: Accounts_OAuth_Custom-Openappstack-token_sent_via + - name: Accounts_OAuth_Custom_Openappstack_token_sent_via value: payload - - name: Accounts_OAuth_Custom-Openappstack-identity_token_sent_via + - name: Accounts_OAuth_Custom_Openappstack_identity_token_sent_via value: payload - - name: Accounts_OAuth_Custom-Openappstack-identity_path + - name: Accounts_OAuth_Custom_Openappstack_identity_path value: /userinfo - - name: Accounts_OAuth_Custom-Openappstack-authorize_path + - name: Accounts_OAuth_Custom_Openappstack_authorize_path value: /oauth2/auth - - name: Accounts_OAuth_Custom-Openappstack-scope + - name: Accounts_OAuth_Custom_Openappstack_scope value: openid profile openappstack_roles email - - name: Accounts_OAuth_Custom-Openappstack-id + - name: Accounts_OAuth_Custom_Openappstack_id value: rocketchat - - name: Accounts_OAuth_Custom-Openappstack-secret + - name: Accounts_OAuth_Custom_Openappstack_secret value: {{ rocketchat_oauth_client_secret }} - - name: Accounts_OAuth_Custom-Openappstack-login_style + - name: Accounts_OAuth_Custom_Openappstack_login_style value: redirect - - name: Accounts_OAuth_Custom-Openappstack-button_label_text + - name: Accounts_OAuth_Custom_Openappstack_button_label_text value: Login via OpenAppStack - - name: Accounts_OAuth_Custom-Openappstack-button_label_color + - name: Accounts_OAuth_Custom_Openappstack_button_label_color value: "#FFFFFF" - - name: Accounts_OAuth_Custom-Openappstack-button_color + - name: Accounts_OAuth_Custom_Openappstack_button_color value: "#1d74f5" - - name: Accounts_OAuth_Custom-Openappstack-username_field + - name: Accounts_OAuth_Custom_Openappstack_username_field value: preferred_username - - name: Accounts_OAuth_Custom-Openappstack-name_field + - name: Accounts_OAuth_Custom_Openappstack_name_field value: preferred_username - - name: Accounts_OAuth_Custom-Openappstack-roles_claim + - name: Accounts_OAuth_Custom_Openappstack_roles_claim value: openappstack_roles - - name: Accounts_OAuth_Custom-Openappstack-merge_roles + - name: Accounts_OAuth_Custom_Openappstack_merge_roles value: "true" - - name: Accounts_OAuth_Custom-Openappstack-merge_users + - name: Accounts_OAuth_Custom_Openappstack_merge_users value: "true" - - name: Accounts_OAuth_Custom-Openappstack-show_button + - name: Accounts_OAuth_Custom_Openappstack_show_button value: "true" @@ -99,6 +99,5 @@ mongodb: size: 2Gi image: - repository: open.greenhost.net:4567/openappstack/openappstack/rocketchat - tag: 3.2.2-096aa0023 - pullPolicy: Always + tag: 3.13.0 + pullPolicy: IfNotPresent diff --git a/test/behave/features/nextcloud.feature b/test/behave/features/nextcloud.feature index e1d77c0f259a18a87d7552143c8475caf582a03d..eeb638db1624a598ef9dcb46e83ea9f4267d79e2 100644 --- a/test/behave/features/nextcloud.feature +++ b/test/behave/features/nextcloud.feature @@ -5,7 +5,8 @@ Feature: Test nextcloud admin login And I want to be able to open a document in OnlyOffice Scenario: Test OnlyOffice welcome screen - When I open the onlyoffice URL + Given I have closed all but the first window + And I open the onlyoffice URL Then I wait on element "#status-ok-icon" for 1000ms to exist Scenario: Open nextcloud @@ -32,7 +33,7 @@ Scenario: Create a new document in OnlyOffice When I click on the element "[aria-label='Files']" # Unfortunaty there's no check if the element that's already visible # is also clickable. - And I pause for 5000ms + And I wait on element "[class='button new']" to be clickable And I click on the button "[class='button new']" And I click on the element "[data-action='onlyofficeDocx']" And I add a random string to the inputfield ".filenameform input[type=text]" @@ -40,4 +41,14 @@ Scenario: Create a new document in OnlyOffice And I focus the last opened tab Then I expect a new tab has been opened And I expect that element "div.toast-error" does not exist - And I wait on element "iframe[name='frameEditor']" for 20000ms to be visible + +Scenario: Assert the bold button is not activated + When I wait for the iframe named "frameEditor" and switch to it + Then I wait on element "div.asc-loadmask" for 20000ms to be visible + And I wait on element "div.asc-loadmask" for 20000ms to not exist + And I wait on element "[id='id-toolbar-btn-bold']" for 20000ms to be visible + And I expect that element "[id='id-toolbar-btn-bold']" does not have the class "active" + +Scenario: Active the bold button + When I click on the element "[id='id-toolbar-btn-bold']" + Then I expect that element "[id='id-toolbar-btn-bold']" has the class "active" diff --git a/test/behave/features/prometheus-stack.feature b/test/behave/features/prometheus-stack.feature index 11b8e0d93fc23cf9ecd7209988a125e8429e3bb8..0be22f9ef1582192b2fc071b0c46c86b57782bcf 100644 --- a/test/behave/features/prometheus-stack.feature +++ b/test/behave/features/prometheus-stack.feature @@ -5,7 +5,8 @@ Feature: Test grafana admin login And I want to be able to look at the logs Scenario: Open grafana - When I open the grafana URL + Given I have closed all but the first window + And I open the grafana URL Then I wait on element "//input[@name='user']" for 25000ms to be visible And I expect that the title is "Grafana" And I expect that element "//input[@name='password']" is visible diff --git a/test/behave/features/rocketchat.feature b/test/behave/features/rocketchat.feature index 68ddfacfee6ee37c68a9f1e50ec7b998a41f1247..0351712775c052b814567dbd180a01b364e0d19b 100644 --- a/test/behave/features/rocketchat.feature +++ b/test/behave/features/rocketchat.feature @@ -4,7 +4,8 @@ Feature: Test rocketchat admin login I want to be able to login to rocketchat as the user admin Scenario: Open rocketchat - When I open the rocketchat URL + Given I have closed all but the first window + And I open the rocketchat URL Then I wait on element "//input[@name='emailOrUsername']" for 25000ms to be visible And I expect that element "#pass" is visible diff --git a/test/behave/features/steps/steps.py b/test/behave/features/steps/steps.py index aab05806a9f074c5fdcc6bbcbc2a2ebe6b7a7e8c..b869f588296147571d3aaf2eeb7e48faea4d94f8 100644 --- a/test/behave/features/steps/steps.py +++ b/test/behave/features/steps/steps.py @@ -1,5 +1,7 @@ from oas_behave.common_steps import * - +from selenium.webdriver.common.by import By +from selenium.webdriver.support import expected_conditions as EC +from selenium.webdriver.support.ui import WebDriverWait @when(u'I open the rocketchat URL') @given(u'I open the rocketchat URL') @@ -21,3 +23,16 @@ def step_impl(context): print(helm_operator_url) context.behave_driver.get(helm_operator_url) +@when(u'I wait on element "{element}" to be clickable') +@given(u'I wait on element "{element}" to be clickable') +def step_impl(context, element): + """Wait for element ro be clickable.""" + wait = WebDriverWait(context.behave_driver, 30) + wait.until(EC.element_to_be_clickable((By.CLASS_NAME, "button.new"))) + +@when(u'I wait for the iframe named "{name}" and switch to it') +@given(u'I wait for the iframe named "{name}" and switch to it') +def step_impl(context, name): + """Wait for the iframe with given name and switch to it.""" + wait = WebDriverWait(context.behave_driver, 30) + wait.until(EC.frame_to_be_available_and_switch_to_it((By.NAME, name))) diff --git a/test/behave/features/wordpress.feature b/test/behave/features/wordpress.feature index fcb1648adba5f3c7a253dd2d51f2ad5b8aaf5161..076173a750b3c0df177e435a42c0d8de7ea69c5e 100644 --- a/test/behave/features/wordpress.feature +++ b/test/behave/features/wordpress.feature @@ -4,7 +4,8 @@ Feature: Test WordPress admin login I want to be able to login to WordPress as the user admin Scenario: Open WordPress - When I open the wordpress URL + Given I have closed all but the first window + And I open the wordpress URL Then I wait on element "#user_login" for 25000ms to be visible And I expect that element "#user_pass" is visible diff --git a/test/pytest/test_app_deployments.py b/test/pytest/test_app_deployments.py index 08cb3e9eb215e4d05d55604cb0acb7ed8d34ad38..01fadbdc4650c7294134f1b7975fb9285902d18d 100644 --- a/test/pytest/test_app_deployments.py +++ b/test/pytest/test_app_deployments.py @@ -25,24 +25,27 @@ EXPECTED_RELEASES = { } EXPECTED_APP_LABELS = { + 'eventrouter': { + 'namespace': 'oas', + 'label_selector': 'app=eventrouter'}, + 'loki-stack': { + 'namespace': 'oas', + 'label_selector': 'app=loki'}, 'nextcloud': { 'namespace': 'oas-apps', 'label_selector': 'app.kubernetes.io/instance=nc'}, - 'wordpress': { - 'namespace': 'oas-apps', - 'label_selector': 'release=wordpress'}, - 'rocketchat': { - 'namespace': 'oas-apps', - 'label_selector': 'app.kubernetes.io/instance=rocketchat'}, 'prometheus-stack': { 'namespace': 'oas', 'label_selector': 'app in (grafana,prometheus)'}, - 'eventrouter': { - 'namespace': 'oas', - 'label_selector': 'app=eventrouter'}, + 'rocketchat': { + 'namespace': 'oas-apps', + 'label_selector': 'app.kubernetes.io/instance=rocketchat'}, 'single-sign-on': { 'namespace': 'oas', - 'label_selector': 'app.kubernetes.io/name in (hydra,hydra-maester,single-sign-on-userbackend,single-sign-on-consent,single-sign-on-userpanel,single-sign-on-login)'} + 'label_selector': 'app.kubernetes.io/name in (hydra,hydra-maester,single-sign-on-userbackend,single-sign-on-consent,single-sign-on-userpanel,single-sign-on-login)'}, + 'wordpress': { + 'namespace': 'oas-apps', + 'label_selector': 'release=wordpress'} }