question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide a way to connect a role (or role set) to a concurrent connection

See original GitHub issue

What is your Scenario?

We have a complex multi-tenant SaaS product. And we test our product using a server. We need to make sure that every concurrent browser test is working in a separate tenant (separate Role making sure it’s not used twice in the same time) to avoid errors.

What are you suggesting?

Maybe provide a current thread/browser index through t.testRun.browserConnection.index? Or update t.testRun.browserConnection.id that it would start with {index}_ prefix?

Basically we need an ability to select Role1, Role2, ..., RoleX based on some condition provided from the test runned, making sure it’s not overlaps

What alternatives have you considered?

No response

Additional context

Checked this one https://github.com/DevExpress/testcafe/issues/5356

Playwright has workerInfo.workerIndex https://playwright.dev/docs/next/test-fixtures#worker-scoped-fixtures

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
syabrocommented, Dec 21, 2022

Hmmm. If I get correct and you’re saying that ids will be permanent for all threads during all tests then it definitely could work. Thank you.

1reaction
AlexKamaevcommented, Dec 21, 2022

You can use the following code to map browser connection ids to the indices:

import { getBrowserIndex } from "./browser-indices";

fixture `f`
    .page `http://example.com`

for (let i = 0; i < 100; i++) {
    test(`test${i}`, async t => {
        console.log('browserIndex: ' + getBrowserIndex(t.testRun.browserConnection.id));
    });
}
const BROWSER_INDICES = {};

export function getBrowserIndex (id) {
    if (!BROWSER_INDICES[id])
        BROWSER_INDICES[id] = Object.keys(BROWSER_INDICES).length;

    return BROWSER_INDICES[id];
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure the user connections Server Configuration Option
In Object Explorer, right-click a server and select Properties. Select the Connections node. Under Connections, in the Max number of concurrent ...
Read more >
Using IAM roles - AWS Identity and Access Management
Use an IAM role to delegate permissions to a user or service.
Read more >
Lesson 9 – Concurrent BLE Connections - Embedded Centric
The connection state library provides a set of user-friendly functions to manage concurrent connections(links). It supports both peripheral links and central ...
Read more >
4 Configuring Privilege and Role Authorization
Roles are created by users (usually administrators) to group together privileges or other roles. They are a way to facilitate the granting of...
Read more >
Limiting the number of concurrent connections by a user
pguser=# alter user bob connection limit 0;ALTER ROLE. To allow 10 concurrent connections for the bob user, run this command:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found