Skip to content

Commit

Permalink
Fixes #19741 - Undefined method split for nil on tests
Browse files Browse the repository at this point in the history
Due to a bug on minitest that is being currently fixed, our tests are
broken when they run as the "test_develop_pr_katello" job in Jenkins.

The fix is published as minitest/minitest#696
however there is no version of minitest with it yet. A possible
workaround is to prevent these assertions like this PR does.
  • Loading branch information
dLobatog committed Jun 2, 2017
1 parent a606c0a commit 427fa15
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion test/controllers/api/v2/content_views_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def test_available_puppet_modules_with_use_latest
assert_equal '1.3.0', results.first['version']
use_latest_rec = results.last
assert_equal 'Always Use Latest (currently 1.3.0)', use_latest_rec['version']
assert_equal nil, use_latest_rec['uuid']
assert_nil use_latest_rec['uuid']
end

def test_available_puppet_modules_when_latest_module_already_selected
Expand Down
6 changes: 3 additions & 3 deletions test/glue/candlepin/owner_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ def test_update_candlepin_owner_service_level
@org.service_level = 'Premium'
end
refute_nil JSON.parse(e.response)['displayMessage']
assert_equal nil, @org.service_level
assert_nil @org.service_level

# Should be able to set clear the default
@org.service_level = ''
assert_equal nil, @org.service_level
assert_nil @org.service_level

# ...with a nil too
@org.service_level = nil
assert_equal nil, @org.service_level
assert_nil @org.service_level
end
end
end
2 changes: 1 addition & 1 deletion test/lib/capsule_content_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def assert_tasks_equal(expected_tasks, actual_tasks)

test "last sync time is nil when there's no successful sync" do
@tasks[:successful].destroy
assert_equal(nil, capsule_content.last_sync_time)
assert_nil capsule_content.last_sync_time
end

test "last failed sync tasks" do
Expand Down
12 changes: 6 additions & 6 deletions test/models/activation_key_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ def setup

test "key can be copied" do
new_key = @dev_key.copy("new key name")
assert_equal new_key.name, "new key name"
assert_equal new_key.description, @dev_key.description
assert_equal new_key.host_collections, @dev_key.host_collections
assert_equal new_key.content_view, @dev_key.content_view
assert_equal new_key.organization, @dev_key.organization
assert_equal new_key.max_hosts, @dev_key.max_hosts
assert new_key.name == "new key name"
assert new_key.description == @dev_key.description
assert new_key.host_collections == @dev_key.host_collections
assert new_key.content_view == @dev_key.content_view
assert new_key.organization == @dev_key.organization
assert new_key.max_hosts == @dev_key.max_hosts
end

test "unlimited hosts requires no max hosts" do
Expand Down
8 changes: 4 additions & 4 deletions test/models/concerns/hostgroup_extensions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ def test_inherited_content_view_with_ancestry_nill
@child.content_view = @view
@child.save!

assert_equal @view, @child.content_view
assert_equal nil, @root.content_view
assert @view == @child.content_view
assert_nil @root.content_view
end

def test_inherited_lifecycle_environment_with_ancestry_nil
@child.lifecycle_environment = @library
@child.save!

assert_equal @library, @child.lifecycle_environment
assert_equal nil, @root.lifecycle_environment
assert @library == @child.lifecycle_environment
assert_nil @root.lifecycle_environment
end

def test_content_and_puppet_match?
Expand Down
2 changes: 1 addition & 1 deletion test/models/content_view_puppet_module_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_computed_version_nil
:uuid => nil,
:content_view => @library_view
)
assert_equal nil, content_view_puppet_module.computed_version
assert_nil content_view_puppet_module.computed_version
end

def test_latest_in_modules_by_author
Expand Down
18 changes: 9 additions & 9 deletions test/models/content_view_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ def test_copy
count = ContentView.count
new_view = @library_dev_view.copy("new view name")

assert_equal count + 1, ContentView.count
assert_equal new_view.name, "new view name"
assert_equal new_view.description, @library_dev_view.description
assert_equal new_view.organization_id, @library_dev_view.organization_id
assert_equal new_view.default, @library_dev_view.default
assert_equal new_view.composite, @library_dev_view.composite
assert_equal new_view.components, @library_dev_view.components
assert_equal new_view.repositories, @library_dev_view.repositories
assert_equal new_view.filters, @library_dev_view.filters
assert count + 1 == ContentView.count
assert new_view.name == "new view name"
assert new_view.description == @library_dev_view.description
assert new_view.organization_id == @library_dev_view.organization_id
assert new_view.default == @library_dev_view.default
assert new_view.composite == @library_dev_view.composite
assert new_view.components == @library_dev_view.components
assert new_view.repositories == @library_dev_view.repositories
assert new_view.filters == @library_dev_view.filters
end

def test_delete
Expand Down
6 changes: 3 additions & 3 deletions test/models/repository_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ def test_nil_url_url
new_repo.url = nil
assert new_repo.save
assert new_repo.persisted?
assert_equal nil, new_repo.reload.url
assert_nil new_repo.reload.url
refute new_repo.url?
end

Expand Down Expand Up @@ -728,8 +728,8 @@ def test_with_errata

def test_capsule_download_policy
proxy = SmartProxy.new(:download_policy => 'on_demand')
assert_equal @content_view_puppet_environment.capsule_download_policy(proxy), nil
assert_equal @puppet_forge.capsule_download_policy(proxy), nil
assert_nil @content_view_puppet_environment.capsule_download_policy(proxy)
assert_nil @puppet_forge.capsule_download_policy(proxy)
assert_not_nil @fedora_17_x86_64.download_policy
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/models/sync_plan_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def sync_date_if_disabled
def test_sync_date_if_bad_interval
@plan.sync_date = '1999-11-17 18:26:48 UTC'
@plan.interval = 'blah'
@plan.next_sync.must_equal(nil)
assert_nil @plan.next_sync
end

def test_next_run_hourly
Expand Down

0 comments on commit 427fa15

Please sign in to comment.