@streamr/trackerless-network 102.0.0-beta.0 → 102.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/google/protobuf/any.js.map +1 -0
- package/dist/generated/google/protobuf/empty.js.map +1 -0
- package/dist/generated/google/protobuf/timestamp.js.map +1 -0
- package/dist/{src/proto → generated}/packages/dht/protos/DhtRpc.client.d.ts +9 -0
- package/dist/{src/proto → generated}/packages/dht/protos/DhtRpc.client.js +7 -0
- package/dist/generated/packages/dht/protos/DhtRpc.client.js.map +1 -0
- package/dist/{src/proto → generated}/packages/dht/protos/DhtRpc.d.ts +32 -8
- package/dist/{src/proto → generated}/packages/dht/protos/DhtRpc.js +23 -7
- package/dist/generated/packages/dht/protos/DhtRpc.js.map +1 -0
- package/dist/{src/proto → generated}/packages/dht/protos/DhtRpc.server.d.ts +5 -0
- package/dist/generated/packages/dht/protos/DhtRpc.server.js.map +1 -0
- package/dist/generated/packages/proto-rpc/protos/ProtoRpc.js.map +1 -0
- package/dist/generated/packages/trackerless-network/protos/NetworkRpc.client.js.map +1 -0
- package/dist/{src/proto → generated}/packages/trackerless-network/protos/NetworkRpc.d.ts +3 -3
- package/dist/{src/proto → generated}/packages/trackerless-network/protos/NetworkRpc.js +1 -1
- package/dist/generated/packages/trackerless-network/protos/NetworkRpc.js.map +1 -0
- package/dist/generated/packages/trackerless-network/protos/NetworkRpc.server.js.map +1 -0
- package/dist/package.json +9 -10
- package/dist/src/NetworkNode.d.ts +4 -3
- package/dist/src/NetworkNode.js.map +1 -1
- package/dist/src/NetworkStack.d.ts +2 -2
- package/dist/src/NetworkStack.js +4 -4
- package/dist/src/NetworkStack.js.map +1 -1
- package/dist/src/exports.d.ts +3 -2
- package/dist/src/exports.js +3 -2
- package/dist/src/exports.js.map +1 -1
- package/dist/src/logic/ContentDeliveryLayerNode.d.ts +2 -1
- package/dist/src/logic/ContentDeliveryLayerNode.js +5 -5
- package/dist/src/logic/ContentDeliveryLayerNode.js.map +1 -1
- package/dist/src/logic/ContentDeliveryManager.d.ts +2 -1
- package/dist/src/logic/ContentDeliveryManager.js +2 -1
- package/dist/src/logic/ContentDeliveryManager.js.map +1 -1
- package/dist/src/logic/ContentDeliveryRpcLocal.d.ts +3 -3
- package/dist/src/logic/ContentDeliveryRpcLocal.js +1 -1
- package/dist/src/logic/ContentDeliveryRpcLocal.js.map +1 -1
- package/dist/src/logic/ContentDeliveryRpcRemote.d.ts +2 -2
- package/dist/src/logic/ControlLayerNode.d.ts +1 -1
- package/dist/src/logic/DiscoveryLayerNode.d.ts +3 -3
- package/dist/src/logic/DuplicateMessageDetector.js +1 -1
- package/dist/src/logic/DuplicateMessageDetector.js.map +1 -1
- package/dist/src/logic/PeerDescriptorStoreManager.d.ts +1 -1
- package/dist/src/logic/PeerDescriptorStoreManager.js +1 -1
- package/dist/src/logic/PeerDescriptorStoreManager.js.map +1 -1
- package/dist/src/logic/inspect/InspectSession.d.ts +2 -2
- package/dist/src/logic/inspect/InspectSession.js +2 -2
- package/dist/src/logic/inspect/InspectSession.js.map +1 -1
- package/dist/src/logic/inspect/Inspector.d.ts +1 -1
- package/dist/src/logic/inspect/Inspector.js +1 -1
- package/dist/src/logic/inspect/Inspector.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.d.ts +2 -2
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.d.ts +2 -2
- package/dist/src/logic/neighbor-discovery/Handshaker.js +2 -2
- package/dist/src/logic/neighbor-discovery/Handshaker.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js +2 -2
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.d.ts +2 -2
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.d.ts +1 -1
- package/dist/src/logic/node-info/NodeInfoClient.d.ts +1 -1
- package/dist/src/logic/node-info/NodeInfoClient.js +1 -1
- package/dist/src/logic/node-info/NodeInfoClient.js.map +1 -1
- package/dist/src/logic/node-info/NodeInfoRpcLocal.d.ts +2 -2
- package/dist/src/logic/node-info/NodeInfoRpcLocal.js +1 -1
- package/dist/src/logic/node-info/NodeInfoRpcLocal.js.map +1 -1
- package/dist/src/logic/node-info/NodeInfoRpcRemote.d.ts +2 -2
- package/dist/src/logic/propagation/Propagation.d.ts +1 -1
- package/dist/src/logic/propagation/PropagationTaskStore.d.ts +1 -1
- package/dist/src/logic/proxy/ProxyClient.d.ts +1 -2
- package/dist/src/logic/proxy/ProxyClient.js +2 -3
- package/dist/src/logic/proxy/ProxyClient.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.d.ts +2 -2
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js +4 -4
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcRemote.d.ts +2 -2
- package/dist/src/logic/proxy/ProxyConnectionRpcRemote.js +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.d.ts +4 -4
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.d.ts +1 -1
- package/dist/src/logic/utils.d.ts +1 -1
- package/dist/src/logic/utils.js +2 -2
- package/dist/src/logic/utils.js.map +1 -1
- package/dist/src/types.d.ts +6 -0
- package/dist/src/types.js +3 -0
- package/dist/src/types.js.map +1 -0
- package/dist/test/benchmark/first-message.js +2 -2
- package/dist/test/benchmark/first-message.js.map +1 -1
- package/dist/test/utils/utils.d.ts +2 -2
- package/dist/test/utils/utils.js +5 -4
- package/dist/test/utils/utils.js.map +1 -1
- package/jest.config.ts +13 -0
- package/package.json +9 -10
- package/proto.sh +2 -2
- package/protos/NetworkRpc.proto +2 -3
- package/src/NetworkNode.ts +4 -3
- package/src/NetworkStack.ts +6 -7
- package/src/exports.ts +5 -3
- package/src/logic/ContentDeliveryLayerNode.ts +6 -6
- package/src/logic/ContentDeliveryManager.ts +4 -2
- package/src/logic/ContentDeliveryRpcLocal.ts +3 -3
- package/src/logic/ContentDeliveryRpcRemote.ts +2 -2
- package/src/logic/ControlLayerNode.ts +1 -1
- package/src/logic/DiscoveryLayerNode.ts +3 -3
- package/src/logic/DuplicateMessageDetector.ts +2 -2
- package/src/logic/PeerDescriptorStoreManager.ts +1 -1
- package/src/logic/createContentDeliveryLayerNode.ts +1 -1
- package/src/logic/inspect/InspectSession.ts +5 -4
- package/src/logic/inspect/Inspector.ts +2 -2
- package/src/logic/neighbor-discovery/HandshakeRpcLocal.ts +2 -2
- package/src/logic/neighbor-discovery/HandshakeRpcRemote.ts +2 -2
- package/src/logic/neighbor-discovery/Handshaker.ts +2 -2
- package/src/logic/neighbor-discovery/NeighborUpdateManager.ts +2 -2
- package/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.ts +3 -3
- package/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.ts +2 -2
- package/src/logic/node-info/NodeInfoClient.ts +2 -2
- package/src/logic/node-info/NodeInfoRpcLocal.ts +2 -2
- package/src/logic/node-info/NodeInfoRpcRemote.ts +2 -2
- package/src/logic/propagation/Propagation.ts +1 -1
- package/src/logic/propagation/PropagationTaskStore.ts +1 -1
- package/src/logic/proxy/ProxyClient.ts +2 -3
- package/src/logic/proxy/ProxyConnectionRpcLocal.ts +6 -6
- package/src/logic/proxy/ProxyConnectionRpcRemote.ts +4 -4
- package/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts +5 -5
- package/src/logic/temporary-connection/TemporaryConnectionRpcRemote.ts +1 -1
- package/src/logic/utils.ts +4 -4
- package/src/types.ts +13 -0
- package/test/benchmark/first-message.ts +4 -2
- package/test/end-to-end/content-delivery-layer-node-with-real-connections.test.ts +9 -4
- package/test/end-to-end/external-network-rpc.test.ts +2 -2
- package/test/end-to-end/inspect.test.ts +4 -4
- package/test/end-to-end/proxy-and-full-node.test.ts +3 -3
- package/test/end-to-end/proxy-connections.test.ts +10 -12
- package/test/end-to-end/proxy-key-exchange.test.ts +6 -6
- package/test/end-to-end/webrtc-full-node-network.test.ts +3 -5
- package/test/end-to-end/websocket-full-node-network.test.ts +4 -6
- package/test/integration/ContentDeliveryLayerNode-Layer1Node-Latencies.test.ts +7 -7
- package/test/integration/ContentDeliveryLayerNode-Layer1Node.test.ts +6 -6
- package/test/integration/ContentDeliveryManager.test.ts +17 -14
- package/test/integration/ContentDeliveryRpcRemote.test.ts +6 -6
- package/test/integration/HandshakeRpcRemote.test.ts +2 -2
- package/test/integration/Handshakes.test.ts +15 -50
- package/test/integration/NeighborUpdateRpcRemote.test.ts +2 -2
- package/test/integration/NetworkNode.test.ts +5 -5
- package/test/integration/NetworkRpc.test.ts +6 -6
- package/test/integration/NetworkStack.test.ts +2 -2
- package/test/integration/NodeInfoRpc.test.ts +3 -3
- package/test/integration/Propagation.test.ts +4 -4
- package/test/integration/joining-streams-on-offline-peers.test.ts +3 -3
- package/test/integration/stream-without-default-entrypoints.test.ts +8 -8
- package/test/integration/streamEntryPointReplacing.test.ts +3 -3
- package/test/types/global.d.ts +0 -1
- package/test/unit/ContentDeliveryLayerNode.test.ts +4 -4
- package/test/unit/ContentDeliveryManager.test.ts +5 -4
- package/test/unit/ContentDeliveryRpcLocal.test.ts +1 -1
- package/test/unit/DuplicateMessageDetector.test.ts +10 -10
- package/test/unit/ExternalNetworkRpc.test.ts +3 -3
- package/test/unit/HandshakeRpcLocal.test.ts +1 -14
- package/test/unit/InspectSession.test.ts +4 -1
- package/test/unit/Inspector.test.ts +1 -1
- package/test/unit/NeighborFinder.test.ts +2 -2
- package/test/unit/NeighborUpdateRpcLocal.test.ts +1 -1
- package/test/unit/NetworkNode.test.ts +3 -3
- package/test/unit/NodeList.test.ts +1 -1
- package/test/unit/PeerDescriptorStoreManager.test.ts +2 -2
- package/test/unit/Propagation.test.ts +4 -4
- package/test/unit/ProxyConnectionRpcRemote.test.ts +2 -2
- package/test/unit/StreamPartReconnect.test.ts +2 -2
- package/test/utils/mock/MockNeighborUpdateManager.ts +1 -1
- package/test/utils/utils.ts +6 -5
- package/tsconfig.browser.json +1 -0
- package/tsconfig.jest.json +1 -0
- package/tsconfig.node.json +1 -0
- package/.eslintignore +0 -7
- package/.eslintrc +0 -3
- package/dist/src/proto/google/protobuf/any.js.map +0 -1
- package/dist/src/proto/google/protobuf/empty.js.map +0 -1
- package/dist/src/proto/google/protobuf/timestamp.js.map +0 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +0 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +0 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.js.map +0 -1
- package/dist/src/proto/packages/proto-rpc/protos/ProtoRpc.js.map +0 -1
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.client.js.map +0 -1
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js.map +0 -1
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.server.js.map +0 -1
- package/jest.config.js +0 -8
- package/src/proto/google/protobuf/any.ts +0 -326
- package/src/proto/google/protobuf/empty.ts +0 -81
- package/src/proto/google/protobuf/timestamp.ts +0 -287
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +0 -407
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +0 -160
- package/src/proto/packages/dht/protos/DhtRpc.ts +0 -1244
- package/src/proto/packages/proto-rpc/protos/ProtoRpc.ts +0 -108
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.client.ts +0 -218
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.server.ts +0 -85
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.ts +0 -783
- /package/dist/{src/proto → generated}/google/protobuf/any.d.ts +0 -0
- /package/dist/{src/proto → generated}/google/protobuf/any.js +0 -0
- /package/dist/{src/proto → generated}/google/protobuf/empty.d.ts +0 -0
- /package/dist/{src/proto → generated}/google/protobuf/empty.js +0 -0
- /package/dist/{src/proto → generated}/google/protobuf/timestamp.d.ts +0 -0
- /package/dist/{src/proto → generated}/google/protobuf/timestamp.js +0 -0
- /package/dist/{src/proto → generated}/packages/dht/protos/DhtRpc.server.js +0 -0
- /package/dist/{src/proto → generated}/packages/proto-rpc/protos/ProtoRpc.d.ts +0 -0
- /package/dist/{src/proto → generated}/packages/proto-rpc/protos/ProtoRpc.js +0 -0
- /package/dist/{src/proto → generated}/packages/trackerless-network/protos/NetworkRpc.client.d.ts +0 -0
- /package/dist/{src/proto → generated}/packages/trackerless-network/protos/NetworkRpc.client.js +0 -0
- /package/dist/{src/proto → generated}/packages/trackerless-network/protos/NetworkRpc.server.d.ts +0 -0
- /package/dist/{src/proto → generated}/packages/trackerless-network/protos/NetworkRpc.server.js +0 -0
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
RpcCommunicator,
|
|
5
5
|
toProtoRpcClient
|
|
6
6
|
} from '@streamr/proto-rpc'
|
|
7
|
-
import { StreamPartIDUtils,
|
|
8
|
-
import { Empty } from '../../
|
|
9
|
-
import { RpcMessage } from '../../
|
|
10
|
-
import { StreamMessage } from '../../
|
|
11
|
-
import { ContentDeliveryRpcClient } from '../../
|
|
7
|
+
import { StreamPartIDUtils, until } from '@streamr/utils'
|
|
8
|
+
import { Empty } from '../../generated/google/protobuf/empty'
|
|
9
|
+
import { RpcMessage } from '../../generated/packages/proto-rpc/protos/ProtoRpc'
|
|
10
|
+
import { StreamMessage } from '../../generated/packages/trackerless-network/protos/NetworkRpc'
|
|
11
|
+
import { ContentDeliveryRpcClient } from '../../generated/packages/trackerless-network/protos/NetworkRpc.client'
|
|
12
12
|
import { createStreamMessage } from '../utils/utils'
|
|
13
13
|
import { randomUserId } from '@streamr/test-utils'
|
|
14
14
|
|
|
@@ -47,6 +47,6 @@ describe('Network RPC', () => {
|
|
|
47
47
|
randomUserId()
|
|
48
48
|
)
|
|
49
49
|
await client.sendStreamMessage(msg)
|
|
50
|
-
await
|
|
50
|
+
await until(() => recvCounter === 1)
|
|
51
51
|
})
|
|
52
52
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StreamPartIDUtils,
|
|
3
|
-
|
|
3
|
+
until
|
|
4
4
|
} from '@streamr/utils'
|
|
5
5
|
import { NetworkStack } from '../../src/NetworkStack'
|
|
6
6
|
import { createMockPeerDescriptor, createStreamMessage } from '../utils/utils'
|
|
@@ -58,7 +58,7 @@ describe('NetworkStack', () => {
|
|
|
58
58
|
randomUserId()
|
|
59
59
|
)
|
|
60
60
|
stack2.getContentDeliveryManager().broadcast(msg)
|
|
61
|
-
await
|
|
61
|
+
await until(() => receivedMessages === 1)
|
|
62
62
|
})
|
|
63
63
|
|
|
64
64
|
it('join and wait for neighbors', async () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ListeningRpcCommunicator, PeerDescriptor, Simulator, SimulatorTransport } from '@streamr/dht'
|
|
2
|
-
import { StreamPartIDUtils,
|
|
2
|
+
import { StreamPartIDUtils, until } from '@streamr/utils'
|
|
3
3
|
import { NetworkStack } from '../../src/NetworkStack'
|
|
4
4
|
import { NodeInfoClient } from '../../src/logic/node-info/NodeInfoClient'
|
|
5
5
|
import { NODE_INFO_RPC_SERVICE_ID } from '../../src/logic/node-info/NodeInfoRpcLocal'
|
|
@@ -72,7 +72,7 @@ describe('NetworkStack NodeInfoRpc', () => {
|
|
|
72
72
|
otherStack.getContentDeliveryManager().joinStreamPart(streamPartId1)
|
|
73
73
|
requesteStack.getContentDeliveryManager().joinStreamPart(streamPartId2)
|
|
74
74
|
otherStack.getContentDeliveryManager().joinStreamPart(streamPartId2)
|
|
75
|
-
await
|
|
75
|
+
await until(() =>
|
|
76
76
|
requesteStack.getContentDeliveryManager().getNeighbors(streamPartId1).length === 1
|
|
77
77
|
&& otherStack.getContentDeliveryManager().getNeighbors(streamPartId1).length === 1
|
|
78
78
|
&& requesteStack.getContentDeliveryManager().getNeighbors(streamPartId2).length === 1
|
|
@@ -101,7 +101,7 @@ describe('NetworkStack NodeInfoRpc', () => {
|
|
|
101
101
|
}]
|
|
102
102
|
}
|
|
103
103
|
],
|
|
104
|
-
|
|
104
|
+
applicationVersion: expect.any(String)
|
|
105
105
|
})
|
|
106
106
|
expect(result.streamPartitions.length).toEqual(2)
|
|
107
107
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Simulator } from '@streamr/dht'
|
|
2
|
-
import { StreamPartIDUtils,
|
|
2
|
+
import { StreamPartIDUtils, until } from '@streamr/utils'
|
|
3
3
|
import { range } from 'lodash'
|
|
4
4
|
import { ContentDeliveryLayerNode } from '../../src/logic/ContentDeliveryLayerNode'
|
|
5
5
|
import { DiscoveryLayerNode } from '../../src/logic/DiscoveryLayerNode'
|
|
@@ -56,10 +56,10 @@ describe('Propagation', () => {
|
|
|
56
56
|
})
|
|
57
57
|
|
|
58
58
|
it('All nodes receive messages', async () => {
|
|
59
|
-
await
|
|
59
|
+
await until(
|
|
60
60
|
() => contentDeliveryLayerNodes.every((node) => node.getNeighbors().length >= 3), 30000
|
|
61
61
|
)
|
|
62
|
-
await
|
|
62
|
+
await until(() => {
|
|
63
63
|
const avg = contentDeliveryLayerNodes.reduce((acc, curr) => {
|
|
64
64
|
return acc + curr.getNeighbors().length
|
|
65
65
|
}, 0) / contentDeliveryLayerNodes.length
|
|
@@ -71,6 +71,6 @@ describe('Propagation', () => {
|
|
|
71
71
|
randomUserId()
|
|
72
72
|
)
|
|
73
73
|
contentDeliveryLayerNodes[0].broadcast(msg)
|
|
74
|
-
await
|
|
74
|
+
await until(() => totalReceived >= NUM_OF_NODES, 10000)
|
|
75
75
|
}, 45000)
|
|
76
76
|
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LatencyType, PeerDescriptor, Simulator, SimulatorTransport } from '@streamr/dht'
|
|
2
|
-
import { StreamPartIDUtils,
|
|
2
|
+
import { StreamPartIDUtils, until } from '@streamr/utils'
|
|
3
3
|
import { NetworkStack } from '../../src/NetworkStack'
|
|
4
4
|
import { streamPartIdToDataKey } from '../../src/logic/ContentDeliveryManager'
|
|
5
|
-
import { Any } from '../../
|
|
5
|
+
import { Any } from '../../generated/google/protobuf/any'
|
|
6
6
|
import { createMockPeerDescriptor, createStreamMessage } from '../utils/utils'
|
|
7
7
|
import { randomUserId } from '@streamr/test-utils'
|
|
8
8
|
|
|
@@ -76,7 +76,7 @@ describe('Joining stream parts on offline nodes', () => {
|
|
|
76
76
|
node1.getContentDeliveryManager().on('newMessage', () => { messageReceived = true })
|
|
77
77
|
const msg = createStreamMessage(JSON.stringify({ hello: 'WORLD' }), STREAM_PART_ID, randomUserId())
|
|
78
78
|
node2.getContentDeliveryManager().broadcast(msg)
|
|
79
|
-
await
|
|
79
|
+
await until(() => messageReceived, 40000)
|
|
80
80
|
}, 60000)
|
|
81
81
|
|
|
82
82
|
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { LatencyType, PeerDescriptor, Simulator, SimulatorTransport } from '@streamr/dht'
|
|
2
|
-
import {
|
|
2
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
3
|
+
import { StreamPartIDUtils, hexToBinary, toUserIdRaw, utf8ToBinary, until } from '@streamr/utils'
|
|
3
4
|
import { range } from 'lodash'
|
|
4
5
|
import { NetworkNode, createNetworkNode } from '../../src/NetworkNode'
|
|
5
6
|
import { streamPartIdToDataKey } from '../../src/logic/ContentDeliveryManager'
|
|
6
|
-
import { ContentType, EncryptionType, SignatureType, StreamMessage } from '../../
|
|
7
|
+
import { ContentType, EncryptionType, SignatureType, StreamMessage } from '../../generated/packages/trackerless-network/protos/NetworkRpc'
|
|
7
8
|
import { createMockPeerDescriptor } from '../utils/utils'
|
|
8
|
-
import { randomUserId } from '@streamr/test-utils'
|
|
9
9
|
|
|
10
10
|
const STREAM_PART_ID = StreamPartIDUtils.parse('test#0')
|
|
11
11
|
|
|
@@ -22,7 +22,7 @@ describe('stream without default entrypoints', () => {
|
|
|
22
22
|
streamPartition: StreamPartIDUtils.getStreamPartition(STREAM_PART_ID),
|
|
23
23
|
timestamp: 666,
|
|
24
24
|
sequenceNumber: 0,
|
|
25
|
-
publisherId:
|
|
25
|
+
publisherId: toUserIdRaw(randomUserId()),
|
|
26
26
|
messageChainId: 'msgChainId'
|
|
27
27
|
},
|
|
28
28
|
previousMessageRef: {
|
|
@@ -86,7 +86,7 @@ describe('stream without default entrypoints', () => {
|
|
|
86
86
|
receivedMessageCount += 1
|
|
87
87
|
})
|
|
88
88
|
await Promise.all([
|
|
89
|
-
|
|
89
|
+
until(() => receivedMessageCount === 1, 10000),
|
|
90
90
|
nodes[1].broadcast(streamMessage)
|
|
91
91
|
])
|
|
92
92
|
})
|
|
@@ -96,7 +96,7 @@ describe('stream without default entrypoints', () => {
|
|
|
96
96
|
receivedMessageCount += 1
|
|
97
97
|
})
|
|
98
98
|
await Promise.all([
|
|
99
|
-
|
|
99
|
+
until(() => receivedMessageCount === 1, 15000),
|
|
100
100
|
nodes[0].join(STREAM_PART_ID),
|
|
101
101
|
nodes[1].broadcast(streamMessage),
|
|
102
102
|
])
|
|
@@ -112,14 +112,14 @@ describe('stream without default entrypoints', () => {
|
|
|
112
112
|
}))
|
|
113
113
|
const nonjoinedNode = nodes[subscriberCount]
|
|
114
114
|
await nonjoinedNode.broadcast(streamMessage)
|
|
115
|
-
await
|
|
115
|
+
await until(() => receivedMessageCount === subscriberCount, 15000)
|
|
116
116
|
}, 45000)
|
|
117
117
|
|
|
118
118
|
it('nodes store themselves as entrypoints on streamPart if number of entrypoints is low', async () => {
|
|
119
119
|
for (let i = 0; i < 10; i++) {
|
|
120
120
|
await nodes[i].join(STREAM_PART_ID, { minCount: (i > 0) ? 1 : 0, timeout: 15000 })
|
|
121
121
|
}
|
|
122
|
-
await
|
|
122
|
+
await until(async () => {
|
|
123
123
|
const entryPointData = await nodes[15].stack.getControlLayerNode().fetchDataFromDht(streamPartIdToDataKey(STREAM_PART_ID))
|
|
124
124
|
return entryPointData.length >= 7
|
|
125
125
|
}, 15000)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LatencyType, Simulator, SimulatorTransport } from '@streamr/dht'
|
|
2
|
-
import { StreamPartIDUtils,
|
|
2
|
+
import { StreamPartIDUtils, until } from '@streamr/utils'
|
|
3
3
|
import { range } from 'lodash'
|
|
4
4
|
import { NetworkStack } from '../../src/NetworkStack'
|
|
5
5
|
import { MAX_NODE_COUNT } from '../../src/logic/PeerDescriptorStoreManager'
|
|
@@ -82,7 +82,7 @@ describe('Stream Entry Points are replaced when known entry points leave streams
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
await Promise.all(initialNodesOnStream.map((node) => node.getContentDeliveryManager().leaveStreamPart(STREAM_PART_ID)))
|
|
85
|
-
await
|
|
85
|
+
await until(() =>
|
|
86
86
|
laterNodesOnStream.every((node) => node.getContentDeliveryManager().getNeighbors(STREAM_PART_ID).length >= 4), 60000, 1000
|
|
87
87
|
)
|
|
88
88
|
|
|
@@ -92,6 +92,6 @@ describe('Stream Entry Points are replaced when known entry points leave streams
|
|
|
92
92
|
randomUserId()
|
|
93
93
|
)
|
|
94
94
|
newNodeInStream.getContentDeliveryManager().broadcast(msg)
|
|
95
|
-
await
|
|
95
|
+
await until(() => receivedMessages === NUM_OF_LATER_NODES, 30000)
|
|
96
96
|
}, 200000)
|
|
97
97
|
})
|
package/test/types/global.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toNodeId } from '@streamr/dht'
|
|
2
|
-
import { StreamPartIDUtils,
|
|
2
|
+
import { StreamPartIDUtils, until } from '@streamr/utils'
|
|
3
3
|
import { ContentDeliveryLayerNode } from '../../src/logic/ContentDeliveryLayerNode'
|
|
4
4
|
import { NodeList } from '../../src/logic/NodeList'
|
|
5
5
|
import { createContentDeliveryLayerNode } from '../../src/logic/createContentDeliveryLayerNode'
|
|
@@ -69,7 +69,7 @@ describe('ContentDeliveryLayerNode', () => {
|
|
|
69
69
|
const peerDescriptor2 = createMockPeerDescriptor()
|
|
70
70
|
discoveryLayerNode.setClosestContacts([peerDescriptor1, peerDescriptor2])
|
|
71
71
|
discoveryLayerNode.emit('nearbyContactAdded', peerDescriptor1)
|
|
72
|
-
await
|
|
72
|
+
await until(() => nearbyNodeView.size() === 2)
|
|
73
73
|
expect(nearbyNodeView.get(toNodeId(peerDescriptor1))).toBeTruthy()
|
|
74
74
|
expect(nearbyNodeView.get(toNodeId(peerDescriptor2))).toBeTruthy()
|
|
75
75
|
})
|
|
@@ -79,7 +79,7 @@ describe('ContentDeliveryLayerNode', () => {
|
|
|
79
79
|
const peerDescriptor2 = createMockPeerDescriptor()
|
|
80
80
|
discoveryLayerNode.setRandomContacts([peerDescriptor1, peerDescriptor2])
|
|
81
81
|
discoveryLayerNode.emit('randomContactAdded', peerDescriptor1)
|
|
82
|
-
await
|
|
82
|
+
await until(() => randomNodeView.size() === 2)
|
|
83
83
|
expect(randomNodeView.get(toNodeId(peerDescriptor1))).toBeTruthy()
|
|
84
84
|
expect(randomNodeView.get(toNodeId(peerDescriptor2))).toBeTruthy()
|
|
85
85
|
})
|
|
@@ -90,7 +90,7 @@ describe('ContentDeliveryLayerNode', () => {
|
|
|
90
90
|
discoveryLayerNode.addNewRandomPeerToKBucket()
|
|
91
91
|
discoveryLayerNode.setClosestContacts([peerDescriptor1, peerDescriptor2])
|
|
92
92
|
discoveryLayerNode.emit('nearbyContactAdded', peerDescriptor1)
|
|
93
|
-
await
|
|
93
|
+
await until(() => {
|
|
94
94
|
return nearbyNodeView.size() === 3
|
|
95
95
|
}, 20000)
|
|
96
96
|
expect(nearbyNodeView.get(toNodeId(peerDescriptor1))).toBeTruthy()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { areEqualPeerDescriptors } from '@streamr/dht'
|
|
2
|
-
import { StreamPartIDUtils,
|
|
2
|
+
import { StreamPartIDUtils, until } from '@streamr/utils'
|
|
3
3
|
import { ContentDeliveryManager } from '../../src/logic/ContentDeliveryManager'
|
|
4
|
-
import { ProxyDirection } from '../../
|
|
4
|
+
import { ProxyDirection } from '../../generated/packages/trackerless-network/protos/NetworkRpc'
|
|
5
5
|
import { MockControlLayerNode } from '../utils/mock/MockControlLayerNode'
|
|
6
6
|
import { MockTransport } from '../utils/mock/MockTransport'
|
|
7
7
|
import { createMockPeerDescriptor, createStreamMessage, mockConnectionLocker } from '../utils/utils'
|
|
@@ -23,7 +23,8 @@ describe('ContentDeliveryManager', () => {
|
|
|
23
23
|
})
|
|
24
24
|
|
|
25
25
|
it('PeerDescriptor is correct', () => {
|
|
26
|
-
|
|
26
|
+
// TODO could use toEqualPeerDescriptor from dht package if we export that custom matcher
|
|
27
|
+
expect(areEqualPeerDescriptors(peerDescriptor, manager.getPeerDescriptor())).toBe(true)
|
|
27
28
|
})
|
|
28
29
|
|
|
29
30
|
describe('join and leave', () => {
|
|
@@ -53,7 +54,7 @@ describe('ContentDeliveryManager', () => {
|
|
|
53
54
|
|
|
54
55
|
it('broadcast joins stream', async () => {
|
|
55
56
|
manager.broadcast(message)
|
|
56
|
-
await
|
|
57
|
+
await until(() => manager.hasStreamPart(streamPartId))
|
|
57
58
|
})
|
|
58
59
|
})
|
|
59
60
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ListeningRpcCommunicator } from '@streamr/dht'
|
|
2
2
|
import { StreamPartIDUtils } from '@streamr/utils'
|
|
3
3
|
import { ContentDeliveryRpcLocal } from '../../src/logic/ContentDeliveryRpcLocal'
|
|
4
|
-
import { LeaveStreamPartNotice } from '../../
|
|
4
|
+
import { LeaveStreamPartNotice } from '../../generated/packages/trackerless-network/protos/NetworkRpc'
|
|
5
5
|
import { MockTransport } from '../utils/mock/MockTransport'
|
|
6
6
|
import { createMockPeerDescriptor, createStreamMessage } from '../utils/utils'
|
|
7
7
|
import { randomUserId } from '@streamr/test-utils'
|
|
@@ -60,10 +60,10 @@ describe('gap handling', () => {
|
|
|
60
60
|
})
|
|
61
61
|
|
|
62
62
|
test('gap division', () => {
|
|
63
|
-
expect(detector.markAndCheck(new NumberPair(15, 0), new NumberPair(18, 0)))
|
|
63
|
+
expect(detector.markAndCheck(new NumberPair(15, 0), new NumberPair(18, 0))).toEqual(true)
|
|
64
64
|
expect(detector.toString()).toEqual('(10|0, 15|0], (18|0, 20|0], (40|0, 80|10], (100|0, Infinity|Infinity]')
|
|
65
65
|
|
|
66
|
-
expect(detector.markAndCheck(new NumberPair(60, 0), new NumberPair(79, 5)))
|
|
66
|
+
expect(detector.markAndCheck(new NumberPair(60, 0), new NumberPair(79, 5))).toEqual(true)
|
|
67
67
|
expect(detector.toString()).toEqual('(10|0, 15|0], (18|0, 20|0], (40|0, 60|0], (79|5, 80|10], (100|0, Infinity|Infinity]')
|
|
68
68
|
})
|
|
69
69
|
|
|
@@ -84,10 +84,10 @@ describe('gap handling', () => {
|
|
|
84
84
|
})
|
|
85
85
|
|
|
86
86
|
test('full contraction', () => {
|
|
87
|
-
expect(detector.markAndCheck(new NumberPair(40, 0), new NumberPair(80, 10)))
|
|
87
|
+
expect(detector.markAndCheck(new NumberPair(40, 0), new NumberPair(80, 10))).toEqual(true)
|
|
88
88
|
expect(detector.toString()).toEqual('(10|0, 20|0], (100|0, Infinity|Infinity]')
|
|
89
89
|
|
|
90
|
-
expect(detector.markAndCheck(new NumberPair(10, 0), new NumberPair(20, 0)))
|
|
90
|
+
expect(detector.markAndCheck(new NumberPair(10, 0), new NumberPair(20, 0))).toEqual(true)
|
|
91
91
|
expect(detector.toString()).toEqual('(100|0, Infinity|Infinity]')
|
|
92
92
|
})
|
|
93
93
|
})
|
|
@@ -153,28 +153,28 @@ describe('erroneous messages that overlap gaps', () => {
|
|
|
153
153
|
})
|
|
154
154
|
|
|
155
155
|
it('completely around gap', () => {
|
|
156
|
-
expect(() => detector.markAndCheck(new NumberPair(5, 0), new NumberPair(30, 0))).
|
|
156
|
+
expect(() => detector.markAndCheck(new NumberPair(5, 0), new NumberPair(30, 0))).toThrow(GapMisMatchError)
|
|
157
157
|
})
|
|
158
158
|
|
|
159
159
|
it('previousNumber below gap while number in gap', () => {
|
|
160
|
-
expect(() => detector.markAndCheck(new NumberPair(5, 0), new NumberPair(15, 0))).
|
|
160
|
+
expect(() => detector.markAndCheck(new NumberPair(5, 0), new NumberPair(15, 0))).toThrow(GapMisMatchError)
|
|
161
161
|
})
|
|
162
162
|
|
|
163
163
|
it('previousNumber in gap while number over gap', () => {
|
|
164
|
-
expect(() => detector.markAndCheck(new NumberPair(15, 0), new NumberPair(20, 5))).
|
|
164
|
+
expect(() => detector.markAndCheck(new NumberPair(15, 0), new NumberPair(20, 5))).toThrow(GapMisMatchError)
|
|
165
165
|
})
|
|
166
166
|
|
|
167
167
|
it('completely around multiple gaps', () => {
|
|
168
|
-
expect(() => detector.markAndCheck(new NumberPair(10, 0), new NumberPair(200, 0))).
|
|
168
|
+
expect(() => detector.markAndCheck(new NumberPair(10, 0), new NumberPair(200, 0))).toThrow(GapMisMatchError)
|
|
169
169
|
})
|
|
170
170
|
})
|
|
171
171
|
|
|
172
172
|
test('checks that number > previousNumber', () => {
|
|
173
173
|
const detector = new DuplicateMessageDetector()
|
|
174
174
|
expect(() => detector.markAndCheck(new NumberPair(5, 0), new NumberPair(1, 0)))
|
|
175
|
-
.
|
|
175
|
+
.toThrow(InvalidNumberingError)
|
|
176
176
|
expect(() => detector.markAndCheck(new NumberPair(5, 5), new NumberPair(5, 5)))
|
|
177
|
-
.
|
|
177
|
+
.toThrow(InvalidNumberingError)
|
|
178
178
|
})
|
|
179
179
|
|
|
180
180
|
test('lowest gaps get dropped when reaching maximum number of gaps', () => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Message } from '@streamr/dht'
|
|
2
2
|
import { ExternalNetworkRpc, SERVICE_ID } from '../../src/logic/ExternalNetworkRpc'
|
|
3
|
-
import { HandshakeRequest, HandshakeResponse } from '../../
|
|
3
|
+
import { HandshakeRequest, HandshakeResponse } from '../../generated/packages/dht/protos/DhtRpc'
|
|
4
4
|
import { MockTransport } from '../utils/mock/MockTransport'
|
|
5
5
|
import { RpcMessage } from '@streamr/proto-rpc'
|
|
6
|
-
import { Any } from '../../
|
|
7
|
-
import { HandshakeRpcClient } from '../../
|
|
6
|
+
import { Any } from '../../generated/google/protobuf/any'
|
|
7
|
+
import { HandshakeRpcClient } from '../../generated/packages/trackerless-network/protos/NetworkRpc.client'
|
|
8
8
|
|
|
9
9
|
describe('ExternalNetworkRpc', () => {
|
|
10
10
|
|
|
@@ -2,7 +2,7 @@ import { DhtAddress, NodeType, toNodeId, toDhtAddressRaw } from '@streamr/dht'
|
|
|
2
2
|
import { StreamPartIDUtils } from '@streamr/utils'
|
|
3
3
|
import { NodeList } from '../../src/logic/NodeList'
|
|
4
4
|
import { HandshakeRpcLocal } from '../../src/logic/neighbor-discovery/HandshakeRpcLocal'
|
|
5
|
-
import { InterleaveRequest, StreamPartHandshakeRequest } from '../../
|
|
5
|
+
import { InterleaveRequest, StreamPartHandshakeRequest } from '../../generated/packages/trackerless-network/protos/NetworkRpc'
|
|
6
6
|
import { createMockContentDeliveryRpcRemote, createMockHandshakeRpcRemote, createMockPeerDescriptor } from '../utils/utils'
|
|
7
7
|
|
|
8
8
|
const STREAM_PART_ID = StreamPartIDUtils.parse('stream#0')
|
|
@@ -96,19 +96,6 @@ describe('HandshakeRpcLocal', () => {
|
|
|
96
96
|
expect(handshakeWithInterleaving).toHaveBeenCalledTimes(1)
|
|
97
97
|
})
|
|
98
98
|
|
|
99
|
-
it('handshakeWithInterleaving success', async () => {
|
|
100
|
-
const req: InterleaveRequest = {
|
|
101
|
-
interleaveTargetDescriptor: {
|
|
102
|
-
nodeId: toDhtAddressRaw('0x2222' as DhtAddress),
|
|
103
|
-
type: NodeType.NODEJS
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
await rpcLocal.interleaveRequest(req, {
|
|
107
|
-
incomingSourceDescriptor: createMockPeerDescriptor()
|
|
108
|
-
} as any)
|
|
109
|
-
expect(handshakeWithInterleaving).toHaveBeenCalledTimes(1)
|
|
110
|
-
})
|
|
111
|
-
|
|
112
99
|
it('rejects handshakes if interleaving to the requestor is ongoing', async () => {
|
|
113
100
|
neighbors.add(createMockContentDeliveryRpcRemote())
|
|
114
101
|
neighbors.add(createMockContentDeliveryRpcRemote())
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InspectSession, Events } from '../../src/logic/inspect/InspectSession'
|
|
2
|
-
import { MessageID } from '../../
|
|
2
|
+
import { MessageID } from '../../generated/packages/trackerless-network/protos/NetworkRpc'
|
|
3
3
|
import { waitForEvent3 } from '../../../utils/dist/src/waitForEvent3'
|
|
4
4
|
import { utf8ToBinary } from '@streamr/utils'
|
|
5
5
|
import { DhtAddress, randomDhtAddress } from '@streamr/dht'
|
|
@@ -52,6 +52,7 @@ describe('InspectSession', () => {
|
|
|
52
52
|
inspectSession.markMessage(anotherNode, messageId1)
|
|
53
53
|
await Promise.all([
|
|
54
54
|
waitForEvent3<Events>(inspectSession, 'done', 100),
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
55
56
|
inspectSession.markMessage(inspectedNode, messageId1)
|
|
56
57
|
])
|
|
57
58
|
expect(inspectSession.getInspectedMessageCount()).toBe(1)
|
|
@@ -61,6 +62,7 @@ describe('InspectSession', () => {
|
|
|
61
62
|
inspectSession.markMessage(inspectedNode, messageId1)
|
|
62
63
|
await Promise.all([
|
|
63
64
|
waitForEvent3<Events>(inspectSession, 'done', 100),
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
64
66
|
inspectSession.markMessage(anotherNode, messageId1)
|
|
65
67
|
])
|
|
66
68
|
expect(inspectSession.getInspectedMessageCount()).toBe(1)
|
|
@@ -71,6 +73,7 @@ describe('InspectSession', () => {
|
|
|
71
73
|
await expect(async () => {
|
|
72
74
|
await Promise.all([
|
|
73
75
|
waitForEvent3<Events>(inspectSession, 'done', 100),
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
74
77
|
inspectSession.markMessage(anotherNode, messageId2)
|
|
75
78
|
])
|
|
76
79
|
}).rejects.toThrow('waitForEvent3')
|
|
@@ -45,7 +45,7 @@ describe('Inspector', () => {
|
|
|
45
45
|
}, 250)
|
|
46
46
|
await inspector.inspect(inspectedDescriptor)
|
|
47
47
|
expect(inspector.isInspected(toNodeId(inspectedDescriptor))).toBe(false)
|
|
48
|
-
expect(mockConnect).
|
|
48
|
+
expect(mockConnect).toHaveBeenCalledTimes(1)
|
|
49
49
|
})
|
|
50
50
|
|
|
51
51
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NeighborFinder } from '../../src/logic/neighbor-discovery/NeighborFinder'
|
|
2
2
|
import { NodeList } from '../../src/logic/NodeList'
|
|
3
|
-
import {
|
|
3
|
+
import { until } from '@streamr/utils'
|
|
4
4
|
import { range } from 'lodash'
|
|
5
5
|
import { expect } from 'expect'
|
|
6
6
|
import { createMockContentDeliveryRpcRemote } from '../utils/utils'
|
|
@@ -45,7 +45,7 @@ describe('NeighborFinder', () => {
|
|
|
45
45
|
|
|
46
46
|
it('Finds target number of nodes', async () => {
|
|
47
47
|
neighborFinder.start()
|
|
48
|
-
await
|
|
48
|
+
await until(() => neighbors.size() >= minCount, 10000)
|
|
49
49
|
expect(neighborFinder.isRunning()).toEqual(false)
|
|
50
50
|
})
|
|
51
51
|
})
|
|
@@ -5,7 +5,7 @@ import { ContentDeliveryRpcRemote } from '../../src/logic/ContentDeliveryRpcRemo
|
|
|
5
5
|
import { NodeList } from '../../src/logic/NodeList'
|
|
6
6
|
import { NeighborFinder } from '../../src/logic/neighbor-discovery/NeighborFinder'
|
|
7
7
|
import { NeighborUpdateRpcLocal } from '../../src/logic/neighbor-discovery/NeighborUpdateRpcLocal'
|
|
8
|
-
import { ContentDeliveryRpcClient } from '../../
|
|
8
|
+
import { ContentDeliveryRpcClient } from '../../generated/packages/trackerless-network/protos/NetworkRpc.client'
|
|
9
9
|
import { MockTransport } from '../utils/mock/MockTransport'
|
|
10
10
|
import { createMockPeerDescriptor } from '../utils/utils'
|
|
11
11
|
|
|
@@ -3,7 +3,7 @@ import { EventEmitter } from 'eventemitter3'
|
|
|
3
3
|
import { NetworkNode } from '../../src/NetworkNode'
|
|
4
4
|
import { NetworkStack } from '../../src/NetworkStack'
|
|
5
5
|
import { Events } from '../../src/logic/ContentDeliveryManager'
|
|
6
|
-
import { StreamMessage } from '../../
|
|
6
|
+
import { StreamMessage } from '../../generated/packages/trackerless-network/protos/NetworkRpc'
|
|
7
7
|
import { createStreamMessage } from '../utils/utils'
|
|
8
8
|
import { randomUserId } from '@streamr/test-utils'
|
|
9
9
|
|
|
@@ -33,10 +33,10 @@ describe('NetworkNode', () => {
|
|
|
33
33
|
contentDeliveryManager.emit('newMessage', msg2)
|
|
34
34
|
expect(onMessage.mock.calls[0][0]).toEqual(msg1)
|
|
35
35
|
expect(onMessage.mock.calls[1][0]).toEqual(msg2)
|
|
36
|
-
expect(onMessage).
|
|
36
|
+
expect(onMessage).toHaveBeenCalledTimes(2)
|
|
37
37
|
|
|
38
38
|
node.removeMessageListener(onMessage)
|
|
39
39
|
contentDeliveryManager.emit('newMessage', createMessage(3))
|
|
40
|
-
expect(onMessage).
|
|
40
|
+
expect(onMessage).toHaveBeenCalledTimes(2)
|
|
41
41
|
})
|
|
42
42
|
})
|
|
@@ -11,7 +11,7 @@ import { expect } from 'expect'
|
|
|
11
11
|
import { ContentDeliveryRpcRemote } from '../../src/logic/ContentDeliveryRpcRemote'
|
|
12
12
|
import { NodeList } from '../../src/logic/NodeList'
|
|
13
13
|
import { formStreamPartContentDeliveryServiceId } from '../../src/logic/formStreamPartDeliveryServiceId'
|
|
14
|
-
import { ContentDeliveryRpcClient } from '../../
|
|
14
|
+
import { ContentDeliveryRpcClient } from '../../generated/packages/trackerless-network/protos/NetworkRpc.client'
|
|
15
15
|
import { MockTransport } from '../utils/mock/MockTransport'
|
|
16
16
|
import { createMockContentDeliveryRpcRemote, createMockPeerDescriptor } from '../utils/utils'
|
|
17
17
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PeerDescriptor, areEqualPeerDescriptors, randomDhtAddress } from '@streamr/dht'
|
|
2
2
|
import { wait } from '@streamr/utils'
|
|
3
3
|
import { PeerDescriptorStoreManager } from '../../src/logic/PeerDescriptorStoreManager'
|
|
4
|
-
import { Any } from '../../
|
|
5
|
-
import { DataEntry } from '../../
|
|
4
|
+
import { Any } from '../../generated/google/protobuf/any'
|
|
5
|
+
import { DataEntry } from '../../generated/packages/dht/protos/DhtRpc'
|
|
6
6
|
import { createMockPeerDescriptor } from '../utils/utils'
|
|
7
7
|
|
|
8
8
|
const KEY = randomDhtAddress()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DhtAddress } from '@streamr/dht'
|
|
2
|
-
import { hexToBinary, wait } from '@streamr/utils'
|
|
2
|
+
import { hexToBinary, toUserIdRaw, wait } from '@streamr/utils'
|
|
3
3
|
import { Propagation } from '../../src/logic/propagation/Propagation'
|
|
4
4
|
import {
|
|
5
5
|
ContentType,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
MessageID,
|
|
8
8
|
SignatureType,
|
|
9
9
|
StreamMessage
|
|
10
|
-
} from '../../
|
|
10
|
+
} from '../../generated/packages/trackerless-network/protos/NetworkRpc'
|
|
11
11
|
import { randomUserId } from '@streamr/test-utils'
|
|
12
12
|
|
|
13
13
|
const PUBLISHER_ID = randomUserId()
|
|
@@ -19,7 +19,7 @@ function makeMsg(streamId: string, partition: number, ts: number, msgNo: number)
|
|
|
19
19
|
timestamp: ts,
|
|
20
20
|
sequenceNumber: msgNo,
|
|
21
21
|
messageChainId: 'msgChain',
|
|
22
|
-
publisherId:
|
|
22
|
+
publisherId: toUserIdRaw(PUBLISHER_ID)
|
|
23
23
|
}
|
|
24
24
|
return {
|
|
25
25
|
messageId,
|
|
@@ -45,7 +45,7 @@ const N4 = 'n4' as DhtAddress
|
|
|
45
45
|
const N5 = 'n5' as DhtAddress
|
|
46
46
|
|
|
47
47
|
describe(Propagation, () => {
|
|
48
|
-
let getNeighbors: jest.Mock<
|
|
48
|
+
let getNeighbors: jest.Mock<readonly DhtAddress[], [string]>
|
|
49
49
|
let sendToNeighbor: jest.Mock<Promise<void>, [DhtAddress, StreamMessage]>
|
|
50
50
|
let propagation: Propagation
|
|
51
51
|
|
|
@@ -2,8 +2,8 @@ import { RpcCommunicator } from '@streamr/proto-rpc'
|
|
|
2
2
|
import { randomUserId } from '@streamr/test-utils'
|
|
3
3
|
import { hexToBinary } from '@streamr/utils'
|
|
4
4
|
import { ProxyConnectionRpcRemote } from '../../src/logic/proxy/ProxyConnectionRpcRemote'
|
|
5
|
-
import { ProxyConnectionRequest, ProxyDirection } from '../../
|
|
6
|
-
import { ProxyConnectionRpcClient } from '../../
|
|
5
|
+
import { ProxyConnectionRequest, ProxyDirection } from '../../generated/packages/trackerless-network/protos/NetworkRpc'
|
|
6
|
+
import { ProxyConnectionRpcClient } from '../../generated/packages/trackerless-network/protos/NetworkRpc.client'
|
|
7
7
|
import { createMockPeerDescriptor } from '../utils/utils'
|
|
8
8
|
|
|
9
9
|
describe('ProxyConnectionRpcRemote', () => {
|
|
@@ -2,7 +2,7 @@ import { PeerDescriptorStoreManager } from '../../src/logic/PeerDescriptorStoreM
|
|
|
2
2
|
import { StreamPartReconnect } from '../../src/logic/StreamPartReconnect'
|
|
3
3
|
import { MockDiscoveryLayerNode } from '../utils/mock/MockDiscoveryLayerNode'
|
|
4
4
|
import { createFakePeerDescriptorStoreManager } from '../utils/fake/FakePeerDescriptorStoreManager'
|
|
5
|
-
import {
|
|
5
|
+
import { until } from '@streamr/utils'
|
|
6
6
|
|
|
7
7
|
describe('StreamPartReconnect', () => {
|
|
8
8
|
|
|
@@ -24,7 +24,7 @@ describe('StreamPartReconnect', () => {
|
|
|
24
24
|
await streamPartReconnect.reconnect(1000)
|
|
25
25
|
expect(streamPartReconnect.isRunning()).toEqual(true)
|
|
26
26
|
discoveryLayerNode.addNewRandomPeerToKBucket()
|
|
27
|
-
await
|
|
27
|
+
await until(() => streamPartReconnect.isRunning() === false)
|
|
28
28
|
})
|
|
29
29
|
|
|
30
30
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Methods } from '@streamr/test-utils'
|
|
2
2
|
import { NeighborUpdateManager } from '../../../src/logic/neighbor-discovery/NeighborUpdateManager'
|
|
3
|
-
import { NeighborUpdate } from '../../../
|
|
3
|
+
import { NeighborUpdate } from '../../../generated/packages/trackerless-network/protos/NetworkRpc'
|
|
4
4
|
|
|
5
5
|
export class MockNeighborUpdateManager implements Methods<NeighborUpdateManager> {
|
|
6
6
|
|
package/test/utils/utils.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
toDhtAddressRaw
|
|
11
11
|
} from '@streamr/dht'
|
|
12
12
|
import { RpcCommunicator } from '@streamr/proto-rpc'
|
|
13
|
-
import { StreamPartID, StreamPartIDUtils, UserID, hexToBinary, utf8ToBinary } from '@streamr/utils'
|
|
13
|
+
import { StreamPartID, StreamPartIDUtils, UserID, hexToBinary, toUserIdRaw, utf8ToBinary } from '@streamr/utils'
|
|
14
14
|
import { NetworkNode, createNetworkNode } from '../../src/NetworkNode'
|
|
15
15
|
import { ContentDeliveryLayerNode } from '../../src/logic/ContentDeliveryLayerNode'
|
|
16
16
|
import { ContentDeliveryRpcRemote } from '../../src/logic/ContentDeliveryRpcRemote'
|
|
@@ -23,8 +23,8 @@ import {
|
|
|
23
23
|
MessageID,
|
|
24
24
|
SignatureType,
|
|
25
25
|
StreamMessage
|
|
26
|
-
} from '../../
|
|
27
|
-
import { ContentDeliveryRpcClient, HandshakeRpcClient } from '../../
|
|
26
|
+
} from '../../generated/packages/trackerless-network/protos/NetworkRpc'
|
|
27
|
+
import { ContentDeliveryRpcClient, HandshakeRpcClient } from '../../generated/packages/trackerless-network/protos/NetworkRpc.client'
|
|
28
28
|
|
|
29
29
|
export const mockConnectionLocker: ConnectionLocker = {
|
|
30
30
|
lockConnection: () => {},
|
|
@@ -50,7 +50,8 @@ export const createMockContentDeliveryLayerNodeAndDhtNode = async (
|
|
|
50
50
|
peerDescriptor: localPeerDescriptor,
|
|
51
51
|
numberOfNodesPerKBucket: 4,
|
|
52
52
|
entryPoints: [entryPointDescriptor],
|
|
53
|
-
rpcRequestTimeout: 5000
|
|
53
|
+
rpcRequestTimeout: 5000,
|
|
54
|
+
neighborPingLimit: 16
|
|
54
55
|
})
|
|
55
56
|
const contentDeliveryLayerNode = createContentDeliveryLayerNode({
|
|
56
57
|
streamPartId,
|
|
@@ -76,7 +77,7 @@ export const createStreamMessage = (
|
|
|
76
77
|
streamPartition: StreamPartIDUtils.getStreamPartition(streamPartId),
|
|
77
78
|
sequenceNumber: sequenceNumber ?? 0,
|
|
78
79
|
timestamp: timestamp ?? Date.now(),
|
|
79
|
-
publisherId:
|
|
80
|
+
publisherId: toUserIdRaw(publisherId),
|
|
80
81
|
messageChainId: 'messageChain0',
|
|
81
82
|
}
|
|
82
83
|
const msg: StreamMessage = {
|
package/tsconfig.browser.json
CHANGED