Skip to content
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

Adjust user management functional tests to work in Cloud. #118315

Merged
merged 1 commit into from
Nov 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions x-pack/test/functional/apps/security/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const toasts = getService('toasts');
const browser = getService('browser');

function isCloudEnvironment() {
return config.get('servers.elasticsearch.hostname') !== 'localhost';
}

describe('users', function () {
const optionalUser: UserFormValues = {
username: 'OptionalUser',
Expand All @@ -37,7 +41,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const users = keyBy(await PageObjects.security.getElasticsearchUsers(), 'username');
log.info('actualUsers = %j', users);
log.info('config = %j', config.get('servers.elasticsearch.hostname'));
if (config.get('servers.elasticsearch.hostname') === 'localhost') {

// In Cloud default users are defined in file realm, such users aren't exposed through the Users API.
if (isCloudEnvironment()) {
expect(Object.keys(users)).to.eql(['test_user']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this change? Is there a skipCloud tag we could use similar to skipFirefox?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a skipCloud tag we could use similar to skipFirefox?

There is skipCloud, but it'd still be beneficial to test the Cloud default users (or lack thereof). I think what we need is onlyCloud so that we can have a separate test suite for the Cloud, but afaik we don't have this yet.

} else {
expect(users.elastic.roles).to.eql(['superuser']);
expect(users.elastic.reserved).to.be(true);
expect(users.elastic.deprecated).to.be(false);
Expand All @@ -49,9 +57,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(users.kibana.roles).to.eql(['kibana_system']);
expect(users.kibana.reserved).to.be(true);
expect(users.kibana.deprecated).to.be(true);
} else {
expect(users.anonymous.roles).to.eql(['anonymous']);
expect(users.anonymous.reserved).to.be(true);
}
});

Expand Down