-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution][Endpoint] Refactor Cypress login
task and ensure consistent use of users across ESS and Serverless tests
#166958
[Security Solution][Endpoint] Refactor Cypress login
task and ensure consistent use of users across ESS and Serverless tests
#166958
Conversation
…' into task/olm-7690-cypress-login-task
Pinging @elastic/security-defend-workflows (Team:Defend Workflows) |
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.
Thanks for doing this, as usual a piece of good work done 👏
The only thing that comes to my mind is why do we need two approaches to login - login and loginServerless. Please correct me if I got it wrong, but my understanding is that the each test now has to be specific about env's login functionality which makes it not reusable with usage of tags.
What I mean is if we have a spec that should run in two envs (@ess, @serverless) I believe we should ust use 'login' in the spec and somewhere behind the scenes we should login properly.
Does this make sense?
Approved anyway, again it's a great work 👍 Thanks!
|
||
export const ROLE = Object.freeze<Record<SecurityTestUser, SecurityTestUser>>({ | ||
...ENDPOINT_SECURITY_ROLE_NAMES, | ||
elastic: 'elastic', |
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.
can we spread KIBANA_KNOWN_DEFAULT_ACCOUNTS here? Or you want to keep it separated?
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.
The const
is actually an array, thus why I did not use it here... but, thats a good point. I'm going to convert it to an object and then just spread it here so that we keep it centralized.
Hey @tomsonpl - thanks for the review. Re: need for you are right. I refactored |
…' into task/olm-7690-cypress-login-task
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.
Thanks for the refactor. 🚢
async load( | ||
name: EndpointSecurityRoleNames | KibanaKnownUserAccounts | ||
): Promise<LoadedRoleAndUser> { | ||
// If its a known system account, then just exit here and use the default `changeme` password |
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.
nit: If it's...
const KIBANA_USERNAME = 'KIBANA_USERNAME'; | ||
const KIBANA_PASSWORD = 'KIBANA_PASSWORD'; | ||
export const login: CyLoginTask = ( | ||
// FIXME:PT default user to `soc_manager` |
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.
Q: Is this something for later?
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.
yes. I did not change it just yet in order to limit the amount of refactor - just in case that changing it to soc_manager
requires test changes
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Unknown metric groupsESLint disabled in files
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
Summary
login
task refactored:login(user?)
: logs use in using the defaultuser
or one of the users supported by security solution and endpoint management testslogin.with(username, password)
: Logs a user in by usingusername
andpassword
login.withCustomRole(role)
: creates the providedrole
, creates a user for it by the same role name and logs in with itusername
being used is one of the approved user names that applies to serverlessRoleAndUserLoader
class. Is initialized with an map ofRoles
and provide a standard interface for loading them.EndpointSecurityTestRolesLoader
) was also created for the endpoint security test users, which uses the existing set of role definitionsresolver_generator_script
was also updated to use the newEndpointSecurityTestRolesLoader
class for handling the--rbacUser
argument