Skip to content

Commit

Permalink
feat: PCI (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
badrAZ authored and julien-f committed Mar 10, 2017
1 parent 84943e7 commit ef98b10
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/vm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -656,18 +656,6 @@ describe('vm', () => {

// ---------------------------------------------------------------------

describe('.attachPci()', () => {
it('')
})

// ---------------------------------------------------------------------

describe('.detachPci()', () => {
it('')
})

// ---------------------------------------------------------------------

describe('.stats()', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 20e3
beforeAll(async () => {
Expand Down
59 changes: 59 additions & 0 deletions src/vm/pci.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/* eslint-env jest */

import {
config,
waitObjectState,
xo
} from './../util'

// ===================================================================

beforeAll(async () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 30e3
})

describe('pci', () => {
let vmId

// ----------------------------------------------------------------------

beforeAll(async () => {
vmId = await xo.call('vm.create', {
name_label: 'vmTest',
template: config.templatesId.debianCloud,
VIFs: [{network: config.labPoolNetworkId}],
VDIs: [{
device: '0',
size: 1,
SR: config.labPoolSrId,
type: 'user'
}]
})
await waitObjectState(xo, vmId, vm => {
if (vm.type !== 'VM') throw new Error('retry')
})
})

afterAll(() => xo.call('vm.delete', {id: vmId, delete_disks: true}))

// =================================================================

it('attaches the pci to the VM', async () => {
await xo.call('vm.attachPci', {
vm: vmId,
pciId: config.pciId
})

await waitObjectState(xo, vmId, vm => {
expect(vm.other.pci).toBe(config.pciId)
})
})

it('detaches the pci from the VM', async () => {
await xo.call('vm.detachPci', {vm: vmId})

await waitObjectState(xo, vmId, vm => {
expect(vm.other.pci).toBeUndefined()
})
})
})

0 comments on commit ef98b10

Please sign in to comment.