mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Fixes Failing test: Jest Integration Tests.x-pack/plugins/task_manager/server/integration_tests - capacity based claiming should claim tasks to full capacity (#191125)
Resolves https://github.com/elastic/kibana/issues/191117 ## Summary Made the following changes to reduce flakiness: * Set the `runAt` date slightly in the past * Ensured the partitions are properly set when scheduling the task After making these changes, was able to run the capacity claiming tests [50](https://buildkite.com/elastic/kibana-pull-request/builds/232049#0191be3e-9834-4a8f-b0bf-f84a15cab89a) & [65](https://buildkite.com/elastic/kibana-pull-request/builds/232106) times without failing.
This commit is contained in:
parent
86f9af8243
commit
dc0ab43f5a
2 changed files with 6 additions and 3 deletions
|
@ -5,8 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import murmurhash from 'murmurhash';
|
||||
import { type ElasticsearchClient } from '@kbn/core/server';
|
||||
import { type ConcreteTaskInstance } from '../../task';
|
||||
import { MAX_PARTITIONS } from '../../lib/task_partitioner';
|
||||
|
||||
export async function injectTask(
|
||||
esClient: ElasticsearchClient,
|
||||
|
@ -26,6 +28,7 @@ export async function injectTask(
|
|||
params: JSON.stringify(task.params),
|
||||
runAt: task.runAt.toISOString(),
|
||||
scheduledAt: task.scheduledAt.toISOString(),
|
||||
partition: murmurhash.v3(id) % MAX_PARTITIONS,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
@ -169,7 +168,8 @@ describe.skip('capacity based claiming', () => {
|
|||
const ids: string[] = [];
|
||||
times(10, () => ids.push(uuidV4()));
|
||||
|
||||
const runAt = new Date();
|
||||
const now = new Date();
|
||||
const runAt = new Date(now.valueOf() - 1000);
|
||||
for (const id of ids) {
|
||||
await injectTask(kibanaServer.coreStart.elasticsearch.client.asInternalUser, {
|
||||
id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue