Skip to content

Commit

Permalink
Unskip managed configuration integration test (#130331)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
mikecote and kibanamachine authored Apr 18, 2022
1 parent c64ebc2 commit 4cccb69
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 4cccb69

Please sign in to comment.