Skip to content

Commit

Permalink
Unskip managed configuration integration test (elastic#130331)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
2 people authored and kertal committed May 24, 2022
1 parent 92f84ef commit 1a880a7
Showing 1 changed file with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,27 @@ import { TaskManagerPlugin, TaskManagerStartContract } from '../plugin';
import { coreMock } from '@kbn/core/server/mocks';
import { TaskManagerConfig } from '../config';

// FAILING: https://github.com/elastic/kibana/issues/120269
describe.skip('managed configuration', () => {
describe('managed configuration', () => {
let taskManagerStart: TaskManagerStartContract;
let logger: Logger;

let clock: sinon.SinonFakeTimers;
const savedObjectsClient = savedObjectsRepositoryMock.create();
const esStart = elasticsearchServiceMock.createStart();

const inlineScriptError = new Error('cannot execute [inline] scripts" error') as Error & {
meta: unknown;
};
inlineScriptError.meta = {
body: {
error: {
caused_by: {
reason: 'cannot execute [inline] scripts',
},
},
},
};

beforeEach(async () => {
jest.resetAllMocks();
clock = sinon.useFakeTimers();
Expand Down Expand Up @@ -132,16 +144,12 @@ describe.skip('managed configuration', () => {
});

test('should lower max workers when Elasticsearch returns "cannot execute [inline] scripts" error', async () => {
esStart
.createClient('taskManager')
.asInternalUser.search.mockRejectedValueOnce(
elasticsearchServiceMock.createErrorTransportRequestPromise(
new Error('cannot execute [inline] scripts" error')
)
);
esStart.client.asInternalUser.search.mockImplementationOnce(async () => {
throw inlineScriptError;
});

await expect(taskManagerStart.fetch({})).rejects.toThrowErrorMatchingInlineSnapshot(
`"cannot execute [inline] scripts" error"`
`"cannot execute [inline] scripts\\" error"`
);
clock.tick(ADJUST_THROUGHPUT_INTERVAL);

Expand All @@ -155,16 +163,12 @@ describe.skip('managed configuration', () => {
});

test('should increase poll interval when Elasticsearch returns "cannot execute [inline] scripts" error', async () => {
esStart
.createClient('taskManager')
.asInternalUser.search.mockRejectedValueOnce(
elasticsearchServiceMock.createErrorTransportRequestPromise(
new Error('cannot execute [inline] scripts" error')
)
);
esStart.client.asInternalUser.search.mockImplementationOnce(async () => {
throw inlineScriptError;
});

await expect(taskManagerStart.fetch({})).rejects.toThrowErrorMatchingInlineSnapshot(
`"cannot execute [inline] scripts" error"`
`"cannot execute [inline] scripts\\" error"`
);

clock.tick(ADJUST_THROUGHPUT_INTERVAL);
Expand Down

0 comments on commit 1a880a7

Please sign in to comment.