Skip to content

Commit

Permalink
test: Clean up tests
Browse files Browse the repository at this point in the history
Reindexing test was generating index name, could just get it from
server response. Also removed openAndClose from all integration
tests
  • Loading branch information
jloleysens committed Mar 7, 2020
1 parent 64b8e92 commit 42dbd5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ describe('reindex API', () => {
pathPattern: '/api/upgrade_assistant/reindex/{indexName}',
})(
routeHandlerContextMock,
createRequestMock({ params: { indexName: 'theIndex' }, body: { openAndClose: false } }),
createRequestMock({ params: { indexName: 'theIndex' } }),
kibanaResponseFactory
);

Expand All @@ -188,7 +188,7 @@ describe('reindex API', () => {
pathPattern: '/api/upgrade_assistant/reindex/{indexName}',
})(
routeHandlerContextMock,
createRequestMock({ params: { indexName: 'theIndex' }, body: { openAndClose: false } }),
createRequestMock({ params: { indexName: 'theIndex' } }),
kibanaResponseFactory
);

Expand All @@ -211,7 +211,6 @@ describe('reindex API', () => {
'kbn-auth-x': 'HERE!',
},
params: { indexName: 'theIndex' },
body: { openAndClose: false },
}),
kibanaResponseFactory
);
Expand All @@ -234,7 +233,6 @@ describe('reindex API', () => {
routeHandlerContextMock,
createRequestMock({
params: { indexName: 'theIndex' },
body: { openAndClose: false },
}),
kibanaResponseFactory
);
Expand All @@ -261,7 +259,6 @@ describe('reindex API', () => {
routeHandlerContextMock,
createRequestMock({
params: { indexName: 'theIndex' },
body: { openAndClose: false },
}),
kibanaResponseFactory
);
Expand Down Expand Up @@ -387,7 +384,6 @@ describe('reindex API', () => {
routeHandlerContextMock,
createRequestMock({
params: { indexName: 'cancelMe' },
body: { openAndClose: false },
}),
kibanaResponseFactory
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ export default function({ getService }) {
const { body } = await supertest
.post(`/api/upgrade_assistant/reindex/dummydata`)
.set('kbn-xsrf', 'xxx')
.send({
openAndClose: false,
})
.expect(200);

expect(body.indexName).to.equal('dummydata');
Expand Down Expand Up @@ -106,9 +103,6 @@ export default function({ getService }) {
await supertest
.post(`/api/upgrade_assistant/reindex/dummydata`)
.set('kbn-xsrf', 'xxx')
.send({
openAndClose: false,
})
.expect(200);
const lastState = await waitForReindexToComplete('dummydata');

Expand All @@ -133,9 +127,6 @@ export default function({ getService }) {
const { body } = await supertest
.post(`/api/upgrade_assistant/reindex/7.0-data`)
.set('kbn-xsrf', 'xxx')
.send({
openAndClose: false,
})
.expect(200);

expect(body.indexName).to.equal('7.0-data');
Expand Down Expand Up @@ -199,6 +190,8 @@ export default function({ getService }) {
expect(result.body.enqueued.length).to.equal(3);
expect(result.body.errors.length).to.equal(0);

const [{ newIndexName: newTest1Name }] = result.body.enqueued;

await assertQueueState(test1, 3);
await waitForReindexToComplete(test1);

Expand All @@ -212,12 +205,12 @@ export default function({ getService }) {

// Check that the closed index is still closed after reindexing
const clusterStateResponse = await es.cluster.state({
index: generateNewIndexName(test1),
index: newTest1Name,
metric: 'metadata',
});

const test1ReindexedState = getIndexStateFromClusterState(
generateNewIndexName(test1),
newTest1Name,
clusterStateResponse
);
expect(test1ReindexedState).to.be('close');
Expand Down

0 comments on commit 42dbd5a

Please sign in to comment.