Project

General

Profile

Actions

Bug #22917

closed

failing foreman test on devel setup when ran with katello enabled

Added by Jan Hutař about 6 years ago. Updated almost 6 years ago.

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

Description

Discussed this with inecas and he suggested to fix this on a Katello side to provide some default value.

[vagrant@foreman-forklift3 foreman]$ rake test:api
/home/vagrant/foreman/lib/foreman.rb:8: warning: already initialized constant Foreman::UUID_REGEXP
/home/vagrant/foreman/lib/foreman.rb:8: warning: previous definition of UUID_REGEXP was here
/home/vagrant/.rvm/rubies/ruby-2.4.1/bin/ruby -I"lib:test" -I"/home/vagrant/.rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib" "/home/vagrant/.rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/rake_test_loader.rb" "test/functional/api/v2/puppet_hosts_controller_test.rb" 
/home/vagrant/foreman/lib/foreman.rb:8: warning: already initialized constant Foreman::UUID_REGEXP
/home/vagrant/foreman/lib/foreman.rb:8: warning: previous definition of UUID_REGEXP was here
The Apipie cache is turned off. Enable it and run apipie:cache rake task to speed up API calls.
-- execute("SET CONSTRAINTS ALL DEFERRED;")
   -> 0.0004s
Run options: --seed 24766

# Running:

.

Rails logs for test_0002_should run puppet for specific host FAILURE:
Current user: secret_admin (administrator)
Setting current user thread-local variable to secret_admin
  Setting Load (0.2ms)  SELECT  "settings".* FROM "settings" WHERE "settings"."name" = $1 ORDER BY "settings"."name" ASC LIMIT $2  [["name", "name_generator_type"], ["LIMIT", 1]]
Generated new randomized name generator register: 13328382
  Setting Load (0.2ms)  SELECT  "settings".* FROM "settings" WHERE "settings"."name" = $1 ORDER BY "settings"."name" ASC LIMIT $2  [["name", "append_domain_name_for_hosts"], ["LIMIT", 1]]
  Organization Load (0.4ms)  SELECT  "taxonomies".* FROM "taxonomies" WHERE "taxonomies"."type" IN ('Organization') AND "taxonomies"."name" = $1 ORDER BY "taxonomies"."title" ASC LIMIT $2  [["name", "Organization 1"], ["LIMIT", 1]]
  Location Load (0.3ms)  SELECT  "taxonomies".* FROM "taxonomies" WHERE "taxonomies"."type" IN ('Location') AND "taxonomies"."name" = $1 ORDER BY "taxonomies"."title" ASC LIMIT $2  [["name", "Location 1"], ["LIMIT", 1]]
   (0.1ms)  SAVEPOINT active_record_1
  Environment Exists (0.2ms)  SELECT  1 AS one FROM "environments" WHERE "environments"."name" = $1 LIMIT $2  [["name", "environment1"], ["LIMIT", 1]]
  SQL (0.2ms)  INSERT INTO "environments" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id"  [["name", "environment1"], ["created_at", "2018-03-16 13:40:47.724257"], ["updated_at", "2018-03-16 13:40:47.724257"]]
   (0.3ms)  SELECT COUNT(*) FROM "permissions" WHERE "permissions"."resource_type" = $1 AND (permissions.name LIKE 'create_%')  [["resource_type", "Environment"]]
  Permission Load (0.2ms)  SELECT  "permissions".* FROM "permissions" WHERE "permissions"."resource_type" = $1 AND (permissions.name LIKE 'create_%') ORDER BY "permissions"."id" ASC LIMIT $2  [["resource_type", "Environment"], ["LIMIT", 1]]
   (0.1ms)  RELEASE SAVEPOINT active_record_1
  Organization Load (0.2ms)  SELECT  "taxonomies".* FROM "taxonomies" WHERE "taxonomies"."type" IN ('Organization') AND "taxonomies"."name" = $1 ORDER BY "taxonomies"."title" ASC LIMIT $2  [["name", "Organization 1"], ["LIMIT", 1]]
  Location Load (0.4ms)  SELECT  "taxonomies".* FROM "taxonomies" WHERE "taxonomies"."type" IN ('Location') AND "taxonomies"."name" = $1 ORDER BY "taxonomies"."title" ASC LIMIT $2  [["name", "Location 1"], ["LIMIT", 1]]
   (0.2ms)  SAVEPOINT active_record_1
  SQL (0.3ms)  INSERT INTO "features" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id"  [["name", "Puppet"], ["created_at", "2018-03-16 13:40:47.744680"], ["updated_at", "2018-03-16 13:40:47.744680"]]
   (0.1ms)  RELEASE SAVEPOINT active_record_1
  Feature Load (0.3ms)  SELECT "features".* FROM "features" 
   (0.1ms)  SAVEPOINT active_record_1
  Setting Load (0.1ms)  SELECT  "settings".* FROM "settings" WHERE "settings"."name" = $1 ORDER BY "settings"."name" ASC LIMIT $2  [["name", "default_proxy_download_policy"], ["LIMIT", 1]]
  TaxableTaxonomy Exists (0.3ms)  SELECT  1 AS one FROM "taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = $1 AND "taxable_taxonomies"."taxable_id" IS NULL AND "taxable_taxonomies"."taxable_type" = $2 LIMIT $3  [["taxonomy_id", 447626438], ["taxable_type", "SmartProxy"], ["LIMIT", 1]]
  TaxableTaxonomy Exists (0.2ms)  SELECT  1 AS one FROM "taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = $1 AND "taxable_taxonomies"."taxable_id" IS NULL AND "taxable_taxonomies"."taxable_type" = $2 LIMIT $3  [["taxonomy_id", 255093256], ["taxable_type", "SmartProxy"], ["LIMIT", 1]]
  SmartProxy Exists (0.2ms)  SELECT  1 AS one FROM "smart_proxies" WHERE "smart_proxies"."name" = $1 LIMIT $2  [["name", "proxy1"], ["LIMIT", 1]]
  SmartProxy Exists (0.2ms)  SELECT  1 AS one FROM "smart_proxies" WHERE "smart_proxies"."url" = $1 LIMIT $2  [["url", "https://somewhere1.net:8443"], ["LIMIT", 1]]
   (0.2ms)  ROLLBACK TO SAVEPOINT active_record_1
