protected async Task Grain_GuidKey_AzureStore_Read_Write() { Guid id = Guid.NewGuid(); IAzureStorageTestGrain grain = this.GrainFactory.GetGrain <IAzureStorageTestGrain>(id); int val = await grain.GetValue(); Assert.Equal(0, val); // "Initial value" await grain.DoWrite(1); val = await grain.GetValue(); Assert.Equal(1, val); // "Value after Write-1" await grain.DoWrite(2); val = await grain.GetValue(); Assert.Equal(2, val); // "Value after Write-2" val = await grain.DoRead(); Assert.Equal(2, val); // "Value after Re-Read" }
public async Task Grain_GuidKey_AzureStore_Read_Write() { Guid id = Guid.NewGuid(); IAzureStorageTestGrain grain = GrainClient.GrainFactory.GetGrain <IAzureStorageTestGrain>(id); int val = await grain.GetValue(); Assert.AreEqual(0, val, "Initial value"); await grain.DoWrite(1); val = await grain.GetValue(); Assert.AreEqual(1, val, "Value after Write-1"); await grain.DoWrite(2); val = await grain.GetValue(); Assert.AreEqual(2, val, "Value after Write-2"); val = await grain.DoRead(); Assert.AreEqual(2, val, "Value after Re-Read"); }
protected async Task Grain_AzureStore_Delete() { Guid id = Guid.NewGuid(); IAzureStorageTestGrain grain = this.GrainFactory.GetGrain <IAzureStorageTestGrain>(id); await grain.DoWrite(1); await grain.DoDelete(); int val = await grain.GetValue(); // Should this throw instead? Assert.Equal(0, val); // "Value after Delete" await grain.DoWrite(2); val = await grain.GetValue(); Assert.Equal(2, val); // "Value after Delete + New Write" }
public async Task Grain_AzureStore_Delete() { Guid id = Guid.NewGuid(); IAzureStorageTestGrain grain = GrainClient.GrainFactory.GetGrain <IAzureStorageTestGrain>(id); await grain.DoWrite(1); await grain.DoDelete(); int val = await grain.GetValue(); // Should this throw instead? Assert.AreEqual(0, val, "Value after Delete"); await grain.DoWrite(2); val = await grain.GetValue(); Assert.AreEqual(2, val, "Value after Delete + New Write"); }
protected async Task Grain_AzureStore_SiloRestart() { var initialServiceId = this.HostedCluster.ServiceId; output.WriteLine("ClusterId={0} ServiceId={1}", this.HostedCluster.ClusterId, this.HostedCluster.ServiceId); Guid id = Guid.NewGuid(); IAzureStorageTestGrain grain = this.GrainFactory.GetGrain <IAzureStorageTestGrain>(id); int val = await grain.GetValue(); Assert.Equal(0, val); // "Initial value" await grain.DoWrite(1); output.WriteLine("About to reset Silos"); foreach (var silo in this.HostedCluster.GetActiveSilos().ToList()) { this.HostedCluster.RestartSilo(silo); } this.HostedCluster.InitializeClient(); output.WriteLine("Silos restarted"); var serviceId = await this.GrainFactory.GetGrain <IServiceIdGrain>(Guid.Empty).GetServiceId(); output.WriteLine("ClusterId={0} ServiceId={1}", this.HostedCluster.ClusterId, serviceId); Assert.Equal(initialServiceId, serviceId); // "ServiceId same after restart." val = await grain.GetValue(); Assert.Equal(1, val); // "Value after Write-1" await grain.DoWrite(2); val = await grain.GetValue(); Assert.Equal(2, val); // "Value after Write-2" val = await grain.DoRead(); Assert.Equal(2, val); // "Value after Re-Read" }
protected async Task Grain_AzureStore_SiloRestart() { var initialServiceId = this.HostedCluster.Globals.ServiceId; var initialDeploymentId = this.HostedCluster.DeploymentId; output.WriteLine("DeploymentId={0} ServiceId={1}", this.HostedCluster.DeploymentId, this.HostedCluster.Globals.ServiceId); Guid id = Guid.NewGuid(); IAzureStorageTestGrain grain = GrainClient.GrainFactory.GetGrain <IAzureStorageTestGrain>(id); int val = await grain.GetValue(); Assert.Equal(0, val); // "Initial value" await grain.DoWrite(1); output.WriteLine("About to reset Silos"); this.HostedCluster.RestartDefaultSilos(true); output.WriteLine("Silos restarted"); output.WriteLine("DeploymentId={0} ServiceId={1}", this.HostedCluster.DeploymentId, this.HostedCluster.Globals.ServiceId); Assert.Equal(initialServiceId, this.HostedCluster.Globals.ServiceId); // "ServiceId same after restart." Assert.NotEqual(initialDeploymentId, this.HostedCluster.DeploymentId); // "DeploymentId different after restart." val = await grain.GetValue(); Assert.Equal(1, val); // "Value after Write-1" await grain.DoWrite(2); val = await grain.GetValue(); Assert.Equal(2, val); // "Value after Write-2" val = await grain.DoRead(); Assert.Equal(2, val); // "Value after Re-Read" }
public async Task Grain_AzureStore_SiloRestart() { var initialDeploymentId = DeploymentId; Console.WriteLine("DeploymentId={0} ServiceId={1}", DeploymentId, Globals.ServiceId); Guid id = Guid.NewGuid(); IAzureStorageTestGrain grain = GrainClient.GrainFactory.GetGrain <IAzureStorageTestGrain>(id); int val = await grain.GetValue(); Assert.AreEqual(0, val, "Initial value"); await grain.DoWrite(1); Console.WriteLine("About to reset Silos"); RestartDefaultSilos(true); Console.WriteLine("Silos restarted"); Console.WriteLine("DeploymentId={0} ServiceId={1}", DeploymentId, Globals.ServiceId); Assert.AreEqual(initialServiceId, Globals.ServiceId, "ServiceId same after restart."); Assert.AreNotEqual(initialDeploymentId, DeploymentId, "DeploymentId different after restart."); val = await grain.GetValue(); Assert.AreEqual(1, val, "Value after Write-1"); await grain.DoWrite(2); val = await grain.GetValue(); Assert.AreEqual(2, val, "Value after Write-2"); val = await grain.DoRead(); Assert.AreEqual(2, val, "Value after Re-Read"); }