Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove timeout tests #226

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions test/interface-tests/src/bitswap/wantlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { CID } from 'multiformats/cid'
import { isWebWorker } from 'wherearewe'
import { ipfsOptionsWebsocketsFilterAll } from '../utils/ipfs-options-websockets-filter-all.js'
import { getDescribe, getIt, type MochaConfig } from '../utils/mocha.js'
import testTimeout from '../utils/test-timeout.js'
import { waitForWantlistKey, waitForWantlistKeyToBeRemoved } from './utils.js'
import type { KuboRPCClient } from '../../../../src/index.js'
import type { KuboRPCFactory } from '../index.js'
Expand Down Expand Up @@ -39,12 +38,6 @@ export function testWantlist (factory: KuboRPCFactory, options: MochaConfig): vo
await factory.clean()
})

it('should respect timeout option when getting bitswap wantlist', async () => {
return testTimeout(async () => ipfsA.bitswap.wantlist({
timeout: 1
}))
})

it('should get the wantlist', async function () {
return waitForWantlistKey(ipfsB, key)
})
Expand Down
7 changes: 0 additions & 7 deletions test/interface-tests/src/block/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { CID } from 'multiformats/cid'
import { identity } from 'multiformats/hashes/identity'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { getDescribe, getIt, type MochaConfig } from '../utils/mocha.js'
import testTimeout from '../utils/test-timeout.js'
import type { KuboRPCClient } from '../../../../src/index.js'
import type { KuboRPCFactory } from '../index.js'

Expand All @@ -27,12 +26,6 @@ export function testGet (factory: KuboRPCFactory, options: MochaConfig): void {
await factory.clean()
})

it('should respect timeout option when getting a block', async () => {
return testTimeout(async () => ipfs.block.get(CID.parse('QmPv52ekjS75L4JmHpXVeuJ5uX2ecSfSZo88NSyxwA3rA3'), {
timeout: 1
}))
})

