From 06c4a1cdd27b94055022a585abc817e652f73402 Mon Sep 17 00:00:00 2001 From: Holger Just Date: Sat, 13 Jul 2024 13:40:48 +0200 Subject: [PATCH] Fix tests for updated git repository --- .../redmine/scm/adapters/git_adapter_test.rb | 22 +++++++++--------- test/unit/repository_git_test.rb | 23 +++++++++++-------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb index 49e9e1de20..bf054860ae 100644 --- a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb @@ -99,12 +99,12 @@ def test_branches assert_equal false, br_latin_1_path.is_default br_master = brs[4] assert_equal 'master', br_master.to_s - assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', br_master.revision + assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', br_master.revision assert_equal br_master.scmid, br_master.revision assert_equal false, br_master.is_default br_master_20120212 = brs[5] assert_equal 'master-20120212', br_master_20120212.to_s - assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', br_master_20120212.revision + assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', br_master_20120212.revision assert_equal br_master_20120212.scmid, br_master_20120212.revision assert_equal true, br_master_20120212.is_default br_latin_1 = brs[-2] @@ -158,8 +158,8 @@ def test_revisions_master_all @adapter.revisions('', nil, "master", {}) do |rev| revs1 << rev end - assert_equal 15, revs1.length - assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', revs1[0].identifier + assert_equal 16, revs1.length + assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', revs1[0].identifier assert_equal '7234cb2750b63f47bff735edc50a1c0a433c2518', revs1[-1].identifier revs2 = [] @@ -167,8 +167,8 @@ def test_revisions_master_all {:reverse => true}) do |rev| revs2 << rev end - assert_equal 15, revs2.length - assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', revs2[-1].identifier + assert_equal 16, revs2.length + assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', revs2[-1].identifier assert_equal '7234cb2750b63f47bff735edc50a1c0a433c2518', revs2[0].identifier end @@ -180,14 +180,14 @@ def test_revisions_master_merged_rev {:reverse => true}) do |rev| revs1 << rev end - assert_equal 8, revs1.length + assert_equal 9, revs1.length assert_equal 'fba357b886984ee71185ad2065e65fc0417d9b92', revs1[0].identifier assert_equal '7e61ac704deecde634b51e59daa8110435dcb3da', revs1[1].identifier # 4a07fe31b is not a child of 713f49446 assert_equal '4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8', revs1[2].identifier # Merged revision assert_equal '32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf', revs1[3].identifier - assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', revs1[-1].identifier + assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', revs1[-1].identifier revs2 = [] @adapter.revisions('', @@ -196,13 +196,13 @@ def test_revisions_master_merged_rev {:reverse => true}) do |rev| revs2 << rev end - assert_equal 7, revs2.length + assert_equal 8, revs2.length assert_equal '7e61ac704deecde634b51e59daa8110435dcb3da', revs2[0].identifier # 4a07fe31b is not a child of fba357b8869 assert_equal '4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8', revs2[1].identifier # Merged revision assert_equal '32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf', revs2[2].identifier - assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', revs2[-1].identifier + assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', revs2[-1].identifier end def test_revisions_branch_latin_1_path_encoding_all @@ -389,7 +389,7 @@ def test_parents {:reverse => true}) do |rev| revs1 << rev end - assert_equal 15, revs1.length + assert_equal 16, revs1.length assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", revs1[0].identifier assert_nil revs1[0].parents diff --git a/test/unit/repository_git_test.rb b/test/unit/repository_git_test.rb index a46ee7abdd..921628a9d4 100644 --- a/test/unit/repository_git_test.rb +++ b/test/unit/repository_git_test.rb @@ -20,7 +20,7 @@ require_relative '../test_helper' class RepositoryGitTest < ActiveSupport::TestCase - fixtures :projects, :repositories, :enabled_modules, :users, :roles + fixtures :projects, :repositories, :enabled_modules, :users, :roles, :changesets include Redmine::I18n @@ -161,10 +161,11 @@ def test_fetch_changesets_incremental assert_equal NUM_REV, @repository.changesets.count extra_info_heads = @repository.extra_info["heads"].dup assert_equal NUM_HEAD, extra_info_heads.size - extra_info_heads.delete_if {|x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c"} + extra_info_heads.delete_if {|x| x == "b1650eac7c505a6dab9f19858afc9ecb481eccc2"} assert_equal NUM_HEAD - 2, extra_info_heads.size del_revs = [ + "b1650eac7c505a6dab9f19858afc9ecb481eccc2", "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c", "ed5bb786bbda2dee66a2d50faf51429dbc043a7b", "4f26664364207fa8b1af9f8722647ab2d4ac5d43", @@ -177,7 +178,7 @@ def test_fetch_changesets_incremental end @project.reload cs1 = @repository.changesets - assert_equal NUM_REV - 6, cs1.count + assert_equal NUM_REV - del_revs.size, cs1.count extra_info_heads << "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8" h = {} h["heads"] = extra_info_heads @@ -189,7 +190,7 @@ def test_fetch_changesets_incremental @project.reload assert_equal NUM_REV, @repository.changesets.count assert_equal NUM_HEAD, @repository.extra_info["heads"].size - assert @repository.extra_info["heads"].index("83ca5fd546063a3c7dc2e568ba3355661a9e2b2c") + assert @repository.extra_info["heads"].index("b1650eac7c505a6dab9f19858afc9ecb481eccc2") end def test_fetch_changesets_history_editing @@ -199,10 +200,11 @@ def test_fetch_changesets_history_editing assert_equal NUM_REV, @repository.changesets.count extra_info_heads = @repository.extra_info["heads"].dup assert_equal NUM_HEAD, extra_info_heads.size - extra_info_heads.delete_if {|x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c"} + extra_info_heads.delete_if {|x| x == "b1650eac7c505a6dab9f19858afc9ecb481eccc2"} assert_equal NUM_HEAD - 2, extra_info_heads.size del_revs = [ + "b1650eac7c505a6dab9f19858afc9ecb481eccc2", "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c", "ed5bb786bbda2dee66a2d50faf51429dbc043a7b", "4f26664364207fa8b1af9f8722647ab2d4ac5d43", @@ -214,7 +216,7 @@ def test_fetch_changesets_history_editing rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s} end @project.reload - assert_equal NUM_REV - 6, @repository.changesets.count + assert_equal NUM_REV - del_revs.size, @repository.changesets.count c = Changeset.new(:repository => @repository, :committed_on => Time.now, @@ -223,7 +225,7 @@ def test_fetch_changesets_history_editing :comments => 'test') assert c.save @project.reload - assert_equal NUM_REV - 5, @repository.changesets.count + assert_equal NUM_REV - del_revs.size + 1, @repository.changesets.count extra_info_heads << "1234abcd5678" h = {} @@ -237,7 +239,7 @@ def test_fetch_changesets_history_editing @repository.fetch_changesets @project.reload - assert_equal NUM_REV - 5, @repository.changesets.count + assert_equal NUM_REV - del_revs.size + 1, @repository.changesets.count h2 = @repository.extra_info["heads"].dup assert_equal h1, h2 end @@ -312,9 +314,10 @@ def test_db_consistent_ordering_before_1_2 assert_equal 0, @repository.extra_info["db_consistent"]["ordering"] extra_info_heads = @repository.extra_info["heads"].dup - extra_info_heads.delete_if {|x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c"} + extra_info_heads.delete_if {|x| x == "b1650eac7c505a6dab9f19858afc9ecb481eccc2"} del_revs = [ + "b1650eac7c505a6dab9f19858afc9ecb481eccc2", "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c", "ed5bb786bbda2dee66a2d50faf51429dbc043a7b", "4f26664364207fa8b1af9f8722647ab2d4ac5d43", @@ -327,7 +330,7 @@ def test_db_consistent_ordering_before_1_2 end @project.reload cs1 = @repository.changesets - assert_equal NUM_REV - 6, cs1.count + assert_equal NUM_REV - del_revs.size, cs1.count assert_equal 0, @repository.extra_info["db_consistent"]["ordering"] extra_info_heads << "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8" -- 2.43.1