-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(e2e) Port OIDC tests to multiple connections COMPASS-8105 #6063
Conversation
authMethod: 'MONGODB-OIDC', | ||
connectionName: this.test?.fullTitle(), | ||
connectionName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was wrong ever since I added it but it is not used for single connections and the tests never executed for multiple connections so we never realised.
// we have to browse somewhere that will fire off commands that require | ||
// authentication so that those commands get rejected due to the expired | ||
// auth and then that will trigger the confirmation modal we expect. | ||
await browser.selectConnectionMenuItem( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to point out again: I still don't know what in the single connection world kicked off a command that requires authentication after 10 seconds which would trigger the re-authorization modal. Somehow it just worked.
@@ -22,7 +22,7 @@ export async function hideIndex( | |||
await browser.screenshot(screenshotName); | |||
} | |||
|
|||
await browser.clickVisible(Selectors.ConfirmationModalConfirmButton()); | |||
await browser.clickVisible(Selectors.confirmationModalConfirmButton()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drive-by: I cleaned up the naming. It is TitleCase for constants and camelCase for functions.
const modalHeader = await browser.$(`${modal} h1`); | ||
return (await modalHeader.getText()).includes('Authentication expired'); | ||
}); | ||
await browser.pause(10_000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a comment here that this should aligned with the token expiration or something
Starting mongodb server like this:
(using https://github.com/lerouxb/start-oidc)
This requires the experimental host networking feature enabled for mac and windows which requires signin to docker.
Running with:
Obviously with or without
-- --test-multiple-connections
and also tweaktest-noserver-nocompile
to be eithertest-noserver
ortest
. You probably want a.only
on the describe too.What this does is it starts the OIDC mock server listening on all ips so that the database server in docker can get to it. It starts it with a known hostname and port so that we can get a consistent, known issuer url to use in the mongodb server config. (38231 was just the last port picked automatically while I was working on this.). It then knows to use that mongodb server rather than start its own.