it('should get by CID', async () => {
const block = await ipfs.block.get(cid)

Expand Down
11 changes: 0 additions & 11 deletions test/interface-tests/src/block/rm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import * as raw from 'multiformats/codecs/raw'
import { nanoid } from 'nanoid'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { getDescribe, getIt, type MochaConfig } from '../utils/mocha.js'
import testTimeout from '../utils/test-timeout.js'
import type { KuboRPCClient } from '../../../../src/index.js'
import type { KuboRPCFactory } from '../index.js'

Expand All @@ -25,16 +24,6 @@ export function testRm (factory: KuboRPCFactory, options: MochaConfig): void {
await factory.clean()
})

it('should respect timeout option when removing a block', async function () {
const cid = await ipfs.dag.put(uint8ArrayFromString(nanoid()), {
storeCodec: 'raw',
hashAlg: 'sha2-256'
})
await testTimeout(async () => ipfs.block.rm(CID.parse(cid.toString()), {
timeout: 1
}))
})

it('should remove by CID object', async () => {
const cid = await ipfs.dag.put(uint8ArrayFromString(nanoid()), {
storeCodec: 'raw',
Expand Down
9 changes: 1 addition & 8 deletions test/interface-tests/src/block/stat.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* eslint-env mocha */

import { expect } from 'aegir/chai'
import { CID } from 'multiformats/cid'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { getDescribe, getIt, type MochaConfig } from '../utils/mocha.js'
import testTimeout from '../utils/test-timeout.js'
import type { KuboRPCClient } from '../../../../src/index.js'
import type { KuboRPCFactory } from '../index.js'
import type { CID } from 'multiformats/cid'

export function testStat (factory: KuboRPCFactory, options: MochaConfig): void {
const describe = getDescribe(options)
Expand All @@ -26,12 +25,6 @@ export function testStat (factory: KuboRPCFactory, options: MochaConfig): void {
await factory.clean()
})

it('should respect timeout option when statting a block', async () => {
return testTimeout(async () => ipfs.block.stat(CID.parse('QmVwdDCY4SPGVFnNCiZnX5CtzwWDn6kAM98JXzKxE3kCmn'), {
timeout: 1
}))
})

it('should stat by CID', async () => {
const stats = await ipfs.block.stat(cid)
expect(stats.cid.toString()).to.equal(cid.toString())
Expand Down
10 changes: 0 additions & 10 deletions test/interface-tests/src/cat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import { expect } from 'aegir/chai'
import { importer } from 'ipfs-unixfs-importer'
import all from 'it-all'
import drain from 'it-drain'
import { CID } from 'multiformats/cid'
import { concat as uint8ArrayConcat } from 'uint8arrays/concat'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
import blockstore from './utils/blockstore-adapter.js'
import { fixtures } from './utils/index.js'
import { getDescribe, getIt, type MochaConfig } from './utils/mocha.js'
import testTimeout from './utils/test-timeout.js'
import type { KuboRPCFactory } from './index.js'
import type { KuboRPCClient } from '../../../src/index.js'

Expand All @@ -34,14 +32,6 @@ export function testCat (factory: KuboRPCFactory, options: MochaConfig): void {
await factory.clean()
})

it('should respect timeout option when catting files', async function () {
await testTimeout(async () => {
await drain(ipfs.cat(CID.parse('QmPDqvcuA4AkhBLBuh2y49yhUB98rCnxPxa3eVNC1kAbS1'), {
timeout: 1
}))
})
})

it('should export a chunk of a file', async function () {
const offset = 1
const length = 3
Expand Down
7 changes: 0 additions & 7 deletions test/interface-tests/src/dag/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { sha256 } from 'multiformats/hashes/sha2'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import blockstore from '../utils/blockstore-adapter.js'
import { getDescribe, getIt, type MochaConfig } from '../utils/mocha.js'
import testTimeout from '../utils/test-timeout.js'
import type { KuboRPCClient } from '../../../../src/index.js'
import type { KuboRPCFactory } from '../index.js'

Expand Down Expand Up @@ -79,12 +78,6 @@ export function testGet (factory: KuboRPCFactory, options: MochaConfig): void {
await ipfs.dag.put(nodeJose, { storeCodec: dagJOSE.name, hashAlg: 'sha2-256' })
})

it('should respect timeout option when getting a DAG node', async () => {
return testTimeout(async () => ipfs.dag.get(CID.parse('QmPv52ekjS75L4JmHpXVeuJ5uX2ecSfSZo88NSyxwA3rAd'), {
timeout: 1
}))
})

it('should get a dag-pb node', async () => {
const cid = await ipfs.dag.put(pbNode, {
storeCodec: 'dag-pb',
Expand Down
9 changes: 0 additions & 9 deletions test/interface-tests/src/dag/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import * as dagPB from '@ipld/dag-pb'
import { expect } from 'aegir/chai'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { getDescribe, getIt, type MochaConfig } from '../utils/mocha.js'
import testTimeout from '../utils/test-timeout.js'
import type { KuboRPCClient } from '../../../../src/index.js'
import type { KuboRPCFactory } from '../index.js'

Expand All @@ -21,14 +20,6 @@ export function testResolve (factory: KuboRPCFactory, options: MochaConfig): voi
await factory.clean()
})

it('should respect timeout option when resolving a path within a DAG node', async function () {
const cid = await ipfs.dag.put({}, { storeCodec: 'dag-cbor', hashAlg: 'sha2-256' })

await testTimeout(async () => ipfs.dag.resolve(cid, {
timeout: 1
}))
})

it('should resolve a path inside a cbor node', async () => {
const obj = {
a: 1,
Expand Down
12 changes: 0 additions & 12 deletions test/interface-tests/src/dht/query.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/* eslint-env mocha */

import { expect } from 'aegir/chai'
import drain from 'it-drain'
import { getDescribe, getIt, type MochaConfig } from '../utils/mocha.js'
import testTimeout from '../utils/test-timeout.js'
import { ensureReachable } from './utils.js'
import type { KuboRPCClient } from '../../../../src/index.js'
import type { KuboRPCFactory } from '../index.js'
Expand All @@ -29,16 +27,6 @@ export function testQuery (factory: KuboRPCFactory, options: MochaConfig): void
await factory.clean()
})

it('should respect timeout option when querying the DHT', async () => {
const nodeBId = await nodeB.id()

return testTimeout(async () => {
return drain(nodeA.dht.query(nodeBId.id, {
timeout: 1
}))
})
})

it('should return the other node in the query', async function () {
/** @type {string[]} */
const peers = []
Expand Down
9 changes: 0 additions & 9 deletions test/interface-tests/src/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
import blockstore from './utils/blockstore-adapter.js'
import { fixtures } from './utils/index.js'
import { getDescribe, getIt, type MochaConfig } from './utils/mocha.js'
import testTimeout from './utils/test-timeout.js'
import type { KuboRPCFactory } from './index.js'
import type { KuboRPCClient } from '../../../src/index.js'

Expand Down Expand Up @@ -94,14 +93,6 @@ export function testGet (factory: KuboRPCFactory, options: MochaConfig): void {
})

describe('files', function () {
it('should respect timeout option when getting files', async function () {
await testTimeout(async () => {
await drain(ipfs.get(CID.parse('QmPDqvcuA4AkhBLBuh2y49yhUB98rCnxPxa3eVNC1kAbS1'), {
timeout: 1
}))
})
})

it('should get with a base58 encoded multihash', async () => {
const output = await pipe(
ipfs.get(fixtures.smallFile.cid),
Expand Down
8 changes: 0 additions & 8 deletions test/interface-tests/src/ls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

import { expect } from 'aegir/chai'
import all from 'it-all'
import { CID } from 'multiformats/cid'
import { fixtures } from './utils/index.js'
import { getDescribe, getIt, type MochaConfig } from './utils/mocha.js'
import testTimeout from './utils/test-timeout.js'
import type { KuboRPCFactory } from './index.js'
import type { KuboRPCClient } from '../../../src/index.js'
import type { ImportCandidate } from 'ipfs-unixfs-importer'
Expand All @@ -29,12 +27,6 @@ export function testLs (factory: KuboRPCFactory, options: MochaConfig): void {
await factory.clean()
})

it('should respect timeout option when listing files', async () => {
return testTimeout(() => ipfs.ls(CID.parse('QmNonExistentCiD8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXg'), {
timeout: 1
}))
})

it('should ls with a base58 encoded CID', async function () {
const content = (name: string): ImportCandidate => ({
path: `test-folder/${name}`,
Expand Down
10 changes: 0 additions & 10 deletions test/interface-tests/src/refs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ import { expect } from 'aegir/chai'
import loadFixture from 'aegir/fixtures'
import { UnixFS } from 'ipfs-unixfs'
import all from 'it-all'
import drain from 'it-drain'
import { CID } from 'multiformats/cid'
import { getDescribe, getIt, type MochaConfig } from './utils/mocha.js'
import testTimeout from './utils/test-timeout.js'
import type { KuboRPCFactory } from './index.js'
import type { KuboRPCClient } from '../../../src/index.js'

Expand Down Expand Up @@ -66,14 +64,6 @@ export function testRefs (factory: KuboRPCFactory, options: MochaConfig): void {
})
}

it('should respect timeout option when listing refs', async () => {
return testTimeout(async () => {
await drain(ipfs.refs('/ipfs/QmPDqvcuA4AkhBLBuh2y49yhUB98rCnxPxa3eVNC1kAbS1/foo/bar/baz.txt', {
timeout: 1
}))
})
})

it('should get refs with cbor links', async function () {
this.timeout(20 * 1000)

Expand Down
12 changes: 0 additions & 12 deletions test/interface-tests/src/routing/find-peer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import { peerIdFromString } from '@libp2p/peer-id'
import { expect } from 'aegir/chai'
import all from 'it-all'
import drain from 'it-drain'
import { ensureReachable } from '../dht/utils.js'
import { getDescribe, getIt, type MochaConfig } from '../utils/mocha.js'
import testTimeout from '../utils/test-timeout.js'
import type { RoutingQueryEvent } from '../../../../src/dht/index.js'
import type { KuboRPCClient } from '../../../../src/index.js'
import type { KuboRPCFactory } from '../index.js'
Expand All @@ -32,16 +30,6 @@ export function testFindPeer (factory: KuboRPCFactory, options: MochaConfig): vo
await factory.clean()
})

it('should respect timeout option when finding a peer on the routing', async () => {
const nodeBId = await nodeB.id()

await testTimeout(async () => {
await drain(nodeA.routing.findPeer(nodeBId.id, {
timeout: 1
}))
})
})

it('should find other peers', async () => {
const nodeBId = await nodeB.id()

Expand Down
10 changes: 0 additions & 10 deletions test/interface-tests/src/routing/find-provs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

import { expect } from 'aegir/chai'
import all from 'it-all'
import drain from 'it-drain'
import { ensureReachable } from '../dht/utils.js'
import { getDescribe, getIt, type MochaConfig } from '../utils/mocha.js'
import testTimeout from '../utils/test-timeout.js'
import type { KuboRPCClient } from '../../../../src/index.js'
import type { KuboRPCFactory } from '../index.js'
import type { CID } from 'multiformats/cid'
Expand Down Expand Up @@ -50,14 +48,6 @@ export function testFindProvs (factory: KuboRPCFactory, options: MochaConfig): v
])
})

it('should respect timeout option when finding providers on the routing', async () => {
await testTimeout(async () => {
await drain(nodeA.routing.findProvs(providedCid, {
timeout: 1
}))
})
})

it('should be able to find providers', async function () {
const providerIds: string[] = []

Expand Down
13 changes: 0 additions & 13 deletions test/interface-tests/src/routing/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

import { expect } from 'aegir/chai'
import all from 'it-all'
import drain from 'it-drain'
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
import { ensureReachable } from '../dht/utils.js'
import { getDescribe, getIt, type MochaConfig } from '../utils/mocha.js'
import testTimeout from '../utils/test-timeout.js'
import type { KuboRPCClient } from '../../../../src/index.js'
import type { KuboRPCFactory } from '../index.js'

Expand All @@ -31,17 +29,6 @@ export function testGet (factory: KuboRPCFactory, options: MochaConfig): void {
await factory.clean()
})

it('should respect timeout option when getting a value from the routing', async () => {
const data = await nodeA.add('should put a value to the routing')
const publish = await nodeA.name.publish(data.cid)

await testTimeout(async () => {
await drain(nodeB.routing.get(`/ipns/${publish.name}`, {
timeout: 1
}))
})
})

it('should error when getting a non-existent key from the routing', async () => {
const key = '/ipns/k51qzi5uqu5dl0dbfddy2wb42nvbc6anyxnkrguy5l0h0bv9kaih6j6vqdskqk'

Expand Down
42 changes: 0 additions & 42 deletions test/interface-tests/src/utils/test-timeout.ts

This file was deleted.

Loading