Skip to content

Commit

Permalink
Fixes Failing test: Jest Integration Tests.x-pack/plugins/task_manage…
Browse files Browse the repository at this point in the history
…r/server/integration_tests - capacity based claiming should claim tasks to full capacity (elastic#192519)

Resolves elastic#191117

This test became flaky again after merging this PR
elastic#192261 which changes Kibana to
claim tasks against all partitions when the partitions have not yet been
assigned. This was due to setting the `runAt` value to `now-1000` which
means that all injected tasks were immediately overdue and claimable as
soon as possible, which means they might get claimed in different claim
cycles. This PR changes the `runAt` value to `now + 5000` so injected
tasks won't be claimed until they're all injected so they should be
claimed in one cycle.

Copied this test 60 times and was able to run the integration tests
twice (so 120 times total) with no failures.
*
https://buildkite.com/elastic/kibana-pull-request/builds/233196#0191dd0b-fe03-40cf-9fab-b211dd662993
*
https://buildkite.com/elastic/kibana-pull-request/builds/233236#0191dd94-8010-4b3c-988d-6e7d5655f989
  • Loading branch information
ymao1 authored Sep 11, 2024
1 parent 9cd3c4a commit 34fd9dc
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ jest.mock('../queries/task_claiming', () => {

const taskManagerStartSpy = jest.spyOn(TaskManagerPlugin.prototype, 'start');

// Failing: See https://github.com/elastic/kibana/issues/191117
describe.skip('capacity based claiming', () => {
describe('capacity based claiming', () => {
const taskIdsToRemove: string[] = [];
let esServer: TestElasticsearchUtils;
let kibanaServer: TestKibanaUtils;
Expand Down Expand Up @@ -170,7 +169,7 @@ describe.skip('capacity based claiming', () => {
times(10, () => ids.push(uuidV4()));

const now = new Date();
const runAt = new Date(now.valueOf() - 1000);
const runAt = new Date(now.valueOf() + 5000);
for (const id of ids) {
await injectTask(kibanaServer.coreStart.elasticsearch.client.asInternalUser, {
id,
Expand Down

0 comments on commit 34fd9dc

Please sign in to comment.