mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
updated timeouts
This commit is contained in:
parent
f862f32b3b
commit
f99629dfc5
@ -505,6 +505,94 @@ describe('Simple compute tests', async () => {
|
|||||||
freeComputeJobId = computeJobs[0].jobId
|
freeComputeJobId = computeJobs[0].jobId
|
||||||
})
|
})
|
||||||
|
|
||||||
|
delay(60000)
|
||||||
|
|
||||||
|
it('Check compute status', async () => {
|
||||||
|
const jobStatus = (await ProviderInstance.computeStatus(
|
||||||
|
providerUrl,
|
||||||
|
consumerAccount,
|
||||||
|
freeComputeJobId,
|
||||||
|
resolvedDdoWith1mTimeout.id
|
||||||
|
)) as ComputeJob
|
||||||
|
console.log('jobStatus', jobStatus)
|
||||||
|
assert(jobStatus, 'Cannot retrieve compute status!')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Get download compute results url', async () => {
|
||||||
|
await sleep(10000)
|
||||||
|
const downloadURL = await ProviderInstance.getComputeResultUrl(
|
||||||
|
providerUrl,
|
||||||
|
web3,
|
||||||
|
consumerAccount,
|
||||||
|
freeComputeJobId,
|
||||||
|
0
|
||||||
|
)
|
||||||
|
assert(downloadURL, 'Provider getComputeResultUrl failed!')
|
||||||
|
})
|
||||||
|
|
||||||
|
// 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 () => {
|
||||||
|
// we choose the free env
|
||||||
|
const computeEnv = computeEnvs.find((ce) => ce.priceMin === 0)
|
||||||
|
assert(computeEnv, 'Cannot find the free compute env')
|
||||||
|
|
||||||
|
const assets: ComputeAsset[] = [
|
||||||
|
{
|
||||||
|
documentId: resolvedDdoWith1mTimeout.id,
|
||||||
|
serviceId: resolvedDdoWith1mTimeout.services[0].id,
|
||||||
|
transferTxId: freeEnvDatasetTxId
|
||||||
|
}
|
||||||
|
]
|
||||||
|
const algo: ComputeAlgorithm = {
|
||||||
|
documentId: resolvedAlgoDdoWith1mTimeout.id,
|
||||||
|
serviceId: resolvedAlgoDdoWith1mTimeout.services[0].id,
|
||||||
|
transferTxId: freeEnvAlgoTxId
|
||||||
|
}
|
||||||
|
|
||||||
|
providerInitializeComputeResults = await ProviderInstance.initializeCompute(
|
||||||
|
assets,
|
||||||
|
algo,
|
||||||
|
computeEnv.id,
|
||||||
|
computeValidUntil,
|
||||||
|
providerUrl,
|
||||||
|
consumerAccount
|
||||||
|
)
|
||||||
|
console.log('providerInitializeComputeResults', providerInitializeComputeResults)
|
||||||
|
assert(
|
||||||
|
providerInitializeComputeResults.algorithm.validOrder,
|
||||||
|
'We should have a valid order for algorithm'
|
||||||
|
)
|
||||||
|
assert(
|
||||||
|
!providerInitializeComputeResults.algorithm.providerFee,
|
||||||
|
'We should not pay providerFees again for algorithm'
|
||||||
|
)
|
||||||
|
assert(
|
||||||
|
providerInitializeComputeResults.datasets[0].validOrder,
|
||||||
|
'We should have a valid order for dataset'
|
||||||
|
)
|
||||||
|
assert(
|
||||||
|
!providerInitializeComputeResults.datasets[0].providerFee,
|
||||||
|
'We should not pay providerFees again for dataset'
|
||||||
|
)
|
||||||
|
algo.transferTxId = providerInitializeComputeResults.algorithm.validOrder
|
||||||
|
assets[0].transferTxId = providerInitializeComputeResults.datasets[0].validOrder
|
||||||
|
assert(
|
||||||
|
algo.transferTxId === freeEnvAlgoTxId &&
|
||||||
|
assets[0].transferTxId === freeEnvDatasetTxId,
|
||||||
|
'We should use the same orders, because no fess must be paid'
|
||||||
|
)
|
||||||
|
const computeJobs = await ProviderInstance.computeStart(
|
||||||
|
providerUrl,
|
||||||
|
web3,
|
||||||
|
consumerAccount,
|
||||||
|
computeEnv.id,
|
||||||
|
assets[0],
|
||||||
|
algo
|
||||||
|
)
|
||||||
|
assert(computeJobs, 'Cannot start compute job')
|
||||||
|
})
|
||||||
|
|
||||||
// moving to paid environments
|
// moving to paid environments
|
||||||
|
|
||||||
it('should start a computeJob on a paid environment', async () => {
|
it('should start a computeJob on a paid environment', async () => {
|
||||||
@ -566,94 +654,7 @@ describe('Simple compute tests', async () => {
|
|||||||
assert(computeJobs, 'Cannot start compute job')
|
assert(computeJobs, 'Cannot start compute job')
|
||||||
})
|
})
|
||||||
|
|
||||||
delay(120000)
|
delay(60000)
|
||||||
// move to check status and get download url
|
|
||||||
|
|
||||||
it('Check compute status', async () => {
|
|
||||||
const jobStatus = (await ProviderInstance.computeStatus(
|
|
||||||
providerUrl,
|
|
||||||
consumerAccount,
|
|
||||||
freeComputeJobId,
|
|
||||||
resolvedDdoWith1mTimeout.id
|
|
||||||
)) as ComputeJob
|
|
||||||
console.log('jobStatus', jobStatus)
|
|
||||||
assert(jobStatus, 'Cannot retrieve compute status!')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('Get download compute results url', async () => {
|
|
||||||
await sleep(10000)
|
|
||||||
const downloadURL = await ProviderInstance.getComputeResultUrl(
|
|
||||||
providerUrl,
|
|
||||||
web3,
|
|
||||||
consumerAccount,
|
|
||||||
freeComputeJobId,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
assert(downloadURL, 'Provider getComputeResultUrl failed!')
|
|
||||||
})
|
|
||||||
|
|
||||||
// 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 () => {
|
|
||||||
sleep(10000)
|
|
||||||
// we choose the free env
|
|
||||||
const computeEnv = computeEnvs.find((ce) => ce.priceMin === 0)
|
|
||||||
assert(computeEnv, 'Cannot find the free compute env')
|
|
||||||
|
|
||||||
const assets: ComputeAsset[] = [
|
|
||||||
{
|
|
||||||
documentId: resolvedDdoWith1mTimeout.id,
|
|
||||||
serviceId: resolvedDdoWith1mTimeout.services[0].id,
|
|
||||||
transferTxId: freeEnvDatasetTxId
|
|
||||||
}
|
|
||||||
]
|
|
||||||
const algo: ComputeAlgorithm = {
|
|
||||||
documentId: resolvedAlgoDdoWith1mTimeout.id,
|
|
||||||
serviceId: resolvedAlgoDdoWith1mTimeout.services[0].id,
|
|
||||||
transferTxId: freeEnvAlgoTxId
|
|
||||||
}
|
|
||||||
|
|
||||||
providerInitializeComputeResults = await ProviderInstance.initializeCompute(
|
|
||||||
assets,
|
|
||||||
algo,
|
|
||||||
computeEnv.id,
|
|
||||||
computeValidUntil,
|
|
||||||
providerUrl,
|
|
||||||
consumerAccount
|
|
||||||
)
|
|
||||||
assert(
|
|
||||||
providerInitializeComputeResults.algorithm.validOrder,
|
|
||||||
'We should have a valid order for algorithm'
|
|
||||||
)
|
|
||||||
assert(
|
|
||||||
!providerInitializeComputeResults.algorithm.providerFee,
|
|
||||||
'We should not pay providerFees again for algorithm'
|
|
||||||
)
|
|
||||||
assert(
|
|
||||||
providerInitializeComputeResults.datasets[0].validOrder,
|
|
||||||
'We should have a valid order for dataset'
|
|
||||||
)
|
|
||||||
assert(
|
|
||||||
!providerInitializeComputeResults.datasets[0].providerFee,
|
|
||||||
'We should not pay providerFees again for dataset'
|
|
||||||
)
|
|
||||||
algo.transferTxId = providerInitializeComputeResults.algorithm.validOrder
|
|
||||||
assets[0].transferTxId = providerInitializeComputeResults.datasets[0].validOrder
|
|
||||||
assert(
|
|
||||||
algo.transferTxId === freeEnvAlgoTxId &&
|
|
||||||
assets[0].transferTxId === freeEnvDatasetTxId,
|
|
||||||
'We should use the same orders, because no fess must be paid'
|
|
||||||
)
|
|
||||||
const computeJobs = await ProviderInstance.computeStart(
|
|
||||||
providerUrl,
|
|
||||||
web3,
|
|
||||||
consumerAccount,
|
|
||||||
computeEnv.id,
|
|
||||||
assets[0],
|
|
||||||
algo
|
|
||||||
)
|
|
||||||
assert(computeJobs, 'Cannot start compute job')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should restart a computeJob on paid environment, without paying anything, because order is valid and providerFees are still valid', async () => {
|
it('should restart a computeJob on paid environment, without paying anything, because order is valid and providerFees are still valid', async () => {
|
||||||
sleep(10000)
|
sleep(10000)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user