Project

General

Profile

Actions

Bug #19087

closed

UINotificationsHostsBuildCompletedTest failures with MySQL on Rails 5.0

Added by Dominic Cleal over 7 years ago. Updated about 6 years ago.

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

Description

The notifications host built test fails most of the time with a MySQL database under Rails 5.0:

Failure:
UINotificationsHostsBuildCompletedTest#test_0002_multiple build events should update current build notification [test/unit/ui_notifications/hosts/build_completed_test.rb:12]:
"Notification.where(:subject => host).count" didn't change by 1.
Expected: 1
  Actual: 0

The cause is similar to #19085, where the precision of timestamp fields is being relied upon for the test, and the default one-second precision of a timestamp field under MySQL is affecting it. The timestamp field getters in Rails 5.0 now return the same precision as the underlying field, causing the failure.

The test first marks an already-built host as built, puts it back into build mode and then marks it built, checking that a notification is generated on the second built event.

Hostext::UINotifications#just_provisioned? uses previous_changes['installed_at'] (i.e. a change in the installed_at timestamp) to test if the host has been provisioned. When the granularity of the timestamp is to the second, this test usually fails as it runs within one second.

This would technically be an issue in the live application as well as the test, but sub-second rebuilds are unlikely to occur in practice.


Related issues 1 (0 open1 closed)

Blocks Foreman - Feature #19050: Add support for running under Ruby on Rails 5.0ClosedDominic Cleal03/28/2017Actions
Actions #1

Updated by Dominic Cleal over 7 years ago

  • Blocks Feature #19050: Add support for running under Ruby on Rails 5.0 added
Actions #2

Updated by The Foreman Bot over 7 years ago

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

Updated by The Foreman Bot over 7 years ago

  • Pull request https://github.com/theforeman/foreman/pull/4422 added
Actions #4

Updated by Dominic Cleal over 7 years ago

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

Updated by Dominic Cleal over 7 years ago

  • Pull request deleted (https://github.com/theforeman/foreman/pull/4422)
Actions #6

Updated by Marek Hulán almost 7 years ago

  • Translation missing: en.field_release set to 240
Actions

Also available in: Atom PDF