Skip to content
Snippets Groups Projects
Commit 290f9fe5 authored by Olena Horal-Koretska's avatar Olena Horal-Koretska
Browse files

Merge branch...

Merge branch '358153-gitlab-migration-migrations-with-status-timeout-3-are-not-updated-in-the-ui' into 'master'

Resolve "GitLab Migration - migrations with status timeout (3) are not updated in the UI"

See merge request !86539
parents 7b89393b 87ac532f
No related branches found
No related tags found
1 merge request!86539Resolve "GitLab Migration - migrations with status timeout (3) are not updated in the UI"
Pipeline #531920989 passed
......@@ -44,6 +44,11 @@ const STATUS_MAP = {
text: __('Failed'),
variant: 'danger',
},
[STATUSES.TIMEOUT]: {
icon: 'status-failed',
text: __('Timeout'),
variant: 'danger',
},
[STATUSES.CANCELLED]: {
icon: 'status-stopped',
text: __('Cancelled'),
......
......@@ -10,4 +10,5 @@ export const STATUSES = {
NONE: 'none',
SCHEDULING: 'scheduling',
CANCELLED: 'cancelled',
TIMEOUT: 'timeout',
};
......@@ -10,7 +10,7 @@ export function getInvalidNameValidationMessage(importTarget) {
}
export function isFinished(group) {
return [STATUSES.FINISHED, STATUSES.FAILED].includes(group.progress?.status);
return [STATUSES.FINISHED, STATUSES.FAILED, STATUSES.TIMEOUT].includes(group.progress?.status);
}
export function isAvailableForImport(group) {
......
import { STATUSES } from '~/import_entities/constants';
import { isFinished, isAvailableForImport } from '~/import_entities/import_groups/utils';
const FINISHED_STATUSES = [STATUSES.FINISHED, STATUSES.FAILED, STATUSES.TIMEOUT];
const OTHER_STATUSES = Object.values(STATUSES).filter(
(status) => !FINISHED_STATUSES.includes(status),
);
describe('gitlab migration status utils', () => {
describe('isFinished', () => {
it.each(FINISHED_STATUSES.map((s) => [s]))(
'reports group as finished when import status is %s',
(status) => {
expect(isFinished({ progress: { status } })).toBe(true);
},
);
it.each(OTHER_STATUSES.map((s) => [s]))(
'does not report group as finished when import status is %s',
(status) => {
expect(isFinished({ progress: { status } })).toBe(false);
},
);
it('does not report group as finished when there is no progress', () => {
expect(isFinished({ progress: null })).toBe(false);
});
it('does not report group as finished when status is unknown', () => {
expect(isFinished({ progress: { status: 'weird' } })).toBe(false);
});
});
describe('isAvailableForImport', () => {
it.each(FINISHED_STATUSES.map((s) => [s]))(
'reports group as available for import when status is %s',
(status) => {
expect(isAvailableForImport({ progress: { status } })).toBe(true);
},
);
it.each(OTHER_STATUSES.map((s) => [s]))(
'does not report group as not available for import when status is %s',
(status) => {
expect(isAvailableForImport({ progress: { status } })).toBe(false);
},
);
it('reports group as available for import when there is no progress', () => {
expect(isAvailableForImport({ progress: null })).toBe(true);
});
it('reports group as finished when status is unknown', () => {
expect(isFinished({ progress: { status: 'weird' } })).toBe(false);
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment