Skip to content

Commit

Permalink
update upgrade_assistant_integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth committed Jan 27, 2021
1 parent 4657b0c commit b7fb0bb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 38 deletions.
2 changes: 0 additions & 2 deletions x-pack/test/upgrade_assistant_integration/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import path from 'path';
import { LegacyEsProvider } from './services';

export default async function ({ readConfigFile }) {
// Read the Kibana API integration tests config file so that we can utilize its services.
Expand All @@ -25,7 +24,6 @@ export default async function ({ readConfigFile }) {
services: {
...kibanaCommonConfig.get('services'),
supertest: kibanaAPITestsConfig.get('services.supertest'),
legacyEs: LegacyEsProvider,
},
esArchiver: xPackFunctionalTestsConfig.get('esArchiver'),
junit: {
Expand Down
7 changes: 0 additions & 7 deletions x-pack/test/upgrade_assistant_integration/services/index.js

This file was deleted.

18 changes: 0 additions & 18 deletions x-pack/test/upgrade_assistant_integration/services/legacy_es.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { getIndexState } from '../../../plugins/upgrade_assistant/common/get_ind
export default function ({ getService }) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');
const es = getService('legacyEs');
const es = getService('es');

// Utility function that keeps polling API until reindex operation has completed or failed.
const waitForReindexToComplete = async (indexName) => {
Expand Down Expand Up @@ -65,14 +65,14 @@ export default function ({ getService }) {
expect(lastState.status).to.equal(ReindexStatus.completed);

const { newIndexName } = lastState;
const indexSummary = await es.indices.get({ index: 'dummydata' });
const { body: indexSummary } = await es.indices.get({ index: 'dummydata' });

// The new index was created
expect(indexSummary[newIndexName]).to.be.an('object');
// The original index name is aliased to the new one
expect(indexSummary[newIndexName].aliases.dummydata).to.be.an('object');
// The number of documents in the new index matches what we expect
expect((await es.count({ index: lastState.newIndexName })).count).to.be(3);
expect((await es.count({ index: lastState.newIndexName })).body.count).to.be(3);

// Cleanup newly created index
await es.indices.delete({
Expand All @@ -95,9 +95,9 @@ export default function ({ getService }) {
],
},
});
expect((await es.count({ index: 'myAlias' })).count).to.be(3);
expect((await es.count({ index: 'wildcardAlias' })).count).to.be(3);
expect((await es.count({ index: 'myHttpsAlias' })).count).to.be(2);
expect((await es.count({ index: 'myAlias' })).body.count).to.be(3);
expect((await es.count({ index: 'wildcardAlias' })).body.count).to.be(3);
expect((await es.count({ index: 'myHttpsAlias' })).body.count).to.be(2);

// Reindex
await supertest
Expand All @@ -107,10 +107,10 @@ export default function ({ getService }) {
const lastState = await waitForReindexToComplete('dummydata');

// The regular aliases should still return 3 docs
expect((await es.count({ index: 'myAlias' })).count).to.be(3);
expect((await es.count({ index: 'wildcardAlias' })).count).to.be(3);
expect((await es.count({ index: 'myAlias' })).body.count).to.be(3);
expect((await es.count({ index: 'wildcardAlias' })).body.count).to.be(3);
// The filtered alias should still return 2 docs
expect((await es.count({ index: 'myHttpsAlias' })).count).to.be(2);
expect((await es.count({ index: 'myHttpsAlias' })).body.count).to.be(2);

// Cleanup newly created index
await es.indices.delete({
Expand Down Expand Up @@ -204,8 +204,8 @@ export default function ({ getService }) {
await assertQueueState(undefined, 0);

// Check that the closed index is still closed after reindexing
const resolvedIndices = await es.transport.request({
path: `_resolve/index/${nameOfIndexThatShouldBeClosed}`,
const { body: resolvedIndices } = await es.indices.resolveIndex({
name: nameOfIndexThatShouldBeClosed,
});

const test1ReindexedState = getIndexState(nameOfIndexThatShouldBeClosed, resolvedIndices);
Expand Down

0 comments on commit b7fb0bb

Please sign in to comment.