Project

General

Profile

Actions

Bug #15699

closed

"Value is invalid" running rake test on host without FQDN/domain

Added by Dominic Cleal over 8 years ago. Updated over 6 years ago.

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

Description

When running rake test tasks that populate the test DB for the first time, they fail for me with:

11:29 $ rake test:integration
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
rake aborted!
ActiveRecord::RecordInvalid: Validation failed: Value is invalid
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/validations.rb:79:in `raise_record_invalid'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/validations.rb:43:in `save!'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `block in save!'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/test_after_commit-1.1.0/lib/test_after_commit/database_statements.rb:11:in `block in transaction'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/test_after_commit-1.1.0/lib/test_after_commit/database_statements.rb:5:in `transaction'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `save!'
/home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/protected_attributes-1.1.3/lib/active_record/mass_assignment_security/validations.rb:17:in `create!'
/home/dcleal/code/foreman/foreman/app/models/setting.rb:185:in `create!'
/home/dcleal/code/foreman/foreman/app/models/setting/general.rb:26:in `block (2 levels) in load_defaults'
/home/dcleal/code/foreman/foreman/app/models/setting/general.rb:26:in `each'
/home/dcleal/code/foreman/foreman/app/models/setting/general.rb:26:in `block in load_defaults'

This happens when my host doesn't have an FQDN/domain configured:

11:29 $ ruby -rfacter -e 'puts Facter.value(:domain).inspect'
nil

There's support from #3946 to define a default domain and FQDN in config/settings.yaml, but since tests use config/settings.yaml.test (#11056), this requires editing this source controlled test file.

The fqdn/domain settings can just be added to this file so we have sensible defaults for hosts without an FQDN or domain to run tests. The values don't much matter as fixtures will take over for tests themselves.

Actions #1

Updated by The Foreman Bot over 8 years ago

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

Updated by Dominic Cleal over 8 years ago

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

Updated by Dominic Cleal over 8 years ago

  • Translation missing: en.field_release set to 160
Actions

Also available in: Atom PDF