E

Error:
Api::V2::PuppetHostsControllerTest#test_0002_should run puppet for specific host:
ActiveRecord::RecordInvalid: Validation failed: Download policy must be one of the following: immediate, on_demand, background, inherit
    /home/vagrant/katello/app/lib/katello/lazy_accessor.rb:87:in `save!'
    test/factories/disable_auditing.rb:13:in `block (3 levels) in <top (required)>'
    test/factories/disable_auditing.rb:13:in `block (2 levels) in <top (required)>'
    test/factories/host_related.rb:222:in `block (4 levels) in <top (required)>'
    test/functional/api/v2/puppet_hosts_controller_test.rb:13:in `block (2 levels) in <class:PuppetHostsControllerTest>'
    test/active_support_test_case_helper.rb:89:in `as_user'
    test/active_support_test_case_helper.rb:95:in `as_admin'
    test/functional/api/v2/puppet_hosts_controller_test.rb:13:in `block in <class:PuppetHostsControllerTest>'

bin/rails test /home/vagrant/.rvm/gems/ruby-2.4.1/gems/minitest-spec-rails-5.4.0/lib/minitest-spec-rails/dsl.rb:27

Finished in 1.690622s, 1.1830 runs/s, 1.7745 assertions/s.
2 runs, 3 assertions, 0 failures, 1 errors, 0 skips
rake aborted!
Command failed with status (1): [ruby -I"lib:test" -I"/home/vagrant/.rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib" "/home/vagrant/.rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/rake_test_loader.rb" "test/functional/api/v2/puppet_hosts_controller_test.rb" ]
/home/vagrant/.rvm/gems/ruby-2.4.1/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
/home/vagrant/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `eval'
/home/vagrant/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => test:api
(See full trace by running task with --trace)

IIRC Ivan was looking into this code https://github.com/Katello/katello/blob/master/app/models/katello/concerns/smart_proxy_extensions.rb#L59-L62


Related issues 1 (0 open1 closed)

Blocked by Foreman - Bug #23395: allow plugins to add additional fixturesRejectedJustin Sherrill04/25/2018Actions
Actions #1

Updated by Justin Sherrill about 6 years ago

  • Category set to Tests
  • Assignee set to Justin Sherrill
  • translation missing: en.field_release set to 338
  • Difficulty set to easy
Actions #2

Updated by The Foreman Bot about 6 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/7329 added
Actions #3

Updated by Justin Sherrill almost 6 years ago

  • Blocked by Bug #23395: allow plugins to add additional fixtures added
Actions #4

Updated by The Foreman Bot almost 6 years ago

  • Pull request https://github.com/Katello/katello/pull/7336 added
Actions #5

Updated by Justin Sherrill almost 6 years ago

  • Pull request deleted (https://github.com/Katello/katello/pull/7329)
Actions #6

Updated by Justin Sherrill almost 6 years ago

  • Pull request deleted (https://github.com/Katello/katello/pull/7336)
Actions #7

Updated by The Foreman Bot almost 6 years ago

  • Pull request https://github.com/Katello/katello/pull/7377 added
Actions #8

Updated by Justin Sherrill almost 6 years ago

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

Also available in: Atom PDF