makes integration tests using two client nodes

This commit is contained in:
Marcin Czenko 2025-03-12 15:50:01 +01:00
parent 040341b796
commit 6e18aefe13
No known key found for this signature in database
GPG Key ID: 33DEA0C8E30937C0

View File

@ -58,7 +58,7 @@ twonodessuite "BitTorrent API":
test "uploading and downloading the content", twoNodesConfig:
let exampleContent = exampleString(100)
let infoHash = client1.uploadTorrent(exampleContent).tryGet
let downloadedContent = client1.downloadTorrent(infoHash).tryGet
let downloadedContent = client2.downloadTorrent(infoHash).tryGet
check downloadedContent == exampleContent
test "uploading and downloading the content (exactly one piece long)", twoNodesConfig:
@ -68,7 +68,7 @@ twonodessuite "BitTorrent API":
)
let infoHash = client1.uploadTorrent(bytes).tryGet
let downloadedContent = client1.downloadTorrent(infoHash).tryGet
let downloadedContent = client2.downloadTorrent(infoHash).tryGet
check downloadedContent.toBytes == bytes
test "uploading and downloading the content (exactly two pieces long)", twoNodesConfig:
@ -78,7 +78,7 @@ twonodessuite "BitTorrent API":
)
let infoHash = client1.uploadTorrent(bytes).tryGet
let downloadedContent = client1.downloadTorrent(infoHash).tryGet
let downloadedContent = client2.downloadTorrent(infoHash).tryGet
check downloadedContent.toBytes == bytes
# use with debugging to see the content
@ -100,14 +100,14 @@ twonodessuite "BitTorrent API":
content = exampleContent.toBytes, name = some exampleFileName
).tryGet
let restTorrentContent = client1.downloadTorrentManifestOnly(infoHash).tryGet
let restTorrentContent = client2.downloadTorrentManifestOnly(infoHash).tryGet
let torrentManifest = restTorrentContent.torrentManifest
let info = torrentManifest.info
check info == expectedInfo
let response =
client1.downloadManifestOnly(cid = torrentManifest.codexManifestCid).tryGet
client2.downloadManifestOnly(cid = torrentManifest.codexManifestCid).tryGet
let restContent = RestContent.fromJson(response).tryGet