Skip to content

Commit

Permalink
Update test, as any of the two migrators can fail
Browse files Browse the repository at this point in the history
  • Loading branch information
gsoldevila committed Sep 23, 2024
1 parent 592762f commit 700e66f
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
getKibanaMigratorTestKit,
nextMinor,
defaultKibanaIndex,
defaultKibanaTaskIndex,
} from '../kibana_migrator_test_kit';
import '../jest_matchers';
import { delay, parseLogFile } from '../test_utils';
Expand Down Expand Up @@ -51,9 +52,16 @@ describe('when rolling back to an older version', () => {
const { runMigrations: rollback } = await getKibanaMigratorTestKit({ types, logFilePath });

await clearLog(logFilePath);
await expect(rollback()).rejects.toThrowError(
`Unable to complete saved object migrations for the [${defaultKibanaIndex}] index: The ${defaultKibanaIndex}_${nextMinor} alias refers to a newer version of Kibana: v${nextMinor}`
);

try {
await rollback();
throw new Error('Rollback should have thrown but it did not');
} catch (error) {
expect([
`Unable to complete saved object migrations for the [${defaultKibanaIndex}] index: The ${defaultKibanaIndex}_${nextMinor} alias refers to a newer version of Kibana: v${nextMinor}`,
`Unable to complete saved object migrations for the [${defaultKibanaTaskIndex}] index: The ${defaultKibanaTaskIndex}_${nextMinor} alias refers to a newer version of Kibana: v${nextMinor}`,
]).toContain(error.message);
}

const logs = await parseLogFile(logFilePath);
expect(logs).toContainLogEntry(`[${defaultKibanaIndex}] INIT -> FATAL.`);
Expand Down

0 comments on commit 700e66f

Please sign in to comment.