use unlink and move test file
This commit is contained in:
committed by
florent Beauchamp
parent
b132ff4fd0
commit
724195d66d
@@ -8,7 +8,7 @@ const tmp = require('tmp')
|
||||
const { getSyncedHandler } = require('@xen-orchestra/fs')
|
||||
const { pFromCallback } = require('promise-toolbox')
|
||||
|
||||
const { checkFile, createRandomFile, convertFromRawToVhd } = require('./tests/utils')
|
||||
const { checkFile, createRandomFile, convertFromRawToVhd } = require('./utils')
|
||||
|
||||
let tempDir = null
|
||||
let disposeHandler
|
||||
@@ -5,6 +5,7 @@ const { pipeline } = require('readable-stream')
|
||||
const asyncIteratorToStream = require('async-iterator-to-stream')
|
||||
const execa = require('execa')
|
||||
const fs = require('fs-extra')
|
||||
const fsPromise = require('node:fs/promises')
|
||||
const { randomBytes } = require('crypto')
|
||||
|
||||
const createRandomStream = asyncIteratorToStream(function* (size) {
|
||||
@@ -25,7 +26,7 @@ async function checkFile(vhdName) {
|
||||
// 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 fs.rm('outputFile.qcow2')
|
||||
await fsPromise.unlink('./outputFile.qcow2')
|
||||
}
|
||||
exports.checkFile = checkFile
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import execa from 'execa'
|
||||
import fs from 'fs-extra'
|
||||
import fs from 'node:fs/promises'
|
||||
|
||||
export function suppressUnhandledRejection(p) {
|
||||
p.catch(Function.prototype)
|
||||
@@ -11,5 +11,5 @@ export async function checkFile(vhdName) {
|
||||
// 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 fs.rm('outputFile.qcow2')
|
||||
await fs.unlink('./outputFile.qcow2')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user