Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #949 from mturley/942-only-filter-RHV-storages
Browse files Browse the repository at this point in the history
[BZ#1701330] Only apply storage_domain_type filter on RHV datastores, not OSP.
  • Loading branch information
mzazrivec committed May 14, 2019
2 parents fb26f22 + 142f542 commit 0d69d30
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
FETCH_V2V_TARGET_DATASTORES,
QUERY_ATTRIBUTES
} from './MappingWizardDatastoresStepConstants';
import { V2V_TARGET_PROVIDER_STORAGE_KEYS } from '../../MappingWizardConstants';
import { V2V_TARGET_PROVIDER_STORAGE_KEYS, RHV } from '../../MappingWizardConstants';

const _filterSourceDatastores = response => {
const { data } = response;
Expand Down Expand Up @@ -52,7 +52,7 @@ const _filterTargetDatastores = (response, targetProvider) => {

if (data[V2V_TARGET_PROVIDER_STORAGE_KEYS[targetProvider]]) {
const targetDatastores = data[V2V_TARGET_PROVIDER_STORAGE_KEYS[targetProvider]]
.filter(storage => storage.storage_domain_type === 'data')
.filter(storage => (targetProvider === RHV ? storage.storage_domain_type === 'data' : true))
.map(storage => ({
...storage,
providerName: data.ext_management_system.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('fetchTargetDatastoresAction', () => {
const targetProvider = V2V_TARGET_PROVIDERS[1].id;
const [targetCloudTenant] = cloudTenants.resources;

test('dispatches PENDING and FULFILLED actions, adds provider name and filters to domain_type of data', () => {
test('dispatches PENDING and FULFILLED actions, adds provider name and does not filter by domain_type', () => {
mockRequest({
method: 'GET',
url: '/api',
Expand All @@ -30,12 +30,10 @@ describe('fetchTargetDatastoresAction', () => {
ext_management_system: { name: 'some provider' },
[V2V_TARGET_PROVIDER_STORAGE_KEYS[targetProvider]]: [
{
mock: 'datastore',
storage_domain_type: 'data'
mock: 'datastore'
},
{
mock: 'datastore that should NOT be in the snapshot',
storage_domain_type: 'export'
mock: 'datastore2'
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Array [
]
`;
exports[`fetchTargetDatastoresAction if the target provider is OSP dispatches PENDING and FULFILLED actions, adds provider name and filters to domain_type of data 1`] = `
exports[`fetchTargetDatastoresAction if the target provider is OSP dispatches PENDING and FULFILLED actions, adds provider name and does not filter by domain_type 1`] = `
Array [
Object {
"type": "FETCH_V2V_TARGET_DATASTORES_PENDING",
Expand All @@ -24,7 +24,10 @@ Array [
Object {
"mock": "datastore",
"providerName": "some provider",
"storage_domain_type": "data",
},
Object {
"mock": "datastore2",
"providerName": "some provider",
},
],
},
Expand Down

0 comments on commit 0d69d30

Please sign in to comment.