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

fix: Fix all hanging tests, reduce flakyness of other tests #2186

Open
wants to merge 71 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
9b24d0e
fix-start-and-stop-of-autocertifier-client
ptesavol Dec 8, 2023
411ed05
Fix all hanging tests from dht and trackerless-network packages. Incl…
ptesavol Dec 8, 2023
1e8fdf2
reduce afterEach timeout
juslesan Dec 8, 2023
f141b07
stop client e2e tests from hanging
ptesavol Dec 8, 2023
9bf96d8
Merge branch 'fix-all-dht-and-trackerless-hanging-tests' of github.co…
ptesavol Dec 8, 2023
3cc0a48
disable monkey-patch
ptesavol Dec 8, 2023
3ec09eb
bring back monkey patch
ptesavol Dec 9, 2023
cf5312c
disable all other tests in CI apart from client-e2e
ptesavol Dec 9, 2023
ffb06db
Merge branch 'fix-all-dht-and-trackerless-hanging-tests' of github.co…
ptesavol Dec 9, 2023
c9042ff
re-enable monkey-patch
ptesavol Dec 9, 2023
885b8b9
moved starting and stopping of keyserver to happen in package.json sc…
ptesavol Dec 9, 2023
1fbb480
moved starting of keyserver to package.json in broker tests
ptesavol Dec 9, 2023
b2bd56e
fix package.json scripts
ptesavol Dec 9, 2023
ac6cdb5
trying to get test-utils to deploy bin
ptesavol Dec 9, 2023
f4e44fc
trying to get the bin on workspaces to node-modules
ptesavol Dec 9, 2023
b36b3a7
improve keyserver
ptesavol Dec 9, 2023
d00e5aa
re-enable everything in validate.yml
ptesavol Dec 9, 2023
f855aa0
dispose tsyringe container
ptesavol Dec 9, 2023
2001054
clean up event listeners
ptesavol Dec 9, 2023
fe098eb
add cleanup of eventlisteners
ptesavol Dec 9, 2023
2f32508
increase waitForCondition timeout
ptesavol Dec 9, 2023
4cda584
fix websocket connect timeout bug, remove all references to localhost
ptesavol Dec 10, 2023
b76116d
make LeaksDetector output readable
ptesavol Dec 10, 2023
8afd28f
fix keyserver in cli-tools, fix missing await bug in a client e2e test
ptesavol Dec 10, 2023
7415d6f
add listeners before causing the waited event
ptesavol Dec 10, 2023
45745cf
fix publish-subscribe test, add possibility to run individual tests w…
ptesavol Dec 10, 2023
fca3ffd
make storage registry test run in sequential order
ptesavol Dec 10, 2023
2a3fcf3
fix publish-subscribe test
ptesavol Dec 10, 2023
b6e287b
fix publish-subscribe test 2
ptesavol Dec 10, 2023
4d4111f
remove a memory leak
ptesavol Dec 10, 2023
3185719
made leaksdetector sequential
ptesavol Dec 10, 2023
afcc5d4
fix made leaksdetector sequential
ptesavol Dec 10, 2023
11c0f9d
enable keyserver on client browser tests
ptesavol Dec 10, 2023
12335be
try to fix remaining memory leaks
ptesavol Dec 10, 2023
16c48b9
improve memoryleaks test
ptesavol Dec 11, 2023
cbb65df
fix build
ptesavol Dec 11, 2023
7ba8baa
double memeoryleaks test timeout
ptesavol Dec 11, 2023
5bba2b2
add client.destroy() to memoryleak tests
ptesavol Dec 11, 2023
0f6cbe2
change websocket url in broker websocket plugin test
ptesavol Dec 11, 2023
412cf5b
DestroySignal refactoring to remove possible leak
ptesavol Dec 11, 2023
a8f4e50
revert to old parallel getLeaks()
ptesavol Dec 11, 2023
8c0d17a
remove hanging promise from MemoryLeaks test unsubscribe
ptesavol Dec 12, 2023
8758cd8
Merge branch 'streamr-1.0' of github.com:streamr-dev/network-monorepo…
ptesavol Dec 12, 2023
43b7f86
merged with streamr-1.0
ptesavol Dec 12, 2023
2c716ac
Fix mqtt bridge test
ptesavol Dec 12, 2023
e068993
Merge commit '890c67ed7' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
239d9b6
Merge commit 'dcb16b9f8' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
2d05db0
Merge commit '837b1704d' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
aa33ece
Merge commit '35f0b71f4' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
27279fa
Merge commit '7ae27989d' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
58975f8
Merge commit '87f33e5b1' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
b0135c8
Merge commit '15dc866ec' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
9ad5a9b
Merge commit '6c941165d' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
19b5288
Merge commit '4e2f4f7ac' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
f16b333
Merge commit '4766c4f7e' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
25414ff
Merge commit '8f0b0711e' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
fa02755
Merge commit '8069854e3' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
24041c7
Merge commit '81c4beca9' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
ab5a2c8
Merge commit '255766786' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
7178948
Merge commit '747bfb590' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
8b30ca6
Merge commit '240416343' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
cfed328
Merge commit '4166c8f58' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
dc347e9
Merge commit '5057e4f68' into fix-all-dht-and-trackerless-hanging-tests
teogeb Dec 22, 2023
7d9b824
Merge branch 'streamr-1.0' into fix-all-dht-and-trackerless-hanging-t…
teogeb Dec 22, 2023
7030a8b
Merge branch 'streamr-1.0' into fix-all-dht-and-trackerless-hanging-t…
teogeb Dec 22, 2023
23ac374
Merge branch 'main' into fix-all-dht-and-trackerless-hanging-tests
teogeb Jan 11, 2024
e6486c0
fix merge 23ac374
teogeb Jan 12, 2024
69eef4f
Merge branch 'main' into fix-all-dht-and-trackerless-hanging-tests
teogeb Jan 17, 2024
ab9b938
revert localhost to 127.0.0.1 change (shouldn't make a difference e.g…
teogeb Jan 17, 2024
fb4cead
eslint
teogeb Jan 17, 2024
6f5d492
Merge branch 'main' into fix-all-dht-and-trackerless-hanging-tests
teogeb Feb 2, 2024
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
4 changes: 3 additions & 1 deletion .github/workflows/reusable/cached-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@ runs:
shell: bash
- name: build
if: steps.cache-build.outputs.cache-hit != 'true'
run: npm run build
run: npm run build && npm ci --no-audit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comment as to why this is necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a known bug in npm, another npm ci after build is needed to install the binaries generated by submodules

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ptesavol Which binaries weren't installed in practice? Could you provide a link to that bug?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

streamr-keyserver was not installed. npm/cli#4591

shell: bash


2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
package: broker
docker-services: cassandra init-keyspace dev-chain-fast deploy-network-subgraphs-fastchain
run-entry-point: true
command: npm run test-integration
command: npm run test-sequential && npm run test-integration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run sequential after integration

client-browser:
needs: build
uses: ./.github/workflows/test-setup.yml
Expand Down
3 changes: 3 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/broker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"eslint": "eslint --cache --cache-location=node_modules/.cache/.eslintcache/ '*/**/*.{js,ts}'",
"test": "npm run test-unit && npm run test-integration && npm run test-sequential",
"test-unit": "jest test/unit",
"test-sequential": "jest --bail --forceExit --maxWorkers=1 test/sequential # always run sequential tests with maxWorkers=1",
"test-integration": "jest --bail --forceExit test/integration && npm run test-sequential"
"test-sequential": "streamr-keyserver 45456 800 899 & PIDS=$!; sleep 5 && jest --bail --maxWorkers=1 test/sequential/$npm_config_test && kill $PIDS || (kill $PIDS; return 1)",
"test-integration": "streamr-keyserver 45455 500 799 & PID=$!; sleep 5 && jest --bail test/integration/$npm_config_test && kill $PID || (kill $PID; return1)"
},
"author": "Streamr Network AG <[email protected]>",
"license": "STREAMR NETWORK OPEN SOURCE LICENSE",
Expand Down
5 changes: 3 additions & 2 deletions packages/broker/src/plugins/websocket/WebsocketServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ export class WebsocketServer {
connection = this.createConnection(connectionUrl)
} catch (err) {
logger.warn('Reject incoming connection', {
requestUrl: request.url,
reason: err?.message
reason: err?.message,
requestUrl: request.url

})
sendHttpError('400 Bad Request', socket)
return
Expand Down
6 changes: 3 additions & 3 deletions packages/broker/test/integration/broker-subscriptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { StreamrClient, Stream, StreamPartID, StreamPermission } from 'streamr-c
import { fastWallet, fetchPrivateKeyWithGas } from '@streamr/test-utils'
import { wait, waitForCondition } from '@streamr/utils'
import { Broker } from '../../src/broker'
import { startBroker, createClient, createTestStream } from '../utils'
import { startBroker, createClient, createTestStream, KEYSERVER_PORT } from '../utils'

jest.setTimeout(50000)

Expand Down Expand Up @@ -60,8 +60,8 @@ describe('broker subscriptions', () => {
}
})

client1 = createClient(await fetchPrivateKeyWithGas())
client2 = createClient(await fetchPrivateKeyWithGas())
client1 = createClient(await fetchPrivateKeyWithGas(KEYSERVER_PORT))
client2 = createClient(await fetchPrivateKeyWithGas(KEYSERVER_PORT))

mqttClient1 = await createMqttClient(mqttPort1)
mqttClient2 = await createMqttClient(mqttPort2)
Expand Down
4 changes: 2 additions & 2 deletions packages/broker/test/integration/createMessagingPluginTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { MessageMetadata, Stream, StreamrClient } from 'streamr-client'
import { fetchPrivateKeyWithGas, Queue } from '@streamr/test-utils'
import { Broker } from '../../src/broker'
import { Message } from '../../src/helpers/PayloadFormat'
import { createClient, startBroker, createTestStream } from '../utils'
import { createClient, startBroker, createTestStream, KEYSERVER_PORT } from '../utils'
import { wait, merge } from '@streamr/utils'

interface MessagingPluginApi<T> {
Expand Down Expand Up @@ -58,7 +58,7 @@ export const createMessagingPluginTest = <T>(
let messageQueue: Queue<Message>

beforeAll(async () => {
brokerUser = new Wallet(await fetchPrivateKeyWithGas())
brokerUser = new Wallet(await fetchPrivateKeyWithGas(KEYSERVER_PORT))
broker = await startBroker({
privateKey: brokerUser.privateKey,
apiAuthentication: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fetch from 'node-fetch'
import { StreamPermission } from 'streamr-client'
import { fetchPrivateKeyWithGas, Queue } from '@streamr/test-utils'
import { Broker } from '../../src/broker'
import { startBroker, createClient, createTestStream } from '../utils'
import { startBroker, createClient, createTestStream, KEYSERVER_PORT } from '../utils'
import { fastPrivateKey } from '@streamr/test-utils'
import { wait, waitForEvent, waitForCondition } from '@streamr/utils'
import sample from 'lodash/sample'
Expand Down Expand Up @@ -103,7 +103,7 @@ describe('multiple publisher plugins', () => {
let streamId: string

beforeAll(async () => {
privateKey = await fetchPrivateKeyWithGas()
privateKey = await fetchPrivateKeyWithGas(KEYSERVER_PORT)
const client = createClient(privateKey)
const stream = await createTestStream(client, module)
streamId = stream.id
Expand Down
139 changes: 94 additions & 45 deletions packages/broker/test/integration/plugins/mqtt/Bridge.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Stream, StreamrClient } from 'streamr-client'
import mqtt from 'async-mqtt'
import { fetchPrivateKeyWithGas, Queue } from '@streamr/test-utils'
import { fetchPrivateKeyWithGas } from '@streamr/test-utils'
import { Broker } from '../../../../src/broker'
import { createClient, startBroker, createTestStream } from '../../../utils'
import { wait } from '@streamr/utils'
import { createClient, startBroker, createTestStream, KEYSERVER_PORT } from '../../../utils'
import { waitForEvent3 } from '@streamr/utils'
import { Wallet } from '@ethersproject/wallet'
import EventEmitter from 'eventemitter3'

const MQTT_PLUGIN_PORT = 12470

Expand All @@ -14,21 +15,43 @@ const createMqttClient = () => {
return mqtt.connectAsync(`mqtt://127.0.0.1:${MQTT_PLUGIN_PORT}`)
}

export interface SubscriberEvents {
messageObject: (messageObject: object) => void
}
class Subscriber extends EventEmitter<SubscriberEvents> {
private mqttClient?: mqtt.AsyncMqttClient
public readonly receivedMessageObjects: object[] = []

async subscribe(topic: string): Promise<void> {
this.mqttClient = await createMqttClient()
this.mqttClient.on('message', this.onMessage)
await this.mqttClient.subscribe(topic)
}

async unsubscribe(topic: string): Promise<void> {
return this.mqttClient!.unsubscribe(topic)
}

async stop(): Promise<void> {
this.mqttClient!.off('message', this.onMessage)
await this.mqttClient!.end(true)
}

private onMessage = (_topic: string, message: Buffer): void => {
const messageObject = JSON.parse(message.toString())
this.receivedMessageObjects.push(messageObject)
this.emit('messageObject', messageObject)
}
}

describe('MQTT Bridge', () => {
let stream: Stream
let streamrClient: StreamrClient
let broker: Broker
let brokerUser: Wallet

const createSubscriber = async (messageQueue: Queue<any>) => {
const subscriber = await createMqttClient()
subscriber.on('message', (_topic, message) => messageQueue.push(JSON.parse(message.toString())))
subscriber.subscribe(stream.id)
return subscriber
}

beforeAll(async () => {
brokerUser = new Wallet(await fetchPrivateKeyWithGas())
brokerUser = new Wallet(await fetchPrivateKeyWithGas(KEYSERVER_PORT))
broker = await startBroker({
privateKey: brokerUser.privateKey,
extraPlugins: {
Expand Down Expand Up @@ -58,15 +81,20 @@ describe('MQTT Bridge', () => {
const expected = {
foo: Date.now()
}
const messageQueue = new Queue<any>()
const subscriber = await createSubscriber(messageQueue)

const subscriber = new Subscriber()
const promise = waitForEvent3<SubscriberEvents>(subscriber, 'messageObject', 20000)

await subscriber.subscribe(stream.id)
const publisher = await createMqttClient()

publisher.publish(stream.id, JSON.stringify(expected))
await promise

expect(await messageQueue.pop()).toEqual(expected)
expect(subscriber.receivedMessageObjects[0]).toEqual(expected)

await Promise.allSettled([
subscriber.end(true),
subscriber.stop(),
publisher.end(true)
])
})
Expand All @@ -75,70 +103,91 @@ describe('MQTT Bridge', () => {
const expected = {
foo: Date.now()
}
const messageQueue = new Queue<any>()
const subscriber = await createSubscriber(messageQueue)
await streamrClient.publish(stream.id, expected)

const subscriber = new Subscriber()
const promise = waitForEvent3<SubscriberEvents>(subscriber, 'messageObject', 20000)
await subscriber.subscribe(stream.id)

expect(await messageQueue.pop()).toEqual(expected)
await streamrClient.publish(stream.id, expected)
await promise

expect(await subscriber.receivedMessageObjects[0]).toEqual(expected)

await subscriber.end(true)
await subscriber.stop()
})

test('message should be delivered once per client if subscribed by multiple clients', async () => {
const expected = {
foo: Date.now()
}
const messageQueue1 = new Queue<any>()
const messageQueue2 = new Queue<any>()
const subscriber1 = await createSubscriber(messageQueue1)
const subscriber2 = await createSubscriber(messageQueue2)
const subscriber1 = new Subscriber()
const promise1 = waitForEvent3<SubscriberEvents>(subscriber1, 'messageObject', 20000)
await subscriber1.subscribe(stream.id)

const subscriber2 = new Subscriber()
const promise2 = waitForEvent3<SubscriberEvents>(subscriber2, 'messageObject', 20000)
await subscriber2.subscribe(stream.id)

await streamrClient.publish(stream.id, expected)

expect(await messageQueue1.pop()).toEqual(expected)
expect(await messageQueue2.pop()).toEqual(expected)
await Promise.all([promise1, promise2])

expect(subscriber1.receivedMessageObjects[0]).toEqual(expected)
expect(subscriber2.receivedMessageObjects[0]).toEqual(expected)

await Promise.allSettled([
subscriber1.end(true),
subscriber2.end(true)
subscriber1.stop(),
subscriber2.stop()
])
})

it('subscription should not be unsubscribed if it was not subscribed by that client', async () => {
const expected = {
foo: Date.now()
}
const messageQueue = new Queue<any>()
const subscriber1 = await createSubscriber(messageQueue)
const subscriber2 = await createMqttClient()
subscriber2.unsubscribe(stream.id)

const subscriber1 = new Subscriber()
const promise1 = waitForEvent3<SubscriberEvents>(subscriber1, 'messageObject', 20000)
await subscriber1.subscribe(stream.id)

const subscriber2 = new Subscriber()
await subscriber2.subscribe(stream.id)

await subscriber2.unsubscribe(stream.id)

await streamrClient.publish(stream.id, expected)

expect(await messageQueue.pop()).toEqual(expected)
await promise1
expect(subscriber1.receivedMessageObjects[0]).toEqual(expected)

await Promise.allSettled([
subscriber1.end(true),
subscriber2.end(true)
subscriber1.stop(),
subscriber2.stop()
])
})

test('message should be delivered to remaining subscribers if one subscriber unsubscribes', async () => {
const expected = {
foo: Date.now()
}
const messageQueue1 = new Queue<any>()
const messageQueue2 = new Queue<any>()
const subscriber1 = await createSubscriber(messageQueue1)
const subscriber2 = await createSubscriber(messageQueue2)
subscriber2.unsubscribe(stream.id)
const subscriber1 = new Subscriber()
const promise1 = waitForEvent3<SubscriberEvents>(subscriber1, 'messageObject', 20000)
await subscriber1.subscribe(stream.id)

const subscriber2 = new Subscriber()
await subscriber2.subscribe(stream.id)

await subscriber2.unsubscribe(stream.id)
await streamrClient.publish(stream.id, expected)

expect(await messageQueue1.pop()).toEqual(expected)
await wait(100) // wait for a while so that the message would have been delivered also to messageQueue2
expect(messageQueue2.values()).toEqual([])
await promise1
expect(subscriber1.receivedMessageObjects[0]).toEqual(expected)

expect(subscriber2.receivedMessageObjects).toEqual([])

await Promise.allSettled([
subscriber1.end(true),
subscriber2.end(true)
subscriber1.stop(),
subscriber2.stop()
])
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ createMessagingPluginTest('mqtt',
await client.publish(streamId, JSON.stringify(msg))
},
subscribe: async (messageQueue: Queue<Message>, streamId: string, client: AsyncMqttClient): Promise<void> => {
client.once('message', (topic: string, message: Buffer) => {
client.on('message', (topic: string, message: Buffer) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an unnecessary change?

if (topic === streamId) {
messageQueue.push(JSON.parse(message.toString()))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import {
sponsor,
stake
} from './contractUtils'
import { createClient, createTestStream } from '../../../utils'
import { createClient, createTestStream, KEYSERVER_PORT } from '../../../utils'
import { fetchPrivateKeyWithGas } from '@streamr/test-utils'

async function createStream(): Promise<string> {
const client = createClient(await fetchPrivateKeyWithGas())
const client = createClient(await fetchPrivateKeyWithGas(KEYSERVER_PORT))
const streamId = (await createTestStream(client, module)).id
await client.destroy()
return streamId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { fastPrivateKey, fetchPrivateKeyWithGas } from '@streamr/test-utils'
import { toEthereumAddress, waitForCondition } from '@streamr/utils'
import { Stream, StreamrClient } from 'streamr-client'
import { OperatorFleetState } from '../../../../src/plugins/operator/OperatorFleetState'
import { createClient, createTestStream } from '../../../utils'
import { createClient, createTestStream, KEYSERVER_PORT } from '../../../utils'
import {
TEST_CHAIN_CONFIG,
delegate,
Expand All @@ -19,7 +19,7 @@ import { MaintainTopologyService } from '../../../../src/plugins/operator/Mainta
import { ContractFacade } from '../../../../src/plugins/operator/ContractFacade'

async function setUpStreams(): Promise<[Stream, Stream]> {
const privateKey = await fetchPrivateKeyWithGas()
const privateKey = await fetchPrivateKeyWithGas(KEYSERVER_PORT)
const client = createClient(privateKey)
const s1 = await createTestStream(client, module, { partitions: 1 })
const s2 = await createTestStream(client, module, { partitions: 3 })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { collect, waitForCondition } from '@streamr/utils'
import { Wallet } from 'ethers'
import { ProxyDirection, StreamPermission } from 'streamr-client'
import { Broker, createBroker } from '../../../../src/broker'
import { createClient, createTestStream, formConfig, startBroker } from '../../../utils'
import { createClient, createTestStream, formConfig, startBroker, KEYSERVER_PORT } from '../../../utils'
import { delegate, deploySponsorshipContract, generateWalletWithGasAndTokens, setupOperatorContract, sponsor, stake } from './contractUtils'

describe('OperatorPlugin', () => {
Expand All @@ -28,7 +28,7 @@ describe('OperatorPlugin', () => {
})

it('accepts proxy connections', async () => {
const subscriber = createClient(await fetchPrivateKeyWithGas())
const subscriber = createClient(await fetchPrivateKeyWithGas(KEYSERVER_PORT))
const stream = await createTestStream(subscriber, module)

const sponsorer = await generateWalletWithGasAndTokens()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fetchPrivateKeyWithGas } from '@streamr/test-utils'
import { Logger, waitForCondition } from '@streamr/utils'
import { createClient, createTestStream } from '../../../utils'
import { createClient, createTestStream, KEYSERVER_PORT } from '../../../utils'
import { delegate, deploySponsorshipContract, generateWalletWithGasAndTokens, setupOperatorContract, sponsor, stake } from './contractUtils'
import { maintainOperatorValue } from '../../../../src/plugins/operator/maintainOperatorValue'
import { multiply } from '../../../../src/helpers/multiply'
Expand All @@ -17,7 +17,7 @@ describe('maintainOperatorValue', () => {

beforeAll(async () => {
logger.debug('Creating stream for the test')
const client = createClient(await fetchPrivateKeyWithGas())
const client = createClient(await fetchPrivateKeyWithGas(KEYSERVER_PORT))
streamId = (await createTestStream(client, module)).id
await client.destroy()
}, 60 * 1000)
Expand Down
Loading
Loading