mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
Fix c2d restart job with valid fees and order (#1729)
* added logs * adds wait method * adds await till job ends * cleanups * removes logs
This commit is contained in:
parent
fbcd13ac29
commit
0f77f75bc9
@ -226,6 +226,23 @@ function delay(interval: number) {
|
||||
}).timeout(interval + 100)
|
||||
}
|
||||
|
||||
async function waitTillJobEnds(): Promise<number> {
|
||||
return new Promise((resolve) => {
|
||||
const interval = setInterval(async () => {
|
||||
const jobStatus = (await ProviderInstance.computeStatus(
|
||||
providerUrl,
|
||||
consumerAccount,
|
||||
freeComputeJobId,
|
||||
resolvedDdoWith5mTimeout.id
|
||||
)) as ComputeJob
|
||||
if (jobStatus?.status === 70) {
|
||||
clearInterval(interval)
|
||||
resolve(jobStatus.status)
|
||||
}
|
||||
}, 10000)
|
||||
})
|
||||
}
|
||||
|
||||
describe('Simple compute tests', async () => {
|
||||
before(async () => {
|
||||
config = await getTestConfig(web3)
|
||||
@ -394,10 +411,6 @@ describe('Simple compute tests', async () => {
|
||||
providerUrl,
|
||||
consumerAccount
|
||||
)
|
||||
console.log(
|
||||
'compute flow initializeCompute result = ',
|
||||
providerInitializeComputeResults
|
||||
)
|
||||
assert(
|
||||
!('error' in providerInitializeComputeResults.algorithm),
|
||||
'Cannot order algorithm'
|
||||
@ -438,15 +451,7 @@ describe('Simple compute tests', async () => {
|
||||
|
||||
delay(100000)
|
||||
|
||||
it('Check compute status', async () => {
|
||||
const jobStatus = (await ProviderInstance.computeStatus(
|
||||
providerUrl,
|
||||
consumerAccount,
|
||||
freeComputeJobId,
|
||||
resolvedDdoWith5mTimeout.id
|
||||
)) as ComputeJob
|
||||
assert(jobStatus, 'Cannot retrieve compute status!')
|
||||
})
|
||||
const jobFinished = await waitTillJobEnds()
|
||||
|
||||
// move to start orders with initial txid's and provider fees
|
||||
it('should restart a computeJob without paying anything, because order is valid and providerFees are still valid', async () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user