This repository has been archived by the owner on Jul 21, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #828 from mturley/vm-power-warning-tests
Add tests for OSP VM power warnings in the Plan wizard (cherry picked from commit 1a1889b) https://bugzilla.redhat.com/show_bug.cgi?id=1657285
- Loading branch information
1 parent
082b195
commit 0da8173
Showing
5 changed files
with
196 additions
and
1 deletion.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...reens/PlanWizard/components/PlanWizardResultsStep/__tests__/PlanWizardResultsStep.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import PlanWizardResultsStep from '../PlanWizardResultsStep'; | ||
|
||
describe('Plan wizard results step', () => { | ||
const getBaseProps = () => ({ | ||
postPlansUrl: '/api/foo', | ||
editPlansUrl: '/api/bar', | ||
postMigrationPlansAction: jest.fn(), | ||
editMigrationPlansAction: jest.fn(), | ||
plansBody: { mock: 'data' }, | ||
planSchedule: 'migration_plan_later', | ||
isPostingPlans: false, | ||
isRejectedPostingPlans: false, | ||
errorPostingPlans: null, | ||
isPuttingPlans: false, | ||
isRejectedPuttingPlans: false, | ||
errorPuttingPlans: null, | ||
migrationPlansResult: { mock: 'data' }, | ||
migrationRequestsResult: { mock: 'data' }, | ||
hidePlanWizardAction: jest.fn(), | ||
editingPlan: null, | ||
targetProvider: 'openstack' | ||
}); | ||
|
||
it('renders with a warning if migrating an OSP plan later', () => { | ||
const component = shallow(<PlanWizardResultsStep {...getBaseProps()} />); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders with no warning if migrating an OSP plan immediately', () => { | ||
const component = shallow(<PlanWizardResultsStep {...getBaseProps()} planSchedule="migration_plan_now" />); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
64 changes: 64 additions & 0 deletions
64
...mponents/PlanWizardResultsStep/__tests__/__snapshots__/PlanWizardResultsStep.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Plan wizard results step renders with a warning if migrating an OSP plan later 1`] = ` | ||
<div | ||
className="wizard-pf-complete blank-slate-pf" | ||
> | ||
<div | ||
className="plan-wizard-results-step-icon" | ||
> | ||
<span | ||
className="pficon pficon-ok" | ||
/> | ||
</div> | ||
<h3 | ||
className="blank-slate-pf-main-action" | ||
id="migration-plan-results-message" | ||
> | ||
Migration Plan: '%s' has been saved | ||
</h3> | ||
<p | ||
className="blank-slate-pf-secondary-action" | ||
> | ||
Select Migrate on the Migration Plans page to begin migration | ||
</p> | ||
<div | ||
className="plan-wizard-vm-power-warning" | ||
> | ||
<Icon | ||
name="warning-triangle-o" | ||
type="pf" | ||
/> | ||
<p> | ||
VMs must be powered on in order to migrate. | ||
<br /> | ||
Ensure that all VMs in the Migration Plan are powered on before starting migration. | ||
</p> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`Plan wizard results step renders with no warning if migrating an OSP plan immediately 1`] = ` | ||
<div | ||
className="wizard-pf-complete blank-slate-pf" | ||
> | ||
<div | ||
className="plan-wizard-results-step-icon" | ||
> | ||
<span | ||
className="fa fa-clock-o" | ||
/> | ||
</div> | ||
<h3 | ||
className="blank-slate-pf-main-action" | ||
id="migration-plan-results-message" | ||
> | ||
Migration Plan: '%s' is in progress | ||
</h3> | ||
<p | ||
className="blank-slate-pf-secondary-action" | ||
> | ||
This may take a long time. Progress of the plan will be shown in the Migration area | ||
</p> | ||
</div> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...ens/PlanWizard/components/PlanWizardScheduleStep/__tests__/PlanWizardScheduleStep.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { PlanWizardScheduleStep } from '../PlanWizardScheduleStep'; | ||
|
||
describe('Plan wizard schedule step', () => { | ||
it('renders with a warning if migrating an OSP plan immediately', () => { | ||
const component = shallow( | ||
<PlanWizardScheduleStep targetProvider="openstack" migration_plan_choice_radio="migration_plan_now" /> | ||
); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders with no warning if migrating an OSP plan later', () => { | ||
const component = shallow( | ||
<PlanWizardScheduleStep targetProvider="openstack" migration_plan_choice_radio="migration_plan_later" /> | ||
); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
77 changes: 77 additions & 0 deletions
77
...onents/PlanWizardScheduleStep/__tests__/__snapshots__/PlanWizardScheduleStep.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Plan wizard schedule step renders with a warning if migrating an OSP plan immediately 1`] = ` | ||
<Form | ||
bsClass="form" | ||
className="form-horizontal" | ||
componentClass="form" | ||
horizontal={false} | ||
inline={false} | ||
> | ||
<Field | ||
component={[Function]} | ||
help={ | ||
<div | ||
className="plan-wizard-vm-power-warning" | ||
> | ||
<Icon | ||
name="warning-triangle-o" | ||
type="pf" | ||
/> | ||
<p> | ||
VMs must be powered on in order to migrate. | ||
<br /> | ||
Ensure that all VMs in the Migration Plan are powered on before selecting Create. | ||
</p> | ||
</div> | ||
} | ||
label="Run migration plan" | ||
labelWidth="3" | ||
name="migration_plan_choice_radio" | ||
options={ | ||
Array [ | ||
Object { | ||
"id": "migration_plan_later", | ||
"name": "Save migration plan to run later", | ||
}, | ||
Object { | ||
"id": "migration_plan_now", | ||
"name": "Start migration immediately", | ||
}, | ||
] | ||
} | ||
type="radio" | ||
/> | ||
</Form> | ||
`; | ||
|
||
exports[`Plan wizard schedule step renders with no warning if migrating an OSP plan later 1`] = ` | ||
<Form | ||
bsClass="form" | ||
className="form-horizontal" | ||
componentClass="form" | ||
horizontal={false} | ||
inline={false} | ||
> | ||
<Field | ||
component={[Function]} | ||
help={null} | ||
label="Run migration plan" | ||
labelWidth="3" | ||
name="migration_plan_choice_radio" | ||
options={ | ||
Array [ | ||
Object { | ||
"id": "migration_plan_later", | ||
"name": "Save migration plan to run later", | ||
}, | ||
Object { | ||
"id": "migration_plan_now", | ||
"name": "Start migration immediately", | ||
}, | ||
] | ||
} | ||
type="radio" | ||
/> | ||
</Form> | ||
`; |