public async Task Submodule_status_changes_for_top_module_with_second_nested_module_commit() { var currentModule = _repo1Module; var result = await SubmoduleTestHelpers.UpdateSubmoduleStructureAndWaitForResultAsync(_provider, currentModule); result.Should().NotBeNull(); // No changes in repo var changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(0); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); result.AllSubmodules.All(i => i.Detailed is null).Should().BeTrue(); result.OurSubmodules.Should().BeEquivalentTo(result.AllSubmodules); result.TopProject.Detailed.Should().BeNull(); // Update commit in repo3 _repo3Module.GitExecutable.GetOutput(@"commit --allow-empty -m ""Dummy commit"""); changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(1); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); result.AllSubmodules[0].Detailed.IsDirty.Should().BeTrue(); result.AllSubmodules[0].Detailed.Status.Should().BeEquivalentTo(SubmoduleStatus.Unknown); result.AllSubmodules[1].Detailed.IsDirty.Should().BeFalse(); result.AllSubmodules[1].Detailed.Status.Should().BeEquivalentTo(SubmoduleStatus.FastForward); result.OurSubmodules.Should().BeEquivalentTo(result.AllSubmodules); result.TopProject.Detailed.IsDirty.Should().BeTrue(); result.TopProject.Detailed.Status.Should().BeEquivalentTo(SubmoduleStatus.Unknown); // Revert the change _repo3Module.GitExecutable.Execute(@"checkout HEAD^", throwOnErrorOutput: false); await CheckRevertedStatus(result); }
public async Task Submodule_status_changes_for_top_module_with_second_nested_module_change() { var currentModule = _repo1Module; var result = await SubmoduleTestHelpers.UpdateSubmoduleStructureAndWaitForResultAsync(_provider, currentModule); result.Should().NotBeNull(); // No changes in repo var changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(0); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); result.AllSubmodules.All(i => i.Detailed is null).Should().BeTrue(); result.OurSubmodules.Should().BeEquivalentTo(result.AllSubmodules); result.TopProject.Detailed.Should().BeNull(); // Make a change in repo3 _repo1.CreateFile(_repo3Module.WorkingDir, "test.txt", "test"); changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(1); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); result.AllSubmodules[0].Detailed.IsDirty.Should().BeTrue(); result.AllSubmodules[0].Detailed.Status.Should().BeEquivalentTo(SubmoduleStatus.Unknown); result.AllSubmodules[1].Detailed.IsDirty.Should().BeTrue(); result.AllSubmodules[1].Detailed.Status.Should().BeEquivalentTo(SubmoduleStatus.Unknown); result.OurSubmodules.Should().BeEquivalentTo(result.AllSubmodules); result.TopProject.Detailed.IsDirty.Should().BeTrue(); result.TopProject.Detailed.Status.Should().BeEquivalentTo(SubmoduleStatus.Unknown); // Revert the change File.Delete(Path.Combine(_repo3Module.WorkingDir, "test.txt")); await CheckRevertedStatus(result); }
/// <summary> /// Check that the repo is reverted after the test, prepared for next /// An explicit Git clean and reset will require additional time /// </summary> /// <param name="result">The existing structure, reused from the test</param> /// <returns>a Task</returns> private async Task CheckRevertedStatus(SubmoduleInfoResult result) { var changedFiles = GetStatusChangedFiles(_repo1Module); changedFiles.Should().HaveCount(0); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, _repo1Module, changedFiles); result.AllSubmodules.All(i => i.Detailed is null).Should().BeTrue(); result.TopProject.Detailed.Should().BeNull(); }
public async Task Submodule_status_changes_for_top_module_with_first_nested_module_commit_second_nested_module_change() { var currentModule = _repo1Module; var result = await SubmoduleTestHelpers.UpdateSubmoduleStructureAndWaitForResultAsync(_provider, currentModule); result.Should().NotBeNull(); // No changes in repo var changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(0); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); result.AllSubmodules.All(i => i.Detailed == null).Should().BeTrue(); result.OurSubmodules.Should().BeEquivalentTo(result.AllSubmodules); result.TopProject.Detailed.Should().BeNull(); // Make a change in repo3 _repo1.CreateFile(_repo3Module.WorkingDir, "test.txt", "test"); _repo2Module.GitExecutable.GetOutput(@"commit --allow-empty -m ""Dummy commit"""); changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(1); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); result.AllSubmodules[0].Detailed.IsDirty.Should().BeTrue(); result.AllSubmodules[0].Detailed.Status.Should().BeEquivalentTo(SubmoduleStatus.FastForward); result.AllSubmodules[1].Detailed.IsDirty.Should().BeTrue(); result.AllSubmodules[1].Detailed.Status.Should().BeEquivalentTo(SubmoduleStatus.Unknown); result.OurSubmodules.Should().BeEquivalentTo(result.AllSubmodules); result.TopProject.Detailed.IsDirty.Should().BeTrue(); result.TopProject.Detailed.Status.Should().BeEquivalentTo(SubmoduleStatus.Unknown); // Revert the change for repo3 File.Delete(Path.Combine(_repo3Module.WorkingDir, "test.txt")); changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(1); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); result.AllSubmodules[0].Detailed.IsDirty.Should().BeFalse(); result.AllSubmodules[0].Detailed.Status.Should().BeEquivalentTo(SubmoduleStatus.FastForward); result.AllSubmodules[1].Detailed.Should().BeNull(); result.OurSubmodules.Should().BeEquivalentTo(result.AllSubmodules); result.TopProject.Detailed.IsDirty.Should().BeTrue(); result.TopProject.Detailed.Status.Should().BeEquivalentTo(SubmoduleStatus.Unknown); // Revert the change _repo2Module.GitExecutable.GetOutput(@"checkout HEAD^"); changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(0); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); result.AllSubmodules.All(i => i.Detailed == null).Should().BeTrue(); result.OurSubmodules.Should().BeEquivalentTo(result.AllSubmodules); result.TopProject.Detailed.Should().BeNull(); }
public async Task Submodule_status_changes_for_first_nested_module() { var currentModule = _repo2Module; var result = await SubmoduleTestHelpers.UpdateSubmoduleStructureAndWaitForResultAsync(_provider, currentModule); result.Should().NotBeNull(); // No changes in repo var changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(0); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); result.OurSubmodules.All(i => i.Detailed == null).Should().BeTrue(); // Make a change in repo1 _repo1.CreateFile(_repo1Module.WorkingDir, "test.txt", "test"); changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(0); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); result.OurSubmodules.All(i => i.Detailed == null).Should().BeTrue(); // Revert the change File.Delete(Path.Combine(_repo1Module.WorkingDir, "test.txt")); changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(0); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); result.OurSubmodules.All(i => i.Detailed == null).Should().BeTrue(); // Make a change in repo3 _repo1.CreateFile(_repo3Module.WorkingDir, "test.txt", "test"); changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(1); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); // Fails, for same reason as previous test ////result.OurSubmodules[0].Detailed.IsDirty.Should().BeTrue(); // Revert the change File.Delete(Path.Combine(_repo3Module.WorkingDir, "test.txt")); changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(0); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); result.OurSubmodules.All(i => i.Detailed == null).Should().BeTrue(); }
public async Task Submodule_status_changes_for_top_module_with_no_forced_changes() { var currentModule = _repo1Module; var result = await SubmoduleTestHelpers.UpdateSubmoduleStructureAndWaitForResultAsync(_provider, currentModule); result.Should().NotBeNull(); // No changes in repo var changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(0); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); result.AllSubmodules.All(i => i.Detailed == null).Should().BeTrue(); result.OurSubmodules.Should().BeEquivalentTo(result.AllSubmodules); result.TopProject.Detailed.Should().BeNull(); // Make a change in repo1 without force update, should take 15s DateTime statusStart = DateTime.Now; _repo1.CreateFile(_repo1Module.WorkingDir, "test.txt", "test"); changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(1); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles, false); result.AllSubmodules[0].Detailed.Should().BeNull(); result.AllSubmodules[1].Detailed.Should().BeNull(); result.OurSubmodules.Should().BeEquivalentTo(result.AllSubmodules); result.TopProject.Detailed.IsDirty.Should().BeTrue(); result.TopProject.Detailed.Status.Should().BeEquivalentTo(SubmoduleStatus.Unknown); (DateTime.Now - statusStart).TotalSeconds.Should().BeGreaterOrEqualTo(14); // Revert the change File.Delete(Path.Combine(_repo1Module.WorkingDir, "test.txt")); changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(0); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); result.AllSubmodules.All(i => i.Detailed == null).Should().BeTrue(); result.OurSubmodules.Should().BeEquivalentTo(result.AllSubmodules); result.TopProject.Detailed.Should().BeNull(); }
public async Task Submodule_status_changes_for_top_module_top_module_commit() { var currentModule = _repo1Module; var result = await SubmoduleTestHelpers.UpdateSubmoduleStructureAndWaitForResultAsync(_provider, currentModule); result.Should().NotBeNull(); // No changes in repo var changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(0); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); result.AllSubmodules.All(i => i.Detailed == null).Should().BeTrue(); result.OurSubmodules.Should().BeEquivalentTo(result.AllSubmodules); result.TopProject.Detailed.Should().BeNull(); // Update commit in topmodule currentModule.GitExecutable.GetOutput(@"commit --allow-empty -m ""Dummy commit"""); changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(0); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); result.AllSubmodules.All(i => i.Detailed == null).Should().BeTrue(); result.OurSubmodules.Should().BeEquivalentTo(result.AllSubmodules); result.TopProject.Detailed.Should().BeNull(); // Revert the change _repo1Module.GitExecutable.GetOutput(@"checkout HEAD^"); changedFiles = GetStatusChangedFiles(currentModule); changedFiles.Should().HaveCount(0); await SubmoduleTestHelpers.UpdateSubmoduleStatusAndWaitForResultAsync(_provider, currentModule, changedFiles); result.AllSubmodules.All(i => i.Detailed == null).Should().BeTrue(); result.OurSubmodules.Should().BeEquivalentTo(result.AllSubmodules); result.TopProject.Detailed.Should().BeNull(); }