Skip to content

Commit 5da08f7

Browse files
eabaAaronontheweb
andauthored
[Obsolete] RunScript (#6623)
* [Obsolete] `RunScript` * fixes * more fix: Change ` RandomTestRange(Sys).ForEach` to RandomTestRange(Sys).Select` * skip racy `TickSourceSpec` (#6566) this spec is designed just fine, but the problem is that we can't guarantee this level of precision for each of the `ExpectNoMsg` calls. --------- Co-authored-by: Aaron Stannard <[email protected]>
1 parent 0a8e843 commit 5da08f7

7 files changed

+18
-14
lines changed

src/core/Akka.Streams.Tests/Dsl/FlowGroupedWithinSpec.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public void A_GroupedWithin_must_group_early()
232232
}).ToArray());
233233

234234
RandomTestRange(Sys)
235-
.ForEach(_ => RunScript(script, Settings, flow => flow.GroupedWithin(3, TimeSpan.FromMinutes(10))));
235+
.Select(async _ => await RunScriptAsync(script, Settings, flow => flow.GroupedWithin(3, TimeSpan.FromMinutes(10))));
236236
}
237237

238238
[Fact]
@@ -255,7 +255,7 @@ public void A_GroupedWithin_must_group_with_rest()
255255
};
256256

257257
RandomTestRange(Sys)
258-
.ForEach(_ => RunScript(script(), Settings, flow => flow.GroupedWithin(3, TimeSpan.FromMinutes(10))));
258+
.Select(async _ => await RunScriptAsync(script(), Settings, flow => flow.GroupedWithin(3, TimeSpan.FromMinutes(10))));
259259
}
260260

261261
[Fact(Skip = "Skipped for async_testkit conversion build")]

src/core/Akka.Streams.Tests/Dsl/FlowSelectManySpec.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System.Collections.Generic;
1010
using System.Linq;
1111
using System.Threading;
12+
using System.Threading.Tasks;
1213
using Akka.Streams.Dsl;
1314
using Akka.Streams.Supervision;
1415
using Akka.Streams.TestKit;
@@ -31,7 +32,7 @@ public FlowSelectManySpec(ITestOutputHelper output) : base(output)
3132
}
3233

3334
[Fact]
34-
public void SelectMany_should_map_and_concat()
35+
public async Task SelectMany_should_map_and_concat()
3536
{
3637
var script = Script.Create(
3738
(new[] { 0 }, new int[0]),
@@ -43,7 +44,7 @@ public void SelectMany_should_map_and_concat()
4344

4445
var random = ThreadLocalRandom.Current.Next(1, 10);
4546
for (int i = 0; i < random; i++)
46-
RunScript(script, Settings, a => a.SelectMany(x => Enumerable.Range(1, x).Select(_ => x)));
47+
await RunScriptAsync(script, Settings, a => a.SelectMany(x => Enumerable.Range(1, x).Select(_ => x)));
4748
}
4849

4950
[Fact]

src/core/Akka.Streams.Tests/Dsl/FlowSelectSpec.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System;
99
using System.Collections.Generic;
1010
using System.Linq;
11+
using System.Threading.Tasks;
1112
using Akka.Streams.Dsl;
1213
using Akka.Streams.TestKit;
1314
using Akka.Util;
@@ -31,7 +32,7 @@ public FlowSelectSpec(ITestOutputHelper output) : base(output)
3132
}
3233

3334
[Fact]
34-
public void Select_should_select()
35+
public async Task Select_should_select()
3536
{
3637

3738
var script = Script.Create(Enumerable.Range(1, ThreadLocalRandom.Current.Next(1, 10)).Select(_ =>
@@ -43,7 +44,7 @@ public void Select_should_select()
4344
var n = ThreadLocalRandom.Current.Next(10);
4445
for (int i = 0; i < n; i++)
4546
{
46-
RunScript(script, _settings, x => x.Select(y => y.ToString()));
47+
await RunScriptAsync(script, _settings, x => x.Select(y => y.ToString()));
4748
}
4849
}
4950

src/core/Akka.Streams.Tests/Dsl/FlowSkipSpec.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System;
99
using System.Collections.Generic;
1010
using System.Linq;
11+
using System.Threading.Tasks;
1112
using Akka.Streams.Dsl;
1213
using Akka.Streams.TestKit;
1314
using Xunit;
@@ -28,7 +29,7 @@ public FlowSkipSpec(ITestOutputHelper helper) : base(helper)
2829
}
2930

3031
[Fact]
31-
public void A_Skip_must_skip()
32+
public async Task A_Skip_must_skip()
3233
{
3334
Func<long, Script<int, int>> script =
3435
d => Script.Create(RandomTestRange(Sys)
@@ -38,7 +39,7 @@ public void A_Skip_must_skip()
3839
foreach (var _ in RandomTestRange(Sys))
3940
{
4041
var d = Math.Min(Math.Max(random.Next(-10, 60), 0), 50);
41-
RunScript(script(d), Settings, f => f.Skip(d));
42+
await RunScriptAsync(script(d), Settings, f => f.Skip(d));
4243
}
4344
}
4445

src/core/Akka.Streams.Tests/Dsl/FlowStatefulSelectManySpec.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ public void A_StatefulSelectMany_must_work_in_happy_case()
4545
return Script.Create(phases);
4646
};
4747

48-
RandomTestRange(Sys).ForEach(_ =>
48+
RandomTestRange(Sys).Select(async _ =>
4949
{
50-
RunScript(script(), Materializer.Settings, flow => flow.StatefulSelectMany<int,int,int, NotUsed>(() =>
50+
await RunScriptAsync(script(), Materializer.Settings, flow => flow.StatefulSelectMany<int,int,int, NotUsed>(() =>
5151
{
5252
int? prev = null;
5353
return (x =>

src/core/Akka.Streams.Tests/Dsl/FlowTakeSpec.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System;
99
using System.Collections.Generic;
1010
using System.Linq;
11+
using System.Threading.Tasks;
1112
using Akka.Streams.Actors;
1213
using Akka.Streams.Dsl;
1314
using Akka.Streams.Implementation;
@@ -38,10 +39,10 @@ public void A_Take_must_take()
3839
Func<int, Script<int, int>> script =
3940
d => Script.Create(RandomTestRange(Sys).Select(n => ((ICollection<int>)new[] { n }, (ICollection<int>)(n > d ? new int[]{ } : new[] { n }))).ToArray());
4041
var random = new Random();
41-
RandomTestRange(Sys).ForEach(_ =>
42+
RandomTestRange(Sys).Select(async _ =>
4243
{
4344
var d = Math.Min(Math.Max(random.Next(-10, 60), 0), 50);
44-
RunScript(script(d), Materializer.Settings, f => f.Take(d));
45+
await RunScriptAsync(script(d), Materializer.Settings, f => f.Take(d));
4546
});
4647
}
4748

src/core/Akka.Streams.Tests/Dsl/FlowWhereSpec.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void A_Where_must_filter()
4242
return ((ICollection<int>)new[] { x }, (ICollection<int>)((x & 1) == 0 ? new[] { x } : new int[] { }));
4343
}).ToArray());
4444

45-
RandomTestRange(Sys).ForEach(_ => RunScript(script, Settings, flow => flow.Where(x => x%2 == 0)));
45+
RandomTestRange(Sys).Select(async _ => await RunScriptAsync(script, Settings, flow => flow.Where(x => x%2 == 0)));
4646
}
4747

4848
[Fact]
@@ -96,7 +96,7 @@ public void A_WhereNot_must_filter_based_on_inverted_predicate()
9696
return ((ICollection<int>)new[] { x }, (ICollection<int>)((x & 1) == 1 ? new[] { x } : new int[] { }));
9797
}).ToArray());
9898

99-
RandomTestRange(Sys).ForEach(_ => RunScript(script, Settings, flow => flow.WhereNot(x => x % 2 == 0)));
99+
RandomTestRange(Sys).Select(async _ => await RunScriptAsync(script, Settings, flow => flow.WhereNot(x => x % 2 == 0)));
100100
}
101101
}
102102
}

0 commit comments

Comments
 (0)