public async Task TestEdgeCase_InsertUpdateDomainRace() { var updateSessionTable = new UpdateSessionTable(EmulatorConnectionString, Ttl); var updateSessionTableStub = ReplaceExecuteTransactionImplementation(updateSessionTable, async transaction => { Assert.True(await _updateSessionManager.TryStartUpdateSession()); return(await updateSessionTable.TryExecuteTransaction(transaction)); }); var updateSessionManager = new AzureTableUpdateSessionManager(updateSessionTableStub, "superClusterId", "instanceId2", "2"); Assert.False(await updateSessionManager.TryStartUpdateSession()); }
public async Task TestEdgeCase_InstanceEnlists_InsertUpdateDomain_Race() { var updateSessionTable = new UpdateSessionTable(EmulatorConnectionString, ttl: TimeSpan.FromMinutes(15)); var updateSessionTableStub = ReplaceExecuteTransactionImplementation(updateSessionTable, async transaction => { // enlist another instance right before changing the update domain await _updateSessionManager.TryStartUpdateSession("app1"); return(await updateSessionTable.TryExecuteTransaction(transaction)); }); var updateSessionManager = new AzureTableUpdateSessionManager(updateSessionTableStub, "clusterId", "instanceId2", "2"); Assert.False(await updateSessionManager.TryStartUpdateSession("app1")); }
public async Task TestEdgeCase_InstanceEnlists_SetUpdateDomain_Race() { Assert.True(await _updateSessionManager.TryStartUpdateSession()); await _updateSessionManager.EndUpdateSession(); IUpdateSessionTable updateSessionTable = new UpdateSessionTable(EmulatorConnectionString, Ttl); var updateSessionTableStub = ReplaceExecuteTransactionImplementation(updateSessionTable, async transaction => { // enlist another instance right before changing the update domain await _updateSessionManager.TryStartUpdateSession(); return(await updateSessionTable.TryExecuteTransaction(transaction)); }); var updateSessionManager = new AzureTableUpdateSessionManager(updateSessionTableStub, "superClusterId", "instanceId2", "2"); Assert.False(await updateSessionManager.TryStartUpdateSession()); }
public async Task TestEdgeCase_SetUpdateDomainRace() { Assert.True(await _updateSessionManager.TryStartUpdateSession("app1")); await _updateSessionManager.EndUpdateSession("app1"); var updateSessionTable = new UpdateSessionTable(EmulatorConnectionString, ttl: TimeSpan.FromMinutes(15)); var updateSessionTableStub = ReplaceExecuteTransactionImplementation(updateSessionTable, async transaction => { // set update domain 3 right before update domain 2 is being set var updateSession = new AzureTableUpdateSessionManager(updateSessionTable, "clusterId", "instanceId3", "3"); Assert.True(await updateSession.TryStartUpdateSession("app1")); return(await updateSessionTable.TryExecuteTransaction(transaction)); }); var updateSessionManager = new AzureTableUpdateSessionManager(updateSessionTableStub, "clusterId", "instanceId2", "2"); Assert.False(await updateSessionManager.TryStartUpdateSession("app1")); }
private static IUpdateSessionManager CreateUpdateSessionManager(string superClusterId, string instanceId, string updateDomain) { var updateSessionTable = new UpdateSessionTable(EmulatorConnectionString, ttl: TimeSpan.FromMinutes(1)); return(new AzureTableUpdateSessionManager(updateSessionTable, superClusterId, instanceId, updateDomain)); }