public async Task WhenRunningWithStateStoragePreparedAndParametersMatch() { var batches = GetBatches(); var toolState = new FakeToolState { EndpointName = testEndpoint, Batches = batches, RunParameters = new Dictionary <string, string>(), Status = MigrationStatus.StoragePrepared }; timeoutsSource.SetupToolStateToReturn(toolState); timeoutsSource.SetupTimeoutsToReadForBatch(batches.First()); await runner.Run(DateTime.Now, EndpointFilter.SpecificEndpoint(testEndpoint), new Dictionary <string, string>()); Assert.That(timeoutsSource.EndpointsWereListed, Is.False); Assert.That(timeoutsSource.ToolStateWasCreated, Is.False); Assert.That(timeoutsTarget.EndpointWasVerified, Is.False); Assert.That(timeoutsSource.BatchWasRead); Assert.That(timeoutsTarget.BatchWasStaged); Assert.That(timeoutsSource.BatchWasCompleted); Assert.That(timeoutsSource.ToolStateMovedToCompleted); Assert.That(timeoutsSource.MigrationWasAborted, Is.False); Assert.That(timeoutsTarget.MigrationWasCompleted); }
public void WhenRunningWithStateStoragePreparedAndParametersMismatch() { var toolState = new FakeToolState { Batches = GetBatches(), EndpointName = "Invoicing", RunParameters = new Dictionary <string, string> { { "somekey", "somevalue" } } }; timeoutsSource.SetupToolStateToReturn(toolState); timeoutsSource.SetupEndpoints(new List <EndpointInfo>()); Assert.ThrowsAsync <Exception>(async() => { await runner.Run(DateTime.Now, EndpointFilter.IncludeAll, new Dictionary <string, string> { { "someotherkey", "someothervalue" }, { "somekey", "someothervalue" } }); }); Assert.That(timeoutsSource.EndpointsWereListed, Is.False); Assert.That(timeoutsSource.ToolStateWasCreated, Is.False); Assert.That(timeoutsTarget.EndpointWasVerified, Is.False); Assert.That(timeoutsSource.BatchWasRead, Is.False); Assert.That(timeoutsTarget.BatchWasStaged, Is.False); Assert.That(timeoutsSource.BatchWasCompleted, Is.False); Assert.That(timeoutsSource.ToolStateMovedToCompleted, Is.False); Assert.That(timeoutsSource.MigrationWasAborted, Is.False); Assert.That(timeoutsTarget.MigrationWasCompleted, Is.False); }
public void WhenRunningWithStatePreparingAndParametersMatchThrows() { var batches = GetBatches(); var toolState = new FakeToolState { EndpointName = testEndpoint, Batches = batches, RunParameters = new Dictionary <string, string>(), Status = MigrationStatus.Preparing }; timeoutsSource.SetupToolStateToReturn(toolState); timeoutsSource.SetupTimeoutsToReadForBatch(batches.First()); Assert.ThrowsAsync <Exception>(async() => await runner.Run(DateTime.Now, EndpointFilter.SpecificEndpoint(testEndpoint), new Dictionary <string, string>())); }
public async Task WhenAbortingAndTimeoutStorageFoundToolStateItIsAborted() { var batches = GetBatches(); var toolState = new FakeToolState { EndpointName = testEndpoint, Batches = batches, RunParameters = new Dictionary <string, string>() }; timeoutsSource.SetupToolStateToReturn(toolState); await runner.Run(); Assert.That(timeoutsSource.MigrationWasAborted, Is.True); Assert.That(timeoutsTarget.MigrationWasAborted, Is.True); }