From 71b061cac79d1a7b4c58b15857ef25ecdf0cb3ec Mon Sep 17 00:00:00 2001 From: Corbo12 Date: Thu, 20 Apr 2023 14:16:04 +0200 Subject: [PATCH] MDF threaded functions not running correctly --- Tests/BasicTests/ParallelTests.cs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Tests/BasicTests/ParallelTests.cs b/Tests/BasicTests/ParallelTests.cs index c80eba2..c9c13b9 100644 --- a/Tests/BasicTests/ParallelTests.cs +++ b/Tests/BasicTests/ParallelTests.cs @@ -1,7 +1,6 @@ using CodexDistTestCore; using CodexDistTestCore.Config; using NUnit.Framework; - namespace Tests.ParallelTests { [TestFixture] @@ -10,15 +9,15 @@ namespace Tests.ParallelTests [Test] public void TwoNodeDownloads() { - ParallelDownload(2, 64.MB()); + ParallelDownload(3, 64.MB()); } [Test] - public void FiveNodeDownloads() + public void FourNodeDownloads() { ParallelDownload(5, 1000.MB()); } [Test] - public void TenNodeDownloads() + public void NineNodeDownloads() { ParallelDownload(10, 16.MB()); } @@ -45,9 +44,10 @@ namespace Tests.ParallelTests for (int i = 1; i < numberOfNodes; i++) { - new Task(() => { download(contentId, group[i], testFile); }).Start(); + // new Task(() => { download(contentId, group[i], testFile); }).Start(); + download(contentId, group[i], testFile); } - Task.WaitAll(); + // Task.WaitAll(); } } @@ -55,9 +55,9 @@ namespace Tests.ParallelTests public class UploadTests : DistTest { [Test] - public void TwoNodeUploads() + public void ThreeNodeUploads() { - ParallelUpload(2, 64.MB()); + ParallelUpload(3, 64.MB()); } [Test] public void FiveNodeUploads() @@ -84,14 +84,16 @@ namespace Tests.ParallelTests for (int i = 1; i < numberOfNodes; i++) { testfiles.Add(GenerateTestFile(filesize)); - new Task(() => { upload(host, testfiles[i - 1], contentIds, i - 1); }).Start(); + // new Task(() => { upload(host, testfiles[i - 1], contentIds, i - 1); }).Start(); + upload(host, testfiles[i - 1], contentIds, i - 1); } - Task.WaitAll(); + // Task.WaitAll(); for (int i = 0; i < testfiles.Count; i++) { - new Task(() => { download(contentIds[i], group[i + 1], testfiles[i]); }).Start(); + // new Task(() => { download(contentIds[i], group[i + 1], testfiles[i]); }).Start(); + download(contentIds[i], group[i + 1], testfiles[i]); } - Task.WaitAll(); + // Task.WaitAll(); } void download(ContentId contentId, CodexDistTestCore.IOnlineCodexNode node, TestFile testFile)