Skip to content

Commit

Permalink
[Upgrade Assistant] Fix getFlatSettings() request (#89616)
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth authored Feb 1, 2021
1 parent 7b06c13 commit bae179e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ describe('ReindexActions', () => {
} as RequestEvent<T>);

it('returns flat settings', async () => {
clusterClient.asCurrentUser.indices.getSettings.mockResolvedValueOnce(
clusterClient.asCurrentUser.indices.get.mockResolvedValueOnce(
asApiResponse({
myIndex: {
settings: { 'index.mySetting': '1' },
Expand All @@ -312,7 +312,7 @@ describe('ReindexActions', () => {
});

it('returns null if index does not exist', async () => {
clusterClient.asCurrentUser.indices.getSettings.mockResolvedValueOnce(asApiResponse({}));
clusterClient.asCurrentUser.indices.get.mockResolvedValueOnce(asApiResponse({}));
await expect(actions.getFlatSettings('myIndex')).resolves.toBeNull();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export const reindexActionsFactory = (
},

async getFlatSettings(indexName: string) {
const { body: flatSettings } = await esClient.indices.getSettings<{
const { body: flatSettings } = await esClient.indices.get<{
[indexName: string]: FlatSettings;
}>({
index: indexName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ describe('reindexService', () => {
});

it('fails if create index is not acknowledged', async () => {
clusterClient.asCurrentUser.indices.getSettings.mockResolvedValueOnce(
clusterClient.asCurrentUser.indices.get.mockResolvedValueOnce(
asApiResponse({ myIndex: settingsMappings })
);

Expand All @@ -847,7 +847,7 @@ describe('reindexService', () => {
});

it('fails if create index fails', async () => {
clusterClient.asCurrentUser.indices.getSettings.mockResolvedValueOnce(
clusterClient.asCurrentUser.indices.get.mockResolvedValueOnce(
asApiResponse({ myIndex: settingsMappings })
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ export default function ({ getService }) {
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');
// Verify mappings exist on new index
expect(indexSummary[newIndexName].mappings.properties).to.be.an('object');
// The number of documents in the new index matches what we expect
expect((await es.count({ index: lastState.newIndexName })).body.count).to.be(3);

Expand Down

0 comments on commit bae179e

Please sign in to comment.