Fix flake on rabbitmq_mqtt auth_SUITE (#13180)
* Separate invalid client test from the valid one * Apply same changes from pr #13197 * Deal with stalereferences caused by timing issues looking up objects in the DOM * Unlink before assertion
This commit is contained in:
parent
e8a302a249
commit
2ab890f344
|
@ -68,9 +68,11 @@ sub_groups() ->
|
|||
ssl_user_vhost_parameter_mapping_vhost_does_not_exist,
|
||||
ssl_user_cert_vhost_mapping_takes_precedence_over_port_vhost_mapping
|
||||
]},
|
||||
{ssl_user_with_invalid_client_id_in_cert_san_dns, [],
|
||||
[invalid_client_id_from_cert_san_dns
|
||||
]},
|
||||
{ssl_user_with_client_id_in_cert_san_dns, [],
|
||||
[client_id_from_cert_san_dns,
|
||||
invalid_client_id_from_cert_san_dns
|
||||
[client_id_from_cert_san_dns
|
||||
]},
|
||||
{ssl_user_with_client_id_in_cert_san_dns_1, [],
|
||||
[client_id_from_cert_san_dns_1
|
||||
|
@ -207,7 +209,8 @@ mqtt_config(no_ssl_user) ->
|
|||
mqtt_config(client_id_propagation) ->
|
||||
{rabbitmq_mqtt, [{ssl_cert_login, true},
|
||||
{allow_anonymous, true}]};
|
||||
mqtt_config(ssl_user_with_client_id_in_cert_san_dns) ->
|
||||
mqtt_config(T) when T == ssl_user_with_client_id_in_cert_san_dns;
|
||||
T == ssl_user_with_invalid_client_id_in_cert_san_dns ->
|
||||
{rabbitmq_mqtt, [{ssl_cert_login, true},
|
||||
{allow_anonymous, false},
|
||||
{ssl_cert_client_id_from, subject_alternative_name},
|
||||
|
@ -588,8 +591,8 @@ client_id_from_cert_dn(Config) ->
|
|||
invalid_client_id_from_cert_san_dns(Config) ->
|
||||
MqttClientId = <<"other_client_id">>,
|
||||
{ok, C} = connect_ssl(MqttClientId, Config),
|
||||
?assertMatch({error, _}, emqtt:connect(C)),
|
||||
unlink(C).
|
||||
unlink(C),
|
||||
{error, {client_identifier_not_valid, _}} = emqtt:connect(C).
|
||||
|
||||
ssl_user_vhost_parameter_mapping_success(Config) ->
|
||||
expect_successful_connection(fun connect_ssl/1, Config).
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"chromedriver": "^130.0.4",
|
||||
"chromedriver": "^132.0",
|
||||
"ejs": "^3.1.8",
|
||||
"express": "^4.18.2",
|
||||
"geckodriver": "^3.0.2",
|
||||
|
|
|
@ -45,6 +45,7 @@ module.exports = class BasePage {
|
|||
return this.selectOption(SELECT_REFRESH, option)
|
||||
}
|
||||
async waitForOverviewTab() {
|
||||
await this.driver.sleep(250)
|
||||
return this.waitForDisplayed(OVERVIEW_TAB)
|
||||
}
|
||||
|
||||
|
@ -56,6 +57,7 @@ module.exports = class BasePage {
|
|||
return this.click(CONNECTIONS_TAB)
|
||||
}
|
||||
async waitForConnectionsTab() {
|
||||
await this.driver.sleep(250)
|
||||
return this.waitForDisplayed(CONNECTIONS_TAB)
|
||||
}
|
||||
|
||||
|
@ -63,6 +65,7 @@ module.exports = class BasePage {
|
|||
return this.click(ADMIN_TAB)
|
||||
}
|
||||
async waitForAdminTab() {
|
||||
await this.driver.sleep(250)
|
||||
return this.waitForDisplayed(ADMIN_TAB)
|
||||
}
|
||||
|
||||
|
@ -70,6 +73,7 @@ module.exports = class BasePage {
|
|||
return this.click(CHANNELS_TAB)
|
||||
}
|
||||
async waitForChannelsTab() {
|
||||
await this.driver.sleep(250)
|
||||
return this.waitForDisplayed(CHANNELS_TAB)
|
||||
}
|
||||
|
||||
|
@ -77,6 +81,7 @@ module.exports = class BasePage {
|
|||
return this.click(EXCHANGES_TAB)
|
||||
}
|
||||
async waitForExchangesTab() {
|
||||
await this.driver.sleep(250)
|
||||
return this.waitForDisplayed(EXCHANGES_TAB)
|
||||
}
|
||||
|
||||
|
@ -180,42 +185,69 @@ module.exports = class BasePage {
|
|||
}
|
||||
|
||||
async waitForLocated (locator) {
|
||||
try {
|
||||
return this.driver.wait(until.elementLocated(locator), this.timeout,
|
||||
'Timed out after [timeout=' + this.timeout + ';polling=' + this.polling + '] seconds locating ' + locator,
|
||||
this.polling)
|
||||
}catch(error) {
|
||||
if (!error.name.includes("NoSuchSessionError")) {
|
||||
console.error("Failed waitForLocated " + locator + " due to " + error)
|
||||
}
|
||||
throw error
|
||||
}
|
||||
let attempts = 3
|
||||
let retry = false
|
||||
let rethrowError = null
|
||||
do {
|
||||
try {
|
||||
return this.driver.wait(until.elementLocated(locator), this.timeout,
|
||||
'Timed out after [timeout=' + this.timeout + ';polling=' + this.polling + '] seconds locating ' + locator,
|
||||
this.polling)
|
||||
}catch(error) {
|
||||
if (error.name.includes("StaleElementReferenceError")) {
|
||||
retry = true
|
||||
}else if (!error.name.includes("NoSuchSessionError")) {
|
||||
console.error("Failed waitForLocated " + locator + " due to " + error)
|
||||
retry = false
|
||||
}
|
||||
rethrowError = error
|
||||
}
|
||||
} while (retry && --attempts > 0)
|
||||
throw rethrowError
|
||||
}
|
||||
|
||||
async waitForVisible (element) {
|
||||
try {
|
||||
return this.driver.wait(until.elementIsVisible(element), this.timeout,
|
||||
'Timed out after [timeout=' + this.timeout + ';polling=' + this.polling + '] awaiting till visible ' + element,
|
||||
this.polling)
|
||||
}catch(error) {
|
||||
if (!error.name.includes("NoSuchSessionError")) {
|
||||
console.error("Failed to find visible element " + element + " due to " + error)
|
||||
let attempts = 3
|
||||
let retry = false
|
||||
let rethrowError = null
|
||||
do {
|
||||
try {
|
||||
return this.driver.wait(until.elementIsVisible(element), this.timeout,
|
||||
'Timed out after [timeout=' + this.timeout + ';polling=' + this.polling + '] awaiting till visible ' + element,
|
||||
this.polling)
|
||||
}catch(error) {
|
||||
if (error.name.includes("StaleElementReferenceError")) {
|
||||
retry = true
|
||||
}else if (!error.name.includes("NoSuchSessionError")) {
|
||||
console.error("Failed to find visible element " + element + " due to " + error)
|
||||
retry = false
|
||||
}
|
||||
rethrowError = error
|
||||
}
|
||||
throw error
|
||||
}
|
||||
} while (retry && --attempts > 0)
|
||||
throw rethrowError
|
||||
}
|
||||
|
||||
|
||||
async waitForDisplayed (locator) {
|
||||
if (this.interactionDelay && this.interactionDelay > 0) await this.driver.sleep(this.interactionDelay)
|
||||
try {
|
||||
return this.waitForVisible(await this.waitForLocated(locator))
|
||||
}catch(error) {
|
||||
if (!error.name.includes("NoSuchSessionError")) {
|
||||
console.error("Failed to waitForDisplayed " + locator + " due to " + error)
|
||||
}
|
||||
throw error
|
||||
}
|
||||
let attempts = 3
|
||||
let retry = false
|
||||
let rethrowError = null
|
||||
do {
|
||||
if (this.interactionDelay && this.interactionDelay > 0) await this.driver.sleep(this.interactionDelay)
|
||||
try {
|
||||
return this.waitForVisible(await this.waitForLocated(locator))
|
||||
}catch(error) {
|
||||
if (error.name.includes("StaleElementReferenceError")) {
|
||||
retry = true
|
||||
}else if (!error.name.includes("NoSuchSessionError")) {
|
||||
retry = false
|
||||
console.error("Failed to waitForDisplayed " + locator + " due to " + error)
|
||||
}
|
||||
rethrowError = error
|
||||
}
|
||||
} while (retry && --attempts > 0 )
|
||||
throw rethrowError
|
||||
}
|
||||
|
||||
async getText (locator) {
|
||||
|
|
Loading…
Reference in New Issue