public void Pull_NoChangesInRepo_NoChanges() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Pull)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); Assert.That(e.Local.Repository.GetTip().Number.Hash, Is.EqualTo(e.Remote.Repository.GetTip().Number.Hash)); var transport = provider.Transport; transport.Pull(); Assert.That(e.Progress.AllMessages, Contains.Item("No changes")); } }
public void Push_LargeFileSizeBundle_Success() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.LocalAddAndCommitLargeFile(); var transport = provider.Transport; transport.Push(); Assert.That(e.Progress.AllMessages, Contains.Item("Finished sending")); } }
public void Pull_BundleInOneChunk_Success() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Pull)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.RemoteAddAndCommit(); var transport = provider.Transport; transport.Pull(); Assert.That(e.Progress.AllMessages, Contains.Item("Pull operation completed successfully")); } }
public void Pull_BundleInMultipleChunks_Success() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Pull)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.RemoteAddAndCommitLargeFile(); var transport = provider.Transport; transport.Pull(); Assert.That(e.Progress.AllMessages, Contains.Item("Pull operation completed successfully")); } }
public void Pull_PullOperationFailsMidway_ContinuesToCompletion() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Pull)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.RemoteAddAndCommitLargeFile(); e.ApiServer.AddFailResponse(3); var transport = provider.Transport; transport.Pull(); Assert.That(e.Progress.AllMessages, Contains.Item("Pull operation completed successfully")); } }
public void Push_SuccessfulPush_PushDataCacheDestroyed() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.LocalAddAndCommitLargeFile(); var transport = provider.Transport; transport.Push(); Assert.That(e.Progress.AllMessages, Contains.Item("Finished sending")); var dirInfo = new DirectoryInfo(Path.Combine(transport.PathToLocalStorage, "pushData")); Assert.That(dirInfo.GetFiles().Length, Is.EqualTo(0)); } }
public void Pull_SucessfulPull_PullBundleDataIsRemoved() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Pull)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.RemoteAddAndCommit(); var transport = provider.Transport; transport.Pull(); Assert.That(e.Progress.AllMessages, Contains.Item("Pull operation completed successfully")); var dirInfo = new DirectoryInfo(Path.Combine(transport.PathToLocalStorage, "pullData")); Assert.That(dirInfo.GetFiles().Length, Is.EqualTo(0)); } }
public void Pull_InvalidBaseHashFromServer_ClientRecoversSuccessfully() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Pull)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.RemoteAddAndCommit(); var transport = provider.Transport; transport.Pull(); // at this point the local server has cached the tip of the repo e.Remote.Repository.RollbackWorkingDirectoryToLastCheckin(); transport.Pull(); Assert.That(e.Progress.AllMessages, Has.No.Member("Pull operation failed")); } }
public void Push_InvalidBaseHashFromServer_ClientRecoversSuccessfully() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.LocalAddAndCommit(); var transport = provider.Transport; transport.Push(); // at this point the transport has cached the tip of the remote repo e.Remote.Repository.RollbackWorkingDirectoryToLastCheckin(); e.LocalAddAndCommit(); Assert.That(() => transport.Push(), Throws.Nothing); } }
public void Pull_ServerNotAvailableMidTransaction_NotAvailableMessage() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Pull)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.RemoteAddAndCommitLargeFile(); var serverMessage = "The server is down for scheduled maintenance"; e.ApiServer.AddServerUnavailableResponse(2, serverMessage); var transport = provider.Transport; transport.Pull(); Assert.That(e.Progress.AllMessages, Contains.Item("Server temporarily unavailable: " + serverMessage)); Assert.That(e.Progress.AllMessages, Has.No.Member("Pull operation completed successfully")); } }
public void Pull_UserCancelsMidwayTheRemoteRepoChanges_PullFinishesSecondPull() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Pull)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.RemoteAddAndCommitLargeFile(); e.ApiServer.AddCancelResponse(2); var transport = provider.Transport; Assert.That(() => transport.Pull(), Throws.Exception.TypeOf <UserCancelledException>()); e.Progress.CancelRequested = false; e.RemoteAddAndCommit(); transport.Pull(); IEnumerable <string> msgs = e.Progress.Messages.Where(x => x == "Pull operation completed successfully"); Assert.That(msgs.ToList(), Has.Count.EqualTo(1)); } }
public void Push_UserCancelsMidwayThenRepoChanges_PushDoesNotResume() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.LocalAddAndCommitLargeFile(); e.ApiServer.AddCancelResponse(2); var transport = provider.Transport; Assert.That(() => transport.Push(), Throws.Exception.TypeOf <UserCancelledException>()); e.Progress.CancelRequested = false; e.RemoteAddAndCommit(); transport.Push(); Assert.That(e.Progress.AllMessagesString().Contains("Resuming push operation at"), Is.Not.True); Assert.That(e.Progress.AllMessages, Contains.Item("Finished sending")); } }
public void Push_UserCancelsMidwayAndBeginsAgainWithAdditionalPush_Resumes() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.LocalAddAndCommitLargeFile(); e.ApiServer.AddCancelResponse(3); var transport = provider.Transport; Assert.That(() => transport.Push(), Throws.Exception.TypeOf <UserCancelledException>()); e.Progress.CancelRequested = false; e.ApiServer.AddCancelResponse(6); Assert.That(() => transport.Push(), Throws.Exception.TypeOf <UserCancelledException>()); e.Progress.CancelRequested = false; transport.Push(); Assert.That(e.Progress.AllMessages, Contains.Item("Resuming push operation at 126KB sent")); Assert.That(e.Progress.AllMessages, Contains.Item("Resuming push operation at 249KB sent")); Assert.That(e.Progress.AllMessages, Contains.Item("Finished sending")); } }
public void Pull_SomeTimeOuts_Success() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Pull)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.RemoteAddAndCommitLargeFile(); e.ApiServer.AddTimeoutResponse(2); e.ApiServer.AddTimeoutResponse(3); var transport = provider.Transport; transport.Pull(); Assert.That(e.Progress.AllMessages, Contains.Item("Pull operation completed successfully")); } }
public void Push_ServerNotAvailableMidTransaction_NotAvailableMessage() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.LocalAddAndCommitLargeFile(); var serverMessage = "The server is down for scheduled maintenance"; e.ApiServer.AddServerUnavailableResponse(4, serverMessage); var transport = provider.Transport; transport.Push(); Assert.That(e.Progress.AllMessages, Contains.Item("Server temporarily unavailable: " + serverMessage)); Assert.That(e.Progress.AllMessages, Has.No.Member("Finished sending")); } }
public void Pull_UserCancelsMidwayTheRemoteRepoChanges_PullFinishesSecondPull() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Pull)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.RemoteAddAndCommitLargeFile(); e.ApiServer.AddCancelResponse(2); var transport = provider.Transport; Assert.That(() => transport.Pull(), Throws.Exception.TypeOf<UserCancelledException>()); e.Progress.CancelRequested = false; e.RemoteAddAndCommit(); transport.Pull(); IEnumerable<string> msgs = e.Progress.Messages.Where(x => x == "Pull operation completed successfully"); Assert.That(msgs.ToList(), Has.Count.EqualTo(1)); } }
public void Push_UserCancelsMidwayThenRepoChanges_PushDoesNotResume() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.LocalAddAndCommitLargeFile(); e.ApiServer.AddCancelResponse(2); var transport = provider.Transport; Assert.That(() => transport.Push(), Throws.Exception.TypeOf<UserCancelledException>()); e.Progress.CancelRequested = false; e.RemoteAddAndCommit(); transport.Push(); Assert.That(e.Progress.AllMessagesString().Contains("Resuming push operation at"), Is.Not.True); Assert.That(e.Progress.AllMessages, Contains.Item("Finished sending")); } }
public void Push_UserCancelsMidwayAndBeginsAgainWithAdditionalPush_Resumes() { using (var e = new TestEnvironment("hgresumetest", ApiServerType.Push)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.LocalAddAndCommitLargeFile(); e.ApiServer.AddCancelResponse(3); var transport = provider.Transport; Assert.That(() => transport.Push(), Throws.Exception.TypeOf<UserCancelledException>()); e.Progress.CancelRequested = false; e.ApiServer.AddCancelResponse(6); Assert.That(() => transport.Push(), Throws.Exception.TypeOf<UserCancelledException>()); e.Progress.CancelRequested = false; transport.Push(); Assert.That(e.Progress.AllMessages, Contains.Item("Resuming push operation at 126KB sent")); Assert.That(e.Progress.AllMessages, Contains.Item("Resuming push operation at 249KB sent")); Assert.That(e.Progress.AllMessages, Contains.Item("Finished sending")); } }