Project

General

Profile

Bug #9044

Tests can fail randomly on mac.succ

Added by Marek Hulán almost 5 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Tests
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

In some tests we use mac.succ to get next new address in order to test mac change. The original mac is generated by factory girl sequence so with more tests using this factory girl the mac changes in tests. When we get mac ending with '...:.f' and we call succ we get invalid mac containing 'g'. It causes hard to debug issues since when we validate host we normalize the mac (see validations.rb) which does not match invalid mac resulting in nilifying the attribute.

To illustrate

host.mac = host.mac.succ
host.mac.present? # => true
host.valid?       # host.mac is nil now, causing validations errors

I'll change tests to correctly increment mac address and I'll change the mac normalization method to handle "else" in case.


Related issues

Related to Foreman - Bug #9195: MAC address validator raises an error if MAC is invalid instead of recording an error in validated objectClosed2015-02-03
Blocks Foreman - Bug #8052: Smart class parameters with ERB snippets are broken for other that String typesClosed2014-10-23

Associated revisions

Revision ee1f56de (diff)
Added by Marek Hulán almost 5 years ago

Fixes #9044 - fixes invalid mac in tests

Also do not reset invalid mac address to nil so we can propagate proper
validation error.

Revision 46b71480 (diff)
Added by Ori Rabin almost 5 years ago

refs #9044 - Fixes broken mac tests

Revision 0925c7cc (diff)
Added by Marek Hulán almost 5 years ago

Fixes #9044 - fixes invalid mac in tests

Also do not reset invalid mac address to nil so we can propagate proper
validation error.

(cherry picked from commit ee1f56de6b2bdca4dfd104b99ec25340bfb51aaa)

Revision 2fc226ea (diff)
Added by Ori Rabin over 4 years ago

refs #9044 - refactor mac test fix

History

#1 Updated by Marek Hulán almost 5 years ago

  • Status changed from New to Assigned

#2 Updated by The Foreman Bot almost 5 years ago

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

#3 Updated by Dominic Cleal almost 5 years ago

  • Blocks Bug #8052: Smart class parameters with ERB snippets are broken for other that String types added

#4 Updated by Dominic Cleal almost 5 years ago

  • Legacy Backlogs Release (now unused) set to 30

#5 Updated by Marek Hulán almost 5 years ago

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

#6 Updated by Dominic Cleal almost 5 years ago

  • Legacy Backlogs Release (now unused) changed from 30 to 32

#7 Updated by Dominic Cleal almost 5 years ago

  • Related to Bug #9195: MAC address validator raises an error if MAC is invalid instead of recording an error in validated object added

Also available in: Atom PDF