Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Upgrade Assistant] Rename upgrade_status to migration_status #114755

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Overview - Migrate system indices', () => {
component.update();

httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({
upgrade_status: 'NO_UPGRADE_NEEDED',
migration_status: 'NO_MIGRATION_NEEDED',
});

await actions.clickRetrySystemIndicesButton();
Expand All @@ -56,7 +56,7 @@ describe('Overview - Migrate system indices', () => {

test('No migration needed', async () => {
httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({
upgrade_status: 'NO_UPGRADE_NEEDED',
migration_status: 'NO_MIGRATION_NEEDED',
});

testBed = await setupOverviewPage();
Expand All @@ -72,7 +72,7 @@ describe('Overview - Migrate system indices', () => {

test('Migration in progress', async () => {
httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({
upgrade_status: 'IN_PROGRESS',
migration_status: 'IN_PROGRESS',
});

testBed = await setupOverviewPage();
Expand All @@ -91,7 +91,7 @@ describe('Overview - Migrate system indices', () => {
describe('Migration needed', () => {
test('Initial state', async () => {
httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({
upgrade_status: 'UPGRADE_NEEDED',
migration_status: 'MIGRATION_NEEDED',
});

testBed = await setupOverviewPage();
Expand All @@ -109,7 +109,7 @@ describe('Overview - Migrate system indices', () => {

test('Handles errors when migrating', async () => {
httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({
upgrade_status: 'UPGRADE_NEEDED',
migration_status: 'MIGRATION_NEEDED',
});
httpRequestsMockHelpers.setSystemIndicesMigrationResponse(undefined, {
statusCode: 400,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import { SystemIndicesMigrationStatus } from '../../../../common/types';

export const systemIndicesMigrationStatus: SystemIndicesMigrationStatus = {
upgrade_status: 'UPGRADE_NEEDED',
migration_status: 'MIGRATION_NEEDED',
features: [
{
feature_name: 'security',
minimum_index_version: '7.1.1',
upgrade_status: 'ERROR',
migration_status: 'ERROR',
indices: [
{
index: '.security-7',
Expand All @@ -24,7 +24,7 @@ export const systemIndicesMigrationStatus: SystemIndicesMigrationStatus = {
{
feature_name: 'machine_learning',
minimum_index_version: '7.1.2',
upgrade_status: 'IN_PROGRESS',
migration_status: 'IN_PROGRESS',
indices: [
{
index: '.ml-config',
Expand All @@ -35,7 +35,7 @@ export const systemIndicesMigrationStatus: SystemIndicesMigrationStatus = {
{
feature_name: 'kibana',
minimum_index_version: '7.1.3',
upgrade_status: 'UPGRADE_NEEDED',
migration_status: 'MIGRATION_NEEDED',
indices: [
{
index: '.kibana',
Expand All @@ -46,7 +46,7 @@ export const systemIndicesMigrationStatus: SystemIndicesMigrationStatus = {
{
feature_name: 'logstash',
minimum_index_version: '7.1.4',
upgrade_status: 'NO_UPGRADE_NEEDED',
migration_status: 'NO_MIGRATION_NEEDED',
indices: [
{
index: '.logstash-config',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Overview - Migrate system indices - Step completion', () => {

test(`It's complete when no upgrade is needed`, async () => {
httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({
upgrade_status: 'NO_UPGRADE_NEEDED',
migration_status: 'NO_MIGRATION_NEEDED',
});

await act(async () => {
Expand All @@ -37,7 +37,7 @@ describe('Overview - Migrate system indices - Step completion', () => {

test(`It's incomplete when migration is needed`, async () => {
httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({
upgrade_status: 'UPGRADE_NEEDED',
migration_status: 'MIGRATION_NEEDED',
});

await act(async () => {
Expand All @@ -57,7 +57,7 @@ describe('Overview - Migrate system indices - Step completion', () => {

// First request should make the step be incomplete
httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({
upgrade_status: 'IN_PROGRESS',
migration_status: 'IN_PROGRESS',
});

testBed = await setupOverviewPage();
Expand All @@ -73,7 +73,7 @@ describe('Overview - Migrate system indices - Step completion', () => {
expect(exists('migrateSystemIndicesStep-incomplete')).toBe(true);

httpRequestsMockHelpers.setLoadSystemIndicesMigrationStatus({
upgrade_status: 'NO_UPGRADE_NEEDED',
migration_status: 'NO_MIGRATION_NEEDED',
});

// Resolve the polling timeout.
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/upgrade_assistant/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,20 @@ export interface DeprecationLoggingStatus {
isDeprecationLoggingEnabled: boolean;
}

export type UPGRADE_STATUS = 'UPGRADE_NEEDED' | 'NO_UPGRADE_NEEDED' | 'IN_PROGRESS' | 'ERROR';
export type MIGRATION_STATUS = 'MIGRATION_NEEDED' | 'NO_MIGRATION_NEEDED' | 'IN_PROGRESS' | 'ERROR';
export interface SystemIndicesMigrationFeature {
id?: string;
feature_name: string;
minimum_index_version: string;
upgrade_status: UPGRADE_STATUS;
migration_status: MIGRATION_STATUS;
indices: Array<{
index: string;
version: string;
}>;
}
export interface SystemIndicesMigrationStatus {
features: SystemIndicesMigrationFeature[];
upgrade_status: UPGRADE_STATUS;
migration_status: MIGRATION_STATUS;
}
export interface SystemIndicesMigrationStarted {
features: SystemIndicesMigrationFeature[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
import {
SystemIndicesMigrationStatus,
SystemIndicesMigrationFeature,
UPGRADE_STATUS,
MIGRATION_STATUS,
} from '../../../../../common/types';

export interface SystemIndicesFlyoutProps {
Expand Down Expand Up @@ -84,8 +84,8 @@ const i18nTexts = {
),
};

const renderMigrationStatus = (status: UPGRADE_STATUS) => {
if (status === 'NO_UPGRADE_NEEDED') {
const renderMigrationStatus = (status: MIGRATION_STATUS) => {
if (status === 'NO_MIGRATION_NEEDED') {
return (
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem grow={false}>
Expand All @@ -100,7 +100,7 @@ const renderMigrationStatus = (status: UPGRADE_STATUS) => {
);
}

if (status === 'UPGRADE_NEEDED') {
if (status === 'MIGRATION_NEEDED') {
return (
<EuiText size="s" data-test-subj="featureUpgradeNeeded">
<p>{i18nTexts.needsMigrationLabel}</p>
Expand Down Expand Up @@ -150,7 +150,7 @@ const columns = [
render: (name: string) => startCase(name),
},
{
field: 'upgrade_status',
field: 'migration_status',
name: i18nTexts.statusTableColumn,
sortable: true,
render: renderMigrationStatus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ const MigrateSystemIndicesStep: FunctionComponent<Props> = ({ setIsComplete }) =
useMigrateSystemIndices();

useEffect(() => {
setIsComplete(migrationStatus.data?.upgrade_status === 'NO_UPGRADE_NEEDED');
setIsComplete(migrationStatus.data?.migration_status === 'NO_MIGRATION_NEEDED');
// Depending upon setIsComplete would create an infinite loop.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [migrationStatus.data?.upgrade_status]);
}, [migrationStatus.data?.migration_status]);

if (migrationStatus.error) {
return (
Expand All @@ -111,7 +111,7 @@ const MigrateSystemIndicesStep: FunctionComponent<Props> = ({ setIsComplete }) =
);
}

if (migrationStatus.data?.upgrade_status === 'NO_UPGRADE_NEEDED') {
if (migrationStatus.data?.migration_status === 'NO_MIGRATION_NEEDED') {
return (
<EuiFlexGroup alignItems="center" gutterSize="s" data-test-subj="noMigrationNeededSection">
<EuiFlexItem grow={false}>
Expand All @@ -127,7 +127,7 @@ const MigrateSystemIndicesStep: FunctionComponent<Props> = ({ setIsComplete }) =
}

const isButtonDisabled = migrationStatus.isInitialRequest && migrationStatus.isLoading;
const isMigrating = migrationStatus.data?.upgrade_status === 'IN_PROGRESS';
const isMigrating = migrationStatus.data?.migration_status === 'IN_PROGRESS';

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const useMigrateSystemIndices = () => {

const { data, error, isLoading, resendRequest, isInitialRequest } =
api.useLoadSystemIndicesMigrationStatus();
const isInProgress = data?.upgrade_status === 'IN_PROGRESS';
const isInProgress = data?.migration_status === 'IN_PROGRESS';

// We only want to poll for the status while the migration process is in progress.
useInterval(resendRequest, isInProgress ? SYSTEM_INDICES_MIGRATION_POLL_INTERVAL_MS : null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('getESUpgradeStatus', () => {
{
feature_name: 'machine_learning',
minimum_index_version: '7.1.1',
upgrade_status: 'UPGRADE_NEEDED',
migration_status: 'MIGRATION_NEEDED',
indices: [
{
index: '.ml-config',
Expand All @@ -55,7 +55,7 @@ describe('getESUpgradeStatus', () => {
],
},
],
upgrade_status: 'UPGRADE_NEEDED',
migration_status: 'MIGRATION_NEEDED',
})
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const esUpgradeSystemIndicesStatusMock: SystemIndicesMigrationStatus = {
{
feature_name: 'machine_learning',
minimum_index_version: '7.1.1',
upgrade_status: 'UPGRADE_NEEDED',
migration_status: 'MIGRATION_NEEDED',
indices: [
{
index: '.ml-config',
Expand All @@ -28,7 +28,7 @@ const esUpgradeSystemIndicesStatusMock: SystemIndicesMigrationStatus = {
{
feature_name: 'security',
minimum_index_version: '7.1.1',
upgrade_status: 'UPGRADE_NEEDED',
migration_status: 'MIGRATION_NEEDED',
indices: [
{
index: '.ml-config',
Expand All @@ -37,7 +37,7 @@ const esUpgradeSystemIndicesStatusMock: SystemIndicesMigrationStatus = {
],
},
],
upgrade_status: 'UPGRADE_NEEDED',
migration_status: 'MIGRATION_NEEDED',
};

describe('convertFeaturesToIndicesArray', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const mockedResponse = {
{
feature_name: 'security',
minimum_index_version: '7.1.1',
upgrade_status: 'NO_UPGRADE_NEEDED',
migration_status: 'NO_MIGRATION_NEEDED',
indices: [
{
index: '.security-7',
Expand All @@ -30,7 +30,7 @@ const mockedResponse = {
],
},
],
upgrade_status: 'UPGRADE_NEEDED',
migration_status: 'MIGRATION_NEEDED',
};

/**
Expand Down