Bug #18238

AuthSourceLdapTest::refresh ldap#test_0003_update_usergroups test failure

Added by Dominic Cleal over 1 year ago. Updated 8 days ago.

Status:Closed
Priority:Normal
Assignee:Dominic Cleal
Category:Tests
Target version:1.15.0
Difficulty: Team Backlog:
Triaged: Fixed in Releases:
Bugzilla link: Found in Releases:
Pull request:https://github.com/theforeman/foreman/pull/4227

Description

When running the full test suite with rake test, the following test usually fails:

  1) Failure:
AuthSourceLdapTest::refresh ldap#test_0003_update_usergroups refreshes on all external user groups, in LDAP and in Foreman auth source [/home/dcleal/code/foreman/foreman/app/models/external_usergroup.rb:40]:
unexpected invocation: #<AuthSourceLdap:0xd10c810>.valid_group?('external_usergroup2')
unsatisfied expectations:
- expected exactly once, not yet invoked: #<AnyInstance:LdapFluff>.group_list('test')
- expected exactly once, not yet invoked: #<AuthSourceLdap:0xd10c810>.valid_group?('external_usergroup1')
satisfied expectations:
- allowed any number of times, not yet invoked: #<AnyInstance:LdapFluff>.find_user(any_parameters)
- allowed any number of times, not yet invoked: #<AnyInstance:LdapFluff>.valid_user?(any_parameters)

The test has a hardcoded ExternalUsergroup name in it, but because it's created via FactoryGirl, the name will increment and change.

Easy to reproduce by running test/controllers/usergroups_controller_test.rb test/models/auth_sources/auth_source_ldap_test.rb in sequence.

Likely not an issue with jenkins:* rake tasks as they run in a particular strict order. Only some controller tests create external user groups, this only happens if they run before the model tests.

Associated revisions

Revision 08705e43
Added by Dominic Cleal over 1 year ago

fixes #18238 - use fixed model name in test expectation

History

#1 Updated by The Foreman Bot over 1 year ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/4227 added

#2 Updated by Dominic Cleal over 1 year ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#3 Updated by Dominic Cleal over 1 year ago

  • Legacy Backlogs Release (now unused) set to 209

Also available in: Atom PDF