Skip to content

Commit 8370663

Browse files
Alex McCooljdom
Alex McCool
authored andcommittedFeb 10, 2017
Remove more usages of TestingSiloHost in tests (dotnet#2718)
Remove unused BaseClusterFixture
1 parent c1a2f3e commit 8370663

File tree

3 files changed

+31
-47
lines changed

3 files changed

+31
-47
lines changed
 

‎test/TesterInternal/GeoClusterTests/BasicLogTestGrainTests.cs

+31-17
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
using System.IO;
33
using System.Threading.Tasks;
44
using System.Collections.Generic;
5+
using Orleans;
6+
using Orleans.Runtime;
7+
using Orleans.Runtime.Configuration;
58
using UnitTests.GrainInterfaces;
69
using Orleans.TestingHost;
710
using Xunit;
@@ -10,28 +13,39 @@
1013

1114
namespace Tests.GeoClusterTests
1215
{
13-
public class BasicLogTestGrainTests : TestingSiloHost
16+
public class BasicLogTestGrainTests : IClassFixture<BasicLogTestGrainTests.Fixture>
1417
{
18+
private readonly Fixture fixture;
19+
private Random random;
20+
21+
public class Fixture : BaseTestClusterFixture
22+
{
23+
protected override TestCluster CreateTestCluster()
24+
{
25+
var options = new TestClusterOptions(1);
26+
27+
options.ClusterConfiguration.AddMemoryStorageProvider("Default");
28+
options.ClusterConfiguration.AddMemoryStorageProvider("MemoryStore");
29+
options.ClusterConfiguration.AddAzureTableStorageProvider("AzureStore");
1530

31+
options.ClusterConfiguration.AddAzureTableStorageProvider();
32+
options.ClusterConfiguration.AddStateStorageBasedLogConsistencyProvider();
33+
options.ClusterConfiguration.AddLogStorageBasedLogConsistencyProvider();
34+
options.ClusterConfiguration.AddCustomStorageInterfaceBasedLogConsistencyProvider("CustomStorage");
1635

17-
public BasicLogTestGrainTests() :
18-
base(
19-
new TestingSiloOptions
20-
{
21-
StartFreshOrleans = true,
22-
StartPrimary = true,
23-
StartSecondary = false,
24-
SiloConfigFile = new FileInfo("OrleansConfigurationForTesting.xml"),
25-
AdjustConfig = cfg => LogConsistencyProviderConfiguration.ConfigureLogConsistencyProvidersForTesting(TestDefaultConfiguration.DataConnectionString,cfg)
26-
}
27-
)
36+
options.ClusterConfiguration.AddCustomStorageInterfaceBasedLogConsistencyProvider("CustomStoragePrimaryCluster", "A");
2837

38+
options.ClusterConfiguration.ApplyToAllNodes(o=>o.TraceLevelOverrides.Add(new Tuple<string, Severity>("LogViews", Severity.Verbose2)));
39+
40+
return new TestCluster(options);
41+
}
42+
}
43+
public BasicLogTestGrainTests(Fixture fixture)
2944
{
45+
this.fixture = fixture;
3046
this.random = new Random();
3147
}
3248

33-
private Random random;
34-
3549
[Fact, TestCategory("GeoCluster")]
3650
public async Task DefaultStorage()
3751
{
@@ -81,7 +95,7 @@ private async Task ThreeCheckers(string grainClass, int phases)
8195
Func<Task> checker1 = async () =>
8296
{
8397
int x = GetRandom();
84-
var grain = GrainFactory.GetGrain<ILogTestGrain>(x, grainClass);
98+
var grain = this.fixture.GrainFactory.GetGrain<ILogTestGrain>(x, grainClass);
8599
await grain.SetAGlobal(x);
86100
int a = await grain.GetAGlobal();
87101
Assert.Equal(x, a); // value of A survive grain call
@@ -92,7 +106,7 @@ private async Task ThreeCheckers(string grainClass, int phases)
92106
Func<Task> checker2 = async () =>
93107
{
94108
int x = GetRandom();
95-
var grain = GrainFactory.GetGrain<ILogTestGrain>(x, grainClass);
109+
var grain = this.fixture.GrainFactory.GetGrain<ILogTestGrain>(x, grainClass);
96110
Assert.Equal(0, await grain.GetConfirmedVersion());
97111
await grain.SetALocal(x);
98112
int a = await grain.GetALocal();
@@ -104,7 +118,7 @@ private async Task ThreeCheckers(string grainClass, int phases)
104118
{
105119
// Local then Global
106120
int x = GetRandom();
107-
var grain = GrainFactory.GetGrain<ILogTestGrain>(x, grainClass);
121+
var grain = this.fixture.GrainFactory.GetGrain<ILogTestGrain>(x, grainClass);
108122
await grain.SetALocal(x);
109123
int a = await grain.GetAGlobal();
110124
Assert.Equal(x, a);

‎test/TesterInternal/HostedTestClusterBase.cs

-29
This file was deleted.

‎test/TesterInternal/TesterInternal.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
<Compile Include="ErrorInjectionStorageProvider.cs" />
5353
<Compile Include="GatewaySelectionTest.cs" />
5454
<Compile Include="GeoClusterTests\MultiClusterRegistrationTests.cs" />
55-
<Compile Include="HostedTestClusterBase.cs" />
5655
<Compile Include="MembershipTests\ClientIdPartitionDataRebuildTests.cs" />
5756
<Compile Include="StorageTests\CommonStorageTests.cs" />
5857
<Compile Include="StorageTests\CommonStorageUtilities.cs" />

0 commit comments

Comments
 (0)
Please sign in to comment.