From 81cf5f2e466a4af22b4b71f2ec0fcfed499587b5 Mon Sep 17 00:00:00 2001 From: Marcial Rosales Date: Thu, 8 May 2025 18:29:54 +0200 Subject: [PATCH] Exclude other_rabbitmq when running start-others. And fix some issues --- selenium/bin/components/rabbitmq | 2 +- selenium/bin/suite_template | 4 +- selenium/fakeportal/proxy.js | 9 ++- selenium/suites/mgt/mgt-only-exchanges.sh | 3 +- selenium/test/basic-auth/env.disable-metrics | 1 + selenium/test/exchanges/management.js | 21 +++-- selenium/test/mgt-only/enabled_plugins | 15 ---- selenium/test/mgt-only/imports/users.json | 81 ------------------- selenium/test/mgt-only/logging.conf | 1 - selenium/test/mgt-only/rabbitmq.conf | 7 -- .../rabbitmq.enable-basic-auth.conf | 2 +- .../oauth/rabbitmq.load-user-definitions.conf | 2 +- selenium/test/pageobjects/BasePage.js | 2 +- selenium/test/pageobjects/VhostsAdminTab.js | 2 +- selenium/test/vhosts/admin-vhosts.js | 6 +- 15 files changed, 34 insertions(+), 124 deletions(-) create mode 100644 selenium/test/basic-auth/env.disable-metrics delete mode 100644 selenium/test/mgt-only/enabled_plugins delete mode 100644 selenium/test/mgt-only/imports/users.json delete mode 100644 selenium/test/mgt-only/logging.conf delete mode 100644 selenium/test/mgt-only/rabbitmq.conf diff --git a/selenium/bin/components/rabbitmq b/selenium/bin/components/rabbitmq index 9cf16d495cbe..2157ef7f18ca 100644 --- a/selenium/bin/components/rabbitmq +++ b/selenium/bin/components/rabbitmq @@ -194,6 +194,6 @@ start_docker_rabbitmq() { -v ${TEST_DIR}:/config \ ${RABBITMQ_DOCKER_IMAGE} - wait_for_message rabbitmq "Server startup complete" + wait_for_message rabbitmq "Server startup complete" end "RabbitMQ ready" } diff --git a/selenium/bin/suite_template b/selenium/bin/suite_template index c1e64653ebe3..e9f986e85879 100644 --- a/selenium/bin/suite_template +++ b/selenium/bin/suite_template @@ -594,8 +594,8 @@ determine_required_components_including_rabbitmq() { } determine_required_components_excluding_rabbitmq() { for (( i=1; i<=$#; i++)) { - if [[ $i != "rabbitmq" ]]; then - eval val='$'$i + eval val='$'$i + if [[ "$val" != "rabbitmq" ]] && [[ "$val" != "other_rabbitmq" ]]; then REQUIRED_COMPONENTS+=( "$val" ) fi } diff --git a/selenium/fakeportal/proxy.js b/selenium/fakeportal/proxy.js index 8bcdd217f304..248f4721bea8 100644 --- a/selenium/fakeportal/proxy.js +++ b/selenium/fakeportal/proxy.js @@ -1,6 +1,6 @@ var http = require('http'), httpProxy = require('http-proxy'); -const {log, error} = require('./utils.js') + const XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest const rabbitmq_url = process.env.RABBITMQ_URL || 'http://0.0.0.0:15672/'; @@ -35,6 +35,13 @@ log("fakeproxy listening on port " + port + ". RABBITMQ_URL=" + rabbitmq_url) server.listen(port); +function log(message) { + console.log(new Date() + " " + message) +} +function error(message) { + console.error(new Date() + " " + message) +} + function default_if_blank(value, defaultValue) { if (typeof value === "undefined" || value === null || value == "") { return defaultValue; diff --git a/selenium/suites/mgt/mgt-only-exchanges.sh b/selenium/suites/mgt/mgt-only-exchanges.sh index 725503d068f4..cfe284aebaf4 100755 --- a/selenium/suites/mgt/mgt-only-exchanges.sh +++ b/selenium/suites/mgt/mgt-only-exchanges.sh @@ -3,7 +3,8 @@ SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" TEST_CASES_PATH=/exchanges -TEST_CONFIG_PATH=/mgt-only +TEST_CONFIG_PATH=/basic-auth +PROFILES="disable-metrics" source $SCRIPT/../../bin/suite_template $@ run diff --git a/selenium/test/basic-auth/env.disable-metrics b/selenium/test/basic-auth/env.disable-metrics new file mode 100644 index 000000000000..8a77eabdf1fa --- /dev/null +++ b/selenium/test/basic-auth/env.disable-metrics @@ -0,0 +1 @@ +export DISABLE_METRICS=true \ No newline at end of file diff --git a/selenium/test/exchanges/management.js b/selenium/test/exchanges/management.js index 5f6830a52f37..5919c9771668 100644 --- a/selenium/test/exchanges/management.js +++ b/selenium/test/exchanges/management.js @@ -8,6 +8,8 @@ const OverviewPage = require('../pageobjects/OverviewPage') const ExchangesPage = require('../pageobjects/ExchangesPage') const ExchangePage = require('../pageobjects/ExchangePage') +const DISABLE_METRICS = process.env.DISABLE_METRICS || false + describe('Exchange management', function () { let login let exchanges @@ -76,7 +78,6 @@ describe('Exchange management', function () { await exchanges.clickOnSelectTableColumns() let table = await exchanges.getSelectableTableColumns() - assert.equal(2, table.length) let overviewGroup = { "name" : "Overview:", "columns": [ @@ -88,14 +89,18 @@ describe('Exchange management', function () { } assert.equal(JSON.stringify(table[0]), JSON.stringify(overviewGroup)) - let messageRatesGroup = { - "name" : "Message rates:", - "columns": [ - {"name:":"rate in","id":"checkbox-exchanges-rate-in"}, - {"name:":"rate out","id":"checkbox-exchanges-rate-out"} - ] + if (!DISABLE_METRICS) { + assert.equal(table.length, 2) + + let messageRatesGroup = { + "name" : "Message rates:", + "columns": [ + {"name:":"rate in","id":"checkbox-exchanges-rate-in"}, + {"name:":"rate out","id":"checkbox-exchanges-rate-out"} + ] + } + assert.equal(JSON.stringify(table[1]), JSON.stringify(messageRatesGroup)) } - assert.equal(JSON.stringify(table[1]), JSON.stringify(messageRatesGroup)) }) diff --git a/selenium/test/mgt-only/enabled_plugins b/selenium/test/mgt-only/enabled_plugins deleted file mode 100644 index 12c30741f785..000000000000 --- a/selenium/test/mgt-only/enabled_plugins +++ /dev/null @@ -1,15 +0,0 @@ -[accept,amqp10_client,amqp_client,base64url,cowboy,cowlib,eetcd,gun,jose, - prometheus,rabbitmq_auth_backend_cache, - rabbitmq_auth_backend_http,rabbitmq_auth_backend_ldap, - rabbitmq_auth_backend_oauth2,rabbitmq_auth_mechanism_ssl,rabbitmq_aws, - rabbitmq_consistent_hash_exchange,rabbitmq_event_exchange, - rabbitmq_federation,rabbitmq_federation_management, - rabbitmq_jms_topic_exchange,rabbitmq_management,rabbitmq_management_agent, - rabbitmq_mqtt,rabbitmq_peer_discovery_aws,rabbitmq_peer_discovery_common, - rabbitmq_peer_discovery_consul,rabbitmq_peer_discovery_etcd, - rabbitmq_peer_discovery_k8s,rabbitmq_prometheus,rabbitmq_random_exchange, - rabbitmq_recent_history_exchange,rabbitmq_sharding,rabbitmq_shovel, - rabbitmq_shovel_management,rabbitmq_stomp,rabbitmq_stream, - rabbitmq_stream_common,rabbitmq_stream_management,rabbitmq_top, - rabbitmq_tracing,rabbitmq_trust_store,rabbitmq_web_dispatch, - rabbitmq_web_mqtt,rabbitmq_web_stomp]. diff --git a/selenium/test/mgt-only/imports/users.json b/selenium/test/mgt-only/imports/users.json deleted file mode 100644 index 372649127156..000000000000 --- a/selenium/test/mgt-only/imports/users.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "users": [ - { - "name": "guest", - "password_hash": "Joz9zzUBOrX10lB3GisWN5oTXK+wj0gxS/nyrfTYmBOuhps5", - "hashing_algorithm": "rabbit_password_hashing_sha256", - "tags": [ - "administrator" - ], - "limits": {} - }, - { - "name": "administrator-only", - "password_hash": "Joz9zzUBOrX10lB3GisWN5oTXK+wj0gxS/nyrfTYmBOuhps5", - "hashing_algorithm": "rabbit_password_hashing_sha256", - "tags": [ - "administrator" - ], - "limits": {} - }, - { - "name": "management-only", - "password_hash": "Joz9zzUBOrX10lB3GisWN5oTXK+wj0gxS/nyrfTYmBOuhps5", - "hashing_algorithm": "rabbit_password_hashing_sha256", - "tags": [ - "management" - ], - "limits": {} - }, - { - "name": "management", - "password_hash": "Joz9zzUBOrX10lB3GisWN5oTXK+wj0gxS/nyrfTYmBOuhps5", - "hashing_algorithm": "rabbit_password_hashing_sha256", - "tags": [ - "management" - ], - "limits": {} - }, - { - "name": "monitoring-only", - "password_hash": "Joz9zzUBOrX10lB3GisWN5oTXK+wj0gxS/nyrfTYmBOuhps5", - "hashing_algorithm": "rabbit_password_hashing_sha256", - "tags": [ - "monitoring" - ], - "limits": {} - } - ], - "vhosts": [ - { - "name": "/" - }, - { - "name": "other" - } - ], - "permissions": [ - { - "user": "guest", - "vhost": "/", - "configure": ".*", - "write": ".*", - "read": ".*" - }, - { - "user": "guest", - "vhost": "other", - "configure": ".*", - "write": ".*", - "read": ".*" - }, - { - "user": "management", - "vhost": "/", - "configure": ".*", - "write": ".*", - "read": ".*" - } - ] - -} diff --git a/selenium/test/mgt-only/logging.conf b/selenium/test/mgt-only/logging.conf deleted file mode 100644 index a2994c78602d..000000000000 --- a/selenium/test/mgt-only/logging.conf +++ /dev/null @@ -1 +0,0 @@ -log.console.level = debug diff --git a/selenium/test/mgt-only/rabbitmq.conf b/selenium/test/mgt-only/rabbitmq.conf deleted file mode 100644 index b41e3430727e..000000000000 --- a/selenium/test/mgt-only/rabbitmq.conf +++ /dev/null @@ -1,7 +0,0 @@ -auth_backends.1 = rabbit_auth_backend_internal - -management.login_session_timeout = 150 -management_agent.disable_metrics_collector = true -load_definitions = ${RABBITMQ_TEST_DIR}/imports/users.json - -loopback_users = none diff --git a/selenium/test/multi-oauth/rabbitmq.enable-basic-auth.conf b/selenium/test/multi-oauth/rabbitmq.enable-basic-auth.conf index 702b20fc60b0..2983298e9d1d 100644 --- a/selenium/test/multi-oauth/rabbitmq.enable-basic-auth.conf +++ b/selenium/test/multi-oauth/rabbitmq.enable-basic-auth.conf @@ -2,4 +2,4 @@ auth_backends.2 = rabbit_auth_backend_internal management.oauth_disable_basic_auth = false -load_definitions = ${RABBITMQ_TEST_DIR}/imports/users.json +load_definitions = ${IMPORT_DIR}/users.json diff --git a/selenium/test/oauth/rabbitmq.load-user-definitions.conf b/selenium/test/oauth/rabbitmq.load-user-definitions.conf index efe162082bf2..f2027868c252 100644 --- a/selenium/test/oauth/rabbitmq.load-user-definitions.conf +++ b/selenium/test/oauth/rabbitmq.load-user-definitions.conf @@ -1,2 +1,2 @@ -load_definitions = ${RABBITMQ_TEST_DIR}/imports/users.json +load_definitions = ${IMPORT_DIR}/users.json diff --git a/selenium/test/pageobjects/BasePage.js b/selenium/test/pageobjects/BasePage.js index e52e4eb2facc..6e46053e1694 100644 --- a/selenium/test/pageobjects/BasePage.js +++ b/selenium/test/pageobjects/BasePage.js @@ -349,7 +349,7 @@ module.exports = class BasePage { async chooseFile (locator, file) { const element = await this.waitForDisplayed(locator) const remote = require('selenium-webdriver/remote'); - driver.setFileDetector(new remote.FileDetector); + this.driver.setFileDetector(new remote.FileDetector); return element.sendKeys(file) } async acceptAlert () { diff --git a/selenium/test/pageobjects/VhostsAdminTab.js b/selenium/test/pageobjects/VhostsAdminTab.js index e7762e013aaf..c86865861565 100644 --- a/selenium/test/pageobjects/VhostsAdminTab.js +++ b/selenium/test/pageobjects/VhostsAdminTab.js @@ -13,7 +13,7 @@ const TABLE_SECTION = By.css('div#main div#vhosts.section table.list') module.exports = class VhostsAdminTab extends AdminTab { async isLoaded () { - await this.waitForDisplayed(MAIN_SECTION) + return this.waitForDisplayed(MAIN_SECTION) } async searchForVhosts(vhost, regex = false) { await this.sendKeys(FILTER_VHOST, vhost) diff --git a/selenium/test/vhosts/admin-vhosts.js b/selenium/test/vhosts/admin-vhosts.js index 8f815d8d8adb..e9095148f723 100644 --- a/selenium/test/vhosts/admin-vhosts.js +++ b/selenium/test/vhosts/admin-vhosts.js @@ -38,7 +38,7 @@ describe('Virtual Hosts in Admin tab', function () { assert.equal(true, await vhostsTab.hasVhosts("/")) }) it('find default vhost and view it', async function () { - await overview.clickOnOverviewTab() + //await overview.clickOnOverviewTab() await overview.clickOnAdminTab() await adminTab.clickOnVhosts() await vhostsTab.clickOnVhost(await vhostsTab.searchForVhosts("/"), "/") @@ -49,7 +49,7 @@ describe('Virtual Hosts in Admin tab', function () { }) it('vhost selectable columns', async function () { - await overview.clickOnOverviewTab() + //await overview.clickOnOverviewTab() await overview.clickOnAdminTab() await adminTab.clickOnVhosts() await vhostsTab.searchForVhosts("/") @@ -105,7 +105,7 @@ describe('Virtual Hosts in Admin tab', function () { before(async function() { log("Creating vhost") createVhost(getManagementUrl(), vhost, "selenium", "selenium-tag") - await overview.clickOnOverviewTab() + // await overview.clickOnOverviewTab() await overview.clickOnAdminTab() await adminTab.clickOnVhosts() })