Skip to content

Commit

Permalink
[7.17] Fix flaky licensing test elastic#148313 (elastic#182712) (elas…
Browse files Browse the repository at this point in the history
…tic#182746)

# Backport

This will backport the following commits from `main` to `7.17`:
- [Fix flaky licensing test elastic#148313
(elastic#182712)](elastic#182712)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Alejandro Fernández
Haro","email":"alejandro.haro@elastic.co"},"sourceCommit":{"committedDate":"2024-05-06T19:25:25Z","message":"Fix
flaky licensing test elastic#148313
(elastic#182712)","sha":"6740ffb8761097a35dd9be7b353fff33eef3d0da","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","backport:all-open","v8.15.0"],"title":"Fix
flaky licensing test
elastic#148313","number":182712,"url":"https://github.com/elastic/kibana/pull/182712","mergeCommit":{"message":"Fix
flaky licensing test elastic#148313
(elastic#182712)","sha":"6740ffb8761097a35dd9be7b353fff33eef3d0da"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/182712","number":182712,"mergeCommit":{"message":"Fix
flaky licensing test elastic#148313
(elastic#182712)","sha":"6740ffb8761097a35dd9be7b353fff33eef3d0da"}}]}]
BACKPORT-->

Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
  • Loading branch information
2 people authored and adelisle committed Aug 5, 2024
1 parent b5014db commit c461516
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion x-pack/test/licensing_plugin/scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export function createScenario({ getService, getPageObjects }: FtrProviderContex
const esSupertestWithoutAuth = getService('esSupertestWithoutAuth');
const security = getService('security');
const PageObjects = getPageObjects(['common', 'security']);
const retry = getService('retry');

const scenario = {
async setup() {
Expand Down Expand Up @@ -109,9 +110,27 @@ export function createScenario({ getService, getPageObjects }: FtrProviderContex
},

async waitForPluginToDetectLicenseUpdate() {
const {
body: { license: esLicense },
} = await esSupertestWithoutAuth
.get('/_license')
.auth('license_manager_user', 'license_manager_user-password')
.expect(200);
// > --xpack.licensing.api_polling_frequency set in test config
// to wait for Kibana server to re-fetch the license from Elasticsearch
await delay(500);
const pollingFrequency = 500;

await retry.waitForWithTimeout(
'waiting for the license.uid to match ES',
4 * pollingFrequency,
async () => {
const {
body: { license: kbLicense },
} = await supertest.get('/api/licensing/info').expect(200);
return kbLicense?.uid === esLicense?.uid;
},
() => delay(pollingFrequency)
);
},
};
return scenario;
Expand Down

0 comments on commit c461516

Please sign in to comment.