fix(vhd-lib/test): collision during tests (#7062)
multiple tests use the same temporary files
This commit is contained in:
committed by
GitHub
parent
2e1abad255
commit
2ba81d55f8
@@ -32,6 +32,7 @@
|
||||
<!--packages-start-->
|
||||
|
||||
- @xen-orchestra/xapi minor
|
||||
- vhd-lib patch
|
||||
- xo-server-backup-reports patch
|
||||
- xo-server patch
|
||||
- xo-web patch
|
||||
|
||||
@@ -25,8 +25,16 @@ async function checkFile(vhdName) {
|
||||
// Since the qemu-img check command isn't compatible with vhd format, we use
|
||||
// the convert command to do a check by conversion. Indeed, the conversion will
|
||||
// fail if the source file isn't a proper vhd format.
|
||||
await execa('qemu-img', ['convert', '-fvpc', '-Oqcow2', vhdName, 'outputFile.qcow2'])
|
||||
await fsPromise.unlink('./outputFile.qcow2')
|
||||
const target = vhdName + '.qcow2'
|
||||
try {
|
||||
await execa('qemu-img', ['convert', '-fvpc', '-Oqcow2', vhdName, target])
|
||||
} finally {
|
||||
try {
|
||||
await fsPromise.unlink(target)
|
||||
} catch (err) {
|
||||
console.warn(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.checkFile = checkFile
|
||||
|
||||
|
||||
Reference in New Issue
Block a user