This sample Rails web-application tends to reproduce a part of Foreman’s architecture in order to highlight a potential bug of Rails.
run ‘rake test`, or the following command:
$ rake test TEST=test/functional/hosts_controller_test.rb
You will get:
DEPRECATION WARNING: The :finder_sql association option is deprecated. Please find an alternative (such as using scopes). (called from /data/theforeman/test-shortcut/app/models/host.rb:5) Loaded suite /data/theforeman/test-shortcut/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader Started ........E Finished in 0.328863 seconds. 1) Error: test_should_update_lookup_value(HostsControllerTest): ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: lookup_values.host_id: SELECT "lookup_values".* FROM "lookup_values" WHERE "lookup_values"."host_id" = 980190962 AND "lookup_values"."id" IN (980190962) app/controllers/hosts_controller.rb:62:in `update' app/controllers/hosts_controller.rb:61:in `update' test/functional/hosts_controller_test.rb:56:in `test_should_update_lookup_value' 9 tests, 11 assertions, 0 failures, 1 errors rake aborted! Command failed with status (1): [/usr/bin/ruby1.8 -I"lib:test" -I"/data/the...] Tasks: TOP => test:single (See full trace by running task with --trace)
-
Create a puppetclass
-
Create a lookup key
-
Create a lookup value, with matcher “hostname=foo”
-
Create a host of name “foo”
-
Associate the host to the created puppetclass
-
Edit the host
Eventually modify the lookup value’s value
Save
You will get:
ActiveRecord::StatementInvalid in HostsController#update SQLite3::SQLException: no such column: lookup_values.host_id: SELECT "lookup_values".* FROM "lookup_values" WHERE "lookup_values"."host_id" = 1 AND "lookup_values"."id" IN (1)