mirror of
https://github.com/vatesfr/xen-orchestra.git
synced 2026-11-09 17:06:13 -06:00
test(web): use the shared list pool in the V2V VM mapping mount
This commit is contained in:
@@ -7,7 +7,7 @@ import { createV2vHost } from '@/test/create-v2v-inventory.ts'
|
||||
import { createV2vNewMappingStepVm } from '@/test/create-v2v-mapping-step-vm.ts'
|
||||
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
|
||||
import { xoCollectionsMock } from '@/test/mock-xo-collections.ts'
|
||||
import { mountV2vVmMappingComponent, V2V_VM_MAPPING_POOL } from '@/test/mount-v2v-vm-mapping.ts'
|
||||
import { mountV2vVmMappingComponent } from '@/test/mount-v2v-vm-mapping.ts'
|
||||
import {
|
||||
V2V_DEFAULT_TEMPLATE,
|
||||
V2V_DISK_ROWS,
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
V2V_TARGET_OPTIONS,
|
||||
createV2vOfferedTarget,
|
||||
} from '@/test/v2v-mapping-fixtures.ts'
|
||||
import { V2V_LIST_POOL } from '@/test/v2v-wizard-fixtures.ts'
|
||||
import { mount } from '@vue/test-utils'
|
||||
|
||||
vi.mock(
|
||||
@@ -92,7 +93,7 @@ it('shows the mapping of the disks and the NICs on the pool of the list, read on
|
||||
const card = wrapper.getComponent(V2vDestinationMappingCard)
|
||||
|
||||
expect(card.props()).toMatchObject({
|
||||
poolName: V2V_VM_MAPPING_POOL.name_label,
|
||||
poolName: V2V_LIST_POOL.name_label,
|
||||
diskRows: V2V_DISK_ROWS,
|
||||
nicRows: V2V_NIC_ROWS,
|
||||
networkOptions: V2V_TARGET_OPTIONS.networks,
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
mountV2vVmMapping,
|
||||
type MountV2vVmMappingOptions,
|
||||
readV2vStoredListVm,
|
||||
V2V_VM_MAPPING_POOL,
|
||||
V2V_OTHER_LIST_VM,
|
||||
} from '@/test/mount-v2v-vm-mapping.ts'
|
||||
import {
|
||||
@@ -32,6 +31,7 @@ import {
|
||||
V2V_VLAN_NIC,
|
||||
createV2vOfferedTarget,
|
||||
} from '@/test/v2v-mapping-fixtures.ts'
|
||||
import { V2V_LIST_POOL } from '@/test/v2v-wizard-fixtures.ts'
|
||||
import type { InfoAccent } from '@core/components/ui/info/UiInfo.vue'
|
||||
import type { XoV2vDatastore, XoV2vHost, XoV2vVm } from '@vates/types'
|
||||
|
||||
@@ -116,7 +116,7 @@ describe('areOffersReady', () => {
|
||||
|
||||
describe('poolName', () => {
|
||||
it('names the pool of the list', () => {
|
||||
expect(mountVmMapping().poolName).toBe(V2V_VM_MAPPING_POOL.name_label)
|
||||
expect(mountVmMapping().poolName).toBe(V2V_LIST_POOL.name_label)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { FrontXoSr } from '@/modules/storage-repository/remote-resources/us
|
||||
import { useV2vMigrationList } from '@/modules/v2v/composables/use-v2v-migration-list.composable.ts'
|
||||
import type { V2vMigrationList, V2vMigrationListVm } from '@/modules/v2v/types/v2v-migration-list.type.ts'
|
||||
import { createNetwork } from '@/test/create-network.ts'
|
||||
import { createPool, OTHER_POOL_ID } from '@/test/create-pool.ts'
|
||||
import { OTHER_POOL_ID } from '@/test/create-pool.ts'
|
||||
import { createSr } from '@/test/create-sr.ts'
|
||||
import { createV2vMigrationList, createV2vMigrationListVm } from '@/test/create-v2v-migration-list.ts'
|
||||
import { createVmTemplate } from '@/test/create-vm-template.ts'
|
||||
@@ -19,12 +19,10 @@ import {
|
||||
V2V_POOL_OFFERS,
|
||||
} from '@/test/v2v-mapping-fixtures.ts'
|
||||
import { readV2vMigrationListStorage, seedV2vMigrationList } from '@/test/v2v-migration-list-storage.ts'
|
||||
import { V2V_LIST_POOL } from '@/test/v2v-wizard-fixtures.ts'
|
||||
import type { XoV2vVm } from '@vates/types'
|
||||
import type { Router } from 'vue-router'
|
||||
|
||||
/** The pool of the stored list, offering the mapping fixtures. */
|
||||
export const V2V_VM_MAPPING_POOL = createPool()
|
||||
|
||||
/** The overrides of the mapped VM in the list: on its data disk and on its VLAN NIC. */
|
||||
export const V2V_LIST_VM_OVERRIDES = { disks: V2V_DISK_OVERRIDES, nics: V2V_NIC_OVERRIDES }
|
||||
|
||||
@@ -47,14 +45,14 @@ export const V2V_OTHER_LIST_VM = createV2vMigrationListVm({
|
||||
|
||||
// Stores the list holding `listVm`, on a pool offering the mapping fixtures (another pool offers one target of each kind)
|
||||
function seedV2vVmMappingList(listVm: V2vMigrationListVm) {
|
||||
xoCollectionsMock.pools.value = [V2V_VM_MAPPING_POOL]
|
||||
xoCollectionsMock.pools.value = [V2V_LIST_POOL]
|
||||
xoCollectionsMock.seedChoices({
|
||||
srs: [...V2V_POOL_OFFERS.srs, createSr({ id: 'sr-other' as FrontXoSr['id'], $pool: OTHER_POOL_ID })],
|
||||
networks: [...V2V_POOL_OFFERS.networks, createNetwork({ $pool: OTHER_POOL_ID })],
|
||||
templates: [...V2V_POOL_OFFERS.templates, createVmTemplate({ $pool: OTHER_POOL_ID })],
|
||||
})
|
||||
|
||||
const list = createV2vMigrationList({ poolId: V2V_VM_MAPPING_POOL.id, vms: [listVm] })
|
||||
const list = createV2vMigrationList({ poolId: V2V_LIST_POOL.id, vms: [listVm] })
|
||||
|
||||
seedV2vMigrationList(list)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user