Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeauchamp committed Apr 20, 2022
1 parent f476c22 commit d5e85cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions @xen-orchestra/backups/_cleanVm.integ.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
const rimraf = require('rimraf')
const tmp = require('tmp')
const fs = require('fs-extra')
const uuid = require('uuid')
const { getHandler } = require('@xen-orchestra/fs')
const { pFromCallback } = require('promise-toolbox')
const crypto = require('crypto')
const { RemoteAdapter } = require('./RemoteAdapter')
const { VHDFOOTER, VHDHEADER } = require('./tests.fixtures.js')
const { VhdFile, Constants, VhdDirectory, VhdAbstract } = require('vhd-lib')
Expand All @@ -34,7 +34,7 @@ afterEach(async () => {
await handler.forget()
})

const uniqueId = () => crypto.randomBytes(16).toString('hex')
const uniqueId = () => Buffer.from(uuid.v4())

async function generateVhd(path, opts = {}) {
let vhd
Expand All @@ -54,7 +54,7 @@ async function generateVhd(path, opts = {}) {

vhd.header = { ...VHDHEADER, ...opts.header }
vhd.footer = { ...VHDFOOTER, ...opts.footer }
vhd.footer.uuid = Buffer.from(crypto.randomBytes(16))
vhd.footer.uuid = Buffer.from(uuid.v4())

if (vhd.header.parentUnicodeName) {
vhd.footer.diskType = Constants.DISK_TYPES.DIFFERENCING
Expand Down Expand Up @@ -95,7 +95,7 @@ test('it remove vhd with missing or multiple ancestors', async () => {
await generateVhd(`${basePath}/abandonned.vhd`, {
header: {
parentUnicodeName: 'gone.vhd',
parentUid: Buffer.from(crypto.randomBytes(16)),
parentUid: Buffer.from(uuid.v4()),
},
})

Expand Down Expand Up @@ -308,7 +308,7 @@ describe('tests multiple combination ', () => {
mode: vhdMode,
header: {
parentUnicodeName: 'gone.vhd',
parentUid: crypto.randomBytes(16),
parentUid: Buffer.from(uuid.v4()),
},
})

Expand Down
2 changes: 1 addition & 1 deletion packages/vhd-lib/openVhd.integ.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ test('It opens multiples vhd file as vhd synthetic', async () => {
await Disposable.use(async function* () {
const handler = yield getSyncedHandler({ url: 'file://' })
await chainVhd(handler, vhdFileNameParent, handler, vhdFileNameChild, true)
const vhd = yield openVhd(handler, [vhdFileNameParent, vhdFileNameChild])
const vhd = yield openVhd(handler, [vhdFileNameChild, vhdFileNameParent])
expect(vhd.header.cookie).toEqual('cxsparse')
expect(vhd.footer.cookie).toEqual('conectix')
})
Expand Down

0 comments on commit d5e85cf

Please sign in to comment.