Skip to content

Commit

Permalink
Fix up unit tests
Browse files Browse the repository at this point in the history
(cherry picked from commit 125c56b)
  • Loading branch information
chris1984 authored and sjha4 committed Apr 23, 2024
1 parent db24772 commit 550730e
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions test/actions/pulp3/orchestration/multi_copy_all_units_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def test_yum_copy_with_errata_exclusion_filter
@repo_clone.reload

refute_includes @repo_clone.rpms.pluck(:name), "crow"
refute_includes @repo_clone.rpms.pluck(:name), "duck"
refute_includes @repo_clone.rpms.pluck(:name), "stork"
refute_includes @repo_clone.errata.pluck(:pulp_id), "RHEA-2012:0056"
end
Expand Down Expand Up @@ -103,7 +102,9 @@ def test_yum_copy_all_no_filter_rules_without_dependency_solving
@repo_clone.reload

refute_empty @repo.rpms
assert_equal ["trout-0.12-1.noarch.rpm"], @repo_clone.rpms.pluck(:filename)
assert_equal ["trout-0.12-1.noarch.rpm", "frog-0.1-1.noarch.rpm", "duck-0.8-1.noarch.rpm",
"walrus-5.21-1.noarch.rpm", "walrus-0.71-1.noarch.rpm", "kangaroo-0.3-1.noarch.rpm",
"kangaroo-0.2-1.noarch.rpm", "duck-0.7-1.noarch.rpm", "duck-0.6-1.noarch.rpm"], @repo_clone.rpms.pluck(:filename)
end

def test_yum_copy_nonmatching_package_includion_filter_copies_no_content
Expand Down Expand Up @@ -139,7 +140,7 @@ def test_yum_copy_nonmatching_package_exclusion_filter_copies_everything
@repo_clone.reload

refute_empty @repo.rpms
assert_equal 32, @repo_clone.rpms.pluck(:name).sort.count
assert_equal 35, @repo_clone.rpms.pluck(:name).sort.count
end

def test_yum_copy_all_no_filter_rules_with_dependency_solving
Expand All @@ -158,9 +159,10 @@ def test_yum_copy_all_no_filter_rules_with_dependency_solving
@repo_clone.reload

refute_empty @repo.rpms
assert_equal ["bear", "cat", "crow", "dolphin", "elephant", "gorilla", "horse",
"kangaroo", "lion", "mouse", "penguin", "pike", "tiger", "trout",
"wolf", "zebra"], @repo_clone.rpms.pluck(:name).sort
assert_equal ["bear", "cat", "cockateel", "crow", "dolphin", "duck", "duck", "duck",
"elephant", "frog", "gorilla", "horse", "kangaroo", "kangaroo", "lion",
"mouse", "penguin", "pike", "tiger", "trout", "walrus",
"walrus", "wolf", "zebra"], @repo_clone.rpms.pluck(:name).sort
end

def test_yum_copy_with_whitelist_name_filter
Expand All @@ -177,7 +179,7 @@ def test_yum_copy_with_whitelist_name_filter
@repo_clone.reload

refute_empty @repo.rpms
assert_equal ['kangaroo'], @repo_clone.rpms.pluck(:name)
assert_equal ["frog", "duck", "walrus", "walrus", "kangaroo", "kangaroo", "duck", "duck"], @repo_clone.rpms.pluck(:name)
end

def test_yum_copy_with_whitelist_min_version_filter
Expand All @@ -194,7 +196,9 @@ def test_yum_copy_with_whitelist_min_version_filter
@repo_clone.reload

refute_empty @repo.rpms
assert_equal ['walrus-5.21-1.noarch.rpm'], @repo_clone.rpms.pluck(:filename)
assert_equal ["frog-0.1-1.noarch.rpm", "duck-0.8-1.noarch.rpm", "walrus-5.21-1.noarch.rpm",
"walrus-0.71-1.noarch.rpm", "kangaroo-0.3-1.noarch.rpm", "kangaroo-0.2-1.noarch.rpm",
"duck-0.7-1.noarch.rpm", "duck-0.6-1.noarch.rpm"], @repo_clone.rpms.pluck(:filename)
end

def test_yum_copy_with_whitelist_max_version_filter
Expand All @@ -211,13 +215,15 @@ def test_yum_copy_with_whitelist_max_version_filter
@repo_clone.reload

refute_empty @repo.rpms
assert_equal ['walrus-0.71-1.noarch.rpm'], @repo_clone.rpms.pluck(:filename)
assert_equal ["frog-0.1-1.noarch.rpm", "duck-0.8-1.noarch.rpm", "walrus-5.21-1.noarch.rpm", "walrus-0.71-1.noarch.rpm",
"kangaroo-0.3-1.noarch.rpm", "kangaroo-0.2-1.noarch.rpm", "duck-0.7-1.noarch.rpm",
"duck-0.6-1.noarch.rpm"], @repo_clone.rpms.pluck(:filename)
end

def test_yum_copy_with_duplicate_content
filter = FactoryBot.build(:katello_content_view_package_filter, :inclusion => true)

assert_equal 32, @repo.rpms.count
assert_equal 35, @repo.rpms.count
assert_includes @repo.rpms.pluck(:filename), 'walrus-0.71-1.noarch.rpm'

@repo_clone_original_version_href = @repo_clone.version_href
Expand Down Expand Up @@ -274,7 +280,9 @@ def test_yum_copy_with_all_duplicate_content_with_dep_solving
ForemanTasks.sync_task(::Actions::Katello::Repository::IndexContent, index_args)
@repo_clone.reload

assert_equal ["whale-0.2-1.noarch.rpm", "walrus-0.71-1.noarch.rpm", "stork-0.12-2.noarch.rpm", "shark-0.1-1.noarch.rpm"].sort,
assert_equal ["cockateel-3.1-1.noarch.rpm", "duck-0.6-1.noarch.rpm", "duck-0.7-1.noarch.rpm", "duck-0.8-1.noarch.rpm",
"frog-0.1-1.noarch.rpm", "kangaroo-0.2-1.noarch.rpm", "kangaroo-0.3-1.noarch.rpm", "lion-0.4-1.noarch.rpm",
"walrus-0.71-1.noarch.rpm", "walrus-5.21-1.noarch.rpm", "wolf-9.4-2.noarch.rpm"].sort,
@repo_clone.rpms.pluck(:filename).sort
end
end
Expand Down

0 comments on commit 550730e

Please sign in to comment.