Apply patch that addresses the issue with SAC

And improve how to parse a html table to
extract its rows
This commit is contained in:
Marcial Rosales 2025-05-27 10:15:52 +02:00
parent d2767983dc
commit 8960d19492
3 changed files with 37 additions and 17 deletions

View File

@ -1529,9 +1529,12 @@ activate_next_consumer(#?STATE{consumers = Cons0,
State = State0#?STATE{consumers = Cons,
service_queue = ServiceQueue1,
waiting_consumers = Waiting},
Effects1 = consumer_update_active_effects(State, Active,
false, waiting,
Effects0),
Effects = consumer_update_active_effects(State, Consumer,
true, single_active,
Effects0),
Effects1),
{State, Effects};
{{ActiveCKey, ?CONSUMER_PRIORITY(ActivePriority) = Active},
{_NextCKey, ?CONSUMER_PRIORITY(WaitingPriority)}}
@ -1829,8 +1832,22 @@ complete_and_checkout(#{} = Meta, MsgIds, ConsumerKey,
Effects0, State0) ->
State1 = complete(Meta, ConsumerKey, MsgIds, Con0, State0),
%% a completion could have removed the active/quiescing consumer
{State2, Effects1} = activate_next_consumer(State1, Effects0),
checkout(Meta, State0, State2, Effects1).
Effects1 = add_active_effect(Con0, State1, Effects0),
{State2, Effects2} = activate_next_consumer(State1, Effects1),
checkout(Meta, State0, State2, Effects2).
add_active_effect(#consumer{status = quiescing} = Consumer,
#?STATE{cfg = #cfg{consumer_strategy = single_active},
consumers = Consumers} = State,
Effects) ->
case active_consumer(Consumers) of
undefined ->
consumer_update_active_effects(State, Consumer, false, waiting, Effects);
_ ->
Effects
end;
add_active_effect(_, _, Effects) ->
Effects.
cancel_consumer_effects(ConsumerId,
#?STATE{cfg = #cfg{resource = QName}},

View File

@ -187,9 +187,10 @@ module.exports = class BasePage {
}
async getTable(tableLocator, firstNColumns, rowClass) {
const table = await this.waitForDisplayed(tableLocator)
const rows = await table.findElements(rowClass == undefined ?
By.css('tbody tr') : By.css('tbody tr.' + rowClass))
let tbody = await table.findElement(By.css('tbody'))
let rows = await tbody.findElements(By.xpath("./child::*"))
let table_model = []
for (let row of rows) {
let columns = await row.findElements(By.css('td'))
let table_row = []

View File

@ -97,18 +97,18 @@ describe('Given a quorum queue configured with SAC', function () {
assert.equal("1", await queuePage.getConsumerCount())
assert.equal("Consumers (1)", await queuePage.getConsumersSectionTitle())
await queuePage.clickOnConsumerSection()
let consumerTable = await queuePage.getConsumersTable()
let consumerTable = await doWhile(async function() {
return queuePage.getConsumersTable()
}, function(table) {
return table[0][6].localeCompare("single active") == 0
})
assert.equal("single active", consumerTable[0][6])
//assert.equal("●", consumerTable[0][5])
})
it('it should have two consumers, after adding a second subscriber', async function() {
console.log("Connecting..")
amqp091conn = await amqplib.connect('amqp://guest:guest@localhost?frameMax=0')
const ch1 = await amqp091conn.createChannel()
console.log("Connected")
// Listener
ch1.consume(queueName, (msg) => {}, {priority: 10})
@ -118,23 +118,25 @@ describe('Given a quorum queue configured with SAC', function () {
await queuePage.isLoaded()
return queuePage.getConsumerCount()
}, function(count) {
return count.localeCompare("2")
return count.localeCompare("2") == 0
}, 5000)
assert.equal("2", await queuePage.getConsumerCount())
assert.equal("Consumers (2)", await queuePage.getConsumersSectionTitle())
await queuePage.clickOnConsumerSection()
let consumerTable = await queuePage.getConsumersTable()
console.log("consumer table: " + JSON.stringify(consumerTable))
let consumerTable = await doWhile(async function() {
return queuePage.getConsumersTable()
}, function(table) {
return table.length == 2
}, 5000)
let activeConsumer = consumerTable[1][6].localeCompare("single active") == 0 ?
1 : 0
let nonActiveConsumer = activeConsumer == 1 ? 0 : 1
assert.equal("waiting", consumerTable[nonActiveConsumer][6])
//assert.equal("○", consumerTable[nonActiveConsumer][5])
assert.equal("single active", consumerTable[activeConsumer][6])
//assert.equal("●", consumerTable[activeConsumer][5])
await delay(5000)
await delay(5000)
})
after(function() {