Skip to content

Commit bae179e

Browse files
[Upgrade Assistant] Fix getFlatSettings() request (#89616)
1 parent 7b06c13 commit bae179e

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_actions.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ describe('ReindexActions', () => {
297297
} as RequestEvent<T>);
298298

299299
it('returns flat settings', async () => {
300-
clusterClient.asCurrentUser.indices.getSettings.mockResolvedValueOnce(
300+
clusterClient.asCurrentUser.indices.get.mockResolvedValueOnce(
301301
asApiResponse({
302302
myIndex: {
303303
settings: { 'index.mySetting': '1' },
@@ -312,7 +312,7 @@ describe('ReindexActions', () => {
312312
});
313313

314314
it('returns null if index does not exist', async () => {
315-
clusterClient.asCurrentUser.indices.getSettings.mockResolvedValueOnce(asApiResponse({}));
315+
clusterClient.asCurrentUser.indices.get.mockResolvedValueOnce(asApiResponse({}));
316316
await expect(actions.getFlatSettings('myIndex')).resolves.toBeNull();
317317
});
318318
});

x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export const reindexActionsFactory = (
236236
},
237237

238238
async getFlatSettings(indexName: string) {
239-
const { body: flatSettings } = await esClient.indices.getSettings<{
239+
const { body: flatSettings } = await esClient.indices.get<{
240240
[indexName: string]: FlatSettings;
241241
}>({
242242
index: indexName,

x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ describe('reindexService', () => {
832832
});
833833

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

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

849849
it('fails if create index fails', async () => {
850-
clusterClient.asCurrentUser.indices.getSettings.mockResolvedValueOnce(
850+
clusterClient.asCurrentUser.indices.get.mockResolvedValueOnce(
851851
asApiResponse({ myIndex: settingsMappings })
852852
);
853853

x-pack/test/upgrade_assistant_integration/upgrade_assistant/reindexing.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ export default function ({ getService }) {
7171
expect(indexSummary[newIndexName]).to.be.an('object');
7272
// The original index name is aliased to the new one
7373
expect(indexSummary[newIndexName].aliases.dummydata).to.be.an('object');
74+
// Verify mappings exist on new index
75+
expect(indexSummary[newIndexName].mappings.properties).to.be.an('object');
7476
// The number of documents in the new index matches what we expect
7577
expect((await es.count({ index: lastState.newIndexName })).body.count).to.be(3);
7678

0 commit comments

Comments
 (0)