Avoid running incompatible Platform Security Serverless tests on MKI. (#165304)

## Summary

When we run tests on MKI, we cannot override Elasticsearch security
realm definitions. This means that any of our tests relying on a custom
Elasticsearch security realm (SAML and JWT) won't work on MKI.

## How to test

See `Kibana serverless cheat sheet` on how to run tests against MKI.
Until https://github.com/elastic/qaf-tests/pull/30 is merged, you'd need
to also add `--exclude-tag=skipMKI` to the test runner command.

/cc @dmlemeshko
This commit is contained in:
Aleh Zasypkin 2023-08-31 16:37:51 +02:00 committed by GitHub
parent 4b02740b32
commit bd28bf4de2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 30 deletions

View file

@ -144,7 +144,8 @@ export default function ({ getService }: FtrProviderContext) {
metadata: {}, metadata: {},
operator: true, operator: true,
roles: ['superuser'], roles: ['superuser'],
username: 'elastic_serverless', // We use `elastic` for MKI, and `elastic_serverless` for any other testing environment.
username: expect.stringContaining('elastic'),
}); });
expect(status).toBe(200); expect(status).toBe(200);
}); });

View file

@ -12,6 +12,10 @@ export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertestWithoutAuth'); const supertest = getService('supertestWithoutAuth');
describe('security/authentication/http', function () { describe('security/authentication/http', function () {
describe('JWT', () => {
// When we run tests on MKI, JWT realm is configured differently, and we cannot handcraft valid JWTs.
this.tags(['skipMKI']);
it('allows JWT HTTP authentication only for selected routes', async () => { it('allows JWT HTTP authentication only for selected routes', async () => {
const jsonWebToken = const jsonWebToken =
'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2tpYmFuYS5lbGFzdGljLmNvL2p3dC8iLCJzdWIiOiJlbGFzdGljLWFnZW50IiwiYXVkIjoiZWxhc3RpY3NlYXJjaCIsIm5hbWUiOiJFbGFzdGljIEFnZW50IiwiaWF0Ijo5NDY2ODQ4MDAsImV4cCI6NDA3MDkwODgwMH0.P7RHKZlLskS5DfVRqoVO4ivoIq9rXl2-GW6hhC9NvTSkwphYivcjpTVcyENZvxTTvJJNqcyx6rF3T-7otTTIHBOZIMhZauc5dob-sqcN_mT2htqm3BpSdlJlz60TBq6diOtlNhV212gQCEJMPZj0MNj7kZRj_GsECrTaU7FU0A3HAzkbdx15vQJMKZiFbbQCVI7-X2J0bZzQKIWfMHD-VgHFwOe6nomT-jbYIXtCBDd6fNj1zTKRl-_uzjVqNK-h8YW1h6tE4xvZmXyHQ1-9yNKZIWC7iEaPkBLaBKQulLU5MvW3AtVDUhzm6--5H1J85JH5QhRrnKYRon7ZW5q1AQ'; 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2tpYmFuYS5lbGFzdGljLmNvL2p3dC8iLCJzdWIiOiJlbGFzdGljLWFnZW50IiwiYXVkIjoiZWxhc3RpY3NlYXJjaCIsIm5hbWUiOiJFbGFzdGljIEFnZW50IiwiaWF0Ijo5NDY2ODQ4MDAsImV4cCI6NDA3MDkwODgwMH0.P7RHKZlLskS5DfVRqoVO4ivoIq9rXl2-GW6hhC9NvTSkwphYivcjpTVcyENZvxTTvJJNqcyx6rF3T-7otTTIHBOZIMhZauc5dob-sqcN_mT2htqm3BpSdlJlz60TBq6diOtlNhV212gQCEJMPZj0MNj7kZRj_GsECrTaU7FU0A3HAzkbdx15vQJMKZiFbbQCVI7-X2J0bZzQKIWfMHD-VgHFwOe6nomT-jbYIXtCBDd6fNj1zTKRl-_uzjVqNK-h8YW1h6tE4xvZmXyHQ1-9yNKZIWC7iEaPkBLaBKQulLU5MvW3AtVDUhzm6--5H1J85JH5QhRrnKYRon7ZW5q1AQ';
@ -48,4 +52,5 @@ export default function ({ getService }: FtrProviderContext) {
.expect(401); .expect(401);
}); });
}); });
});
} }

View file

@ -17,6 +17,10 @@ export default function ({ getService }: FtrProviderContext) {
describe('security/user_profiles', function () { describe('security/user_profiles', function () {
describe('route access', () => { describe('route access', () => {
describe('internal', () => { describe('internal', () => {
// When we run tests on MKI, SAML realm is configured differently, and we cannot handcraft SAML responses to
// log in as SAML users.
this.tags(['skipMKI']);
it('update', async () => { it('update', async () => {
const { status } = await supertestWithoutAuth const { status } = await supertestWithoutAuth
.post(`/internal/security/user_profile/_data`) .post(`/internal/security/user_profile/_data`)