fix: dont use deprecated event-to-promise
This commit is contained in:
@@ -5,9 +5,9 @@ import expect from 'must'
|
||||
|
||||
// ===================================================================
|
||||
|
||||
import fromEvent from 'promise-toolbox/fromEvent'
|
||||
import { getConfig, getMainConnection, getSrId, waitObjectState } from './util'
|
||||
import { map } from 'lodash'
|
||||
import eventToPromise from 'event-to-promise'
|
||||
|
||||
// ===================================================================
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('disk', () => {
|
||||
const config = await getConfig()
|
||||
serverId = await xo.call('server.add', Object.assign({ autoConnect: false }, config.xenServer1))
|
||||
await xo.call('server.connect', { id: serverId })
|
||||
await eventToPromise(xo.objects, 'finish')
|
||||
await fromEvent(xo.objects, 'finish')
|
||||
srId = await getSrId(xo)
|
||||
})
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Doc: https://github.com/moll/js-must/blob/master/doc/API.md#must
|
||||
|
||||
import expect from 'must'
|
||||
import eventToPromise from 'event-to-promise'
|
||||
import fromEvent from 'promise-toolbox/fromEvent'
|
||||
import { getAllHosts, getConfig, getMainConnection, getVmToMigrateId, waitObjectState } from './util'
|
||||
import { find, forEach } from 'lodash'
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('host', () => {
|
||||
let config
|
||||
;[xo, config] = await Promise.all([getMainConnection(), getConfig()])
|
||||
serverId = await xo.call('server.add', config.xenServer2).catch(() => {})
|
||||
await eventToPromise(xo.objects, 'finish')
|
||||
await fromEvent(xo.objects, 'finish')
|
||||
|
||||
hostId = getHost(config.host1)
|
||||
})
|
||||
|
||||
@@ -5,8 +5,8 @@ import expect from 'must'
|
||||
|
||||
// ===================================================================
|
||||
|
||||
import fromEvent from 'promise-toolbox/fromEvent'
|
||||
import { getConfig, getMainConnection, waitObjectState } from './util'
|
||||
import eventToPromise from 'event-to-promise'
|
||||
import { find } from 'lodash'
|
||||
|
||||
// ===================================================================
|
||||
@@ -21,7 +21,7 @@ describe('pool', () => {
|
||||
jest.setTimeout(10e3)
|
||||
;[xo, config] = await Promise.all([getMainConnection(), getConfig()])
|
||||
serverId = await xo.call('server.add', config.xenServer1).catch(() => {})
|
||||
await eventToPromise(xo.objects, 'finish')
|
||||
await fromEvent(xo.objects, 'finish')
|
||||
poolId = getPoolId()
|
||||
})
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import expect from 'must'
|
||||
|
||||
// ===================================================================
|
||||
|
||||
import fromEvent from 'promise-toolbox/fromEvent'
|
||||
import { getConfig, getMainConnection, getSchedule, jobTest, scheduleTest } from './util'
|
||||
import eventToPromise from 'event-to-promise'
|
||||
import { map } from 'lodash'
|
||||
|
||||
// ===================================================================
|
||||
@@ -23,7 +23,7 @@ describe('schedule', () => {
|
||||
;[xo, config] = await Promise.all([getMainConnection(), getConfig()])
|
||||
|
||||
serverId = await xo.call('server.add', config.xenServer1).catch(() => {})
|
||||
await eventToPromise(xo.objects, 'finish')
|
||||
await fromEvent(xo.objects, 'finish')
|
||||
|
||||
jobId = await jobTest(xo)
|
||||
})
|
||||
|
||||
@@ -5,8 +5,8 @@ import expect from 'must'
|
||||
|
||||
// ===================================================================
|
||||
|
||||
import fromEvent from 'promise-toolbox/fromEvent'
|
||||
import { jobTest, scheduleTest, getConfig, getMainConnection, getSchedule } from './util'
|
||||
import eventToPromise from 'event-to-promise'
|
||||
|
||||
// ===================================================================
|
||||
|
||||
@@ -22,7 +22,7 @@ describe('scheduler', () => {
|
||||
;[xo, config] = await Promise.all([getMainConnection(), getConfig()])
|
||||
|
||||
serverId = await xo.call('server.add', config.xenServer1).catch(() => {})
|
||||
await eventToPromise(xo.objects, 'finish')
|
||||
await fromEvent(xo.objects, 'finish')
|
||||
|
||||
jobId = await jobTest(xo)
|
||||
scheduleId = (await scheduleTest(xo, jobId)).id
|
||||
|
||||
@@ -5,9 +5,9 @@ import expect from 'must'
|
||||
|
||||
// ===================================================================
|
||||
|
||||
import fromEvent from 'promise-toolbox/fromEvent'
|
||||
import { getConfig, getMainConnection, getVmXoTestPvId, getOneHost, waitObjectState } from './util'
|
||||
import { map } from 'lodash'
|
||||
import eventToPromise from 'event-to-promise'
|
||||
|
||||
// ===================================================================
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('vbd', () => {
|
||||
|
||||
serverId = await xo.call('server.add', Object.assign({ autoConnect: false }, config.xenServer1))
|
||||
await xo.call('server.connect', { id: serverId })
|
||||
await eventToPromise(xo.objects, 'finish')
|
||||
await fromEvent(xo.objects, 'finish')
|
||||
|
||||
vmId = await getVmXoTestPvId(xo)
|
||||
try {
|
||||
|
||||
@@ -5,8 +5,8 @@ import expect from 'must'
|
||||
|
||||
// ===================================================================
|
||||
|
||||
import fromEvent from 'promise-toolbox/fromEvent'
|
||||
import { getConfig, getMainConnection, getNetworkId, waitObjectState, getVmXoTestPvId } from './util'
|
||||
import eventToPromise from 'event-to-promise'
|
||||
import { map } from 'lodash'
|
||||
|
||||
// ===================================================================
|
||||
@@ -24,7 +24,7 @@ describe('vif', () => {
|
||||
;[xo, config] = await Promise.all([getMainConnection(), getConfig()])
|
||||
|
||||
serverId = await xo.call('server.add', config.xenServer1).catch(() => {})
|
||||
await eventToPromise(xo.objects, 'finish')
|
||||
await fromEvent(xo.objects, 'finish')
|
||||
|
||||
vmId = await getVmXoTestPvId(xo)
|
||||
try {
|
||||
|
||||
@@ -5,6 +5,7 @@ import expect from 'must'
|
||||
|
||||
// ===================================================================
|
||||
|
||||
import fromEvent from 'promise-toolbox/fromEvent'
|
||||
import {
|
||||
almostEqual,
|
||||
getAllHosts,
|
||||
@@ -18,7 +19,6 @@ import {
|
||||
waitObjectState,
|
||||
} from './util'
|
||||
import { map, find } from 'lodash'
|
||||
import eventToPromise from 'event-to-promise'
|
||||
|
||||
// ===================================================================
|
||||
|
||||
@@ -35,7 +35,7 @@ describe('vm', () => {
|
||||
jest.setTimeout(10e3)
|
||||
;[xo, config] = await Promise.all([getMainConnection(), getConfig()])
|
||||
serverId = await xo.call('server.add', config.xenServer1).catch(() => {})
|
||||
await eventToPromise(xo.objects, 'finish')
|
||||
await fromEvent(xo.objects, 'finish')
|
||||
})
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -347,7 +347,7 @@ describe('vm', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
secondServerId = await xo.call('server.add', config.xenServer2).catch(() => {})
|
||||
await eventToPromise(xo.objects, 'finish')
|
||||
await fromEvent(xo.objects, 'finish')
|
||||
|
||||
vmId = await getVmToMigrateId(xo)
|
||||
|
||||
@@ -393,7 +393,7 @@ describe('vm', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
secondServerId = await xo.call('server.add', config.xenServer2).catch(() => {})
|
||||
await eventToPromise(xo.objects, 'finish')
|
||||
await fromEvent(xo.objects, 'finish')
|
||||
|
||||
vmId = await getVmToMigrateId(xo)
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
"node": ">=6"
|
||||
},
|
||||
"dependencies": {
|
||||
"event-to-promise": "^0.8.0",
|
||||
"node-xmpp-client": "^3.0.0"
|
||||
"node-xmpp-client": "^3.0.0",
|
||||
"promise-toolbox": "^0.19.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.0.0",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import eventToPromise from 'event-to-promise'
|
||||
import fromEvent from 'promise-toolbox/fromEvent'
|
||||
import XmppClient from 'node-xmpp-client'
|
||||
|
||||
// ===================================================================
|
||||
@@ -55,8 +55,8 @@ class TransportXmppPlugin {
|
||||
this._client = new XmppClient(this._conf)
|
||||
this._client.on('error', () => {})
|
||||
|
||||
await eventToPromise(this._client.connection.socket, 'data')
|
||||
await eventToPromise(this._client, 'online')
|
||||
await fromEvent(this._client.connection.socket, 'data')
|
||||
await fromEvent(this._client, 'online')
|
||||
|
||||
this._unset = this._set('sendToXmppClient', this._sendToXmppClient)
|
||||
}
|
||||
|
||||
@@ -35,10 +35,10 @@
|
||||
"@babel/preset-env": "^7.0.0",
|
||||
"babel-plugin-lodash": "^3.3.2",
|
||||
"cross-env": "^7.0.2",
|
||||
"event-to-promise": "^0.8.0",
|
||||
"execa": "^5.0.0",
|
||||
"fs-extra": "^9.0.0",
|
||||
"get-stream": "^6.0.0",
|
||||
"promise-toolbox": "^0.19.2",
|
||||
"rimraf": "^3.0.0",
|
||||
"tmp": "^0.2.1"
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-env jest */
|
||||
|
||||
import execa from 'execa'
|
||||
import eventToPromise from 'event-to-promise'
|
||||
import fromEvent from 'promise-toolbox/fromEvent'
|
||||
import getStream from 'get-stream'
|
||||
import rimraf from 'rimraf'
|
||||
import tmp from 'tmp'
|
||||
@@ -54,7 +54,7 @@ test('VMDK to VHD can convert a random data file with VMDKDirectParser', async (
|
||||
const pipe = (
|
||||
await vmdkToVhd(createReadStream(vmdkFileName), result.grainLogicalAddressList, result.grainFileOffsetList)
|
||||
).pipe(createWriteStream(vhdFileName))
|
||||
await eventToPromise(pipe, 'finish')
|
||||
await fromEvent(pipe, 'finish')
|
||||
await execa('vhd-util', ['check', '-p', '-b', '-t', '-n', vhdFileName])
|
||||
await execa('qemu-img', ['convert', '-fvmdk', '-Oraw', vmdkFileName, reconvertedFromVmdk])
|
||||
await execa('qemu-img', ['convert', '-fvpc', '-Oraw', vhdFileName, reconvertedFromVhd])
|
||||
|
||||
@@ -61,7 +61,6 @@
|
||||
"enzyme": "^3.3.0",
|
||||
"enzyme-adapter-react-15": "^1.0.5",
|
||||
"enzyme-to-json": "^3.3.0",
|
||||
"event-to-promise": "^0.8.0",
|
||||
"font-awesome": "^4.7.0",
|
||||
"font-mfizz": "^2.4.1",
|
||||
"get-stream": "^4.0.0",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import eventToPromise from 'event-to-promise'
|
||||
import forEach from 'lodash/forEach'
|
||||
import fromEvents from 'promise-toolbox/fromEvents'
|
||||
import makeError from 'make-error'
|
||||
import map from 'lodash/map'
|
||||
import { AbortedConnection, ConnectionError, JsonRpcWebSocketClient as Client } from 'jsonrpc-websocket-client'
|
||||
@@ -191,7 +191,7 @@ class XoaUpdater extends EventEmitter {
|
||||
if (c.status === 'open') {
|
||||
return c
|
||||
} else {
|
||||
return eventToPromise.multi(c, ['open'], ['closed', 'error']).then(() => c)
|
||||
return fromEvents(c, ['open'], ['closed', 'error']).then(() => c)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user