Bug #19437

ComputeResourceCacheTest fails with empty file cache

Added by Dominic Cleal about 1 year ago. Updated 9 days ago.

Status:Closed
Priority:Normal
Assignee:Dominic Cleal
Category:Tests
Target version:1.16.0
Difficulty: Team Backlog:
Triaged: Fixed in Releases:
Bugzilla link: Found in Releases:
Pull request:https://github.com/theforeman/foreman/pull/4499

Description

In CI, the following test failure occurred with ComputeResourceCacheTest:

+ bundle exec rake pkg:generate_source jenkins:unit TESTOPTS=-v
rm -rf jenkins/reports/unit/
The Apipie cache is turned off. Enable it and run apipie:cache rake task to speed up API calls.
WARNING: `rake webpack:compile` failed to run. This is only important if running integration tests. (cause: Can't find our webpack executable at /var/lib/workspace/workspace/test_develop/database/mysql/ruby/2.1/slave/fast/node_modules/.bin/webpack - have you run `npm install`?)
The Apipie cache is turned off. Enable it and run apipie:cache rake task to speed up API calls.
  * DEFERRED: MenuItem::MenuItem#caption should be tested. 
  * DEFERRED: MenuItem::MenuItem#html_options should be tested. 
Run options: -v --ci-reporter --seed 27810

# Running:

ComputeResourceCacheTest::with caching enabled#test_0001_it caches data = 1.03 s = E
ComputeResourceCacheTest::with caching enabled#test_0003_#delete deletes keys from the cache = 0.00 s = E
ComputeResourceCacheTest::with caching enabled#test_0004_#write and #read store and read data in the cache = 0.00 s = E
ComputeResourceCacheTest::with caching enabled#test_0002_refresh the cache = 0.00 s = E
Api::V2::TemplateKindsControllerTest#test_0001_should get index = 0.39 s = .
LookupKeyTest::when key is a boolean and default_value is a string#test_0001_default_value is not validated if omit is true = 0.15 s = .

The test attempts to clear the cache in a setup method, which resulted in:

  1) Error:
ComputeResourceCacheTest::with caching enabled#test_0001_it caches data:
Errno::ENOENT: No such file or directory @ dir_initialize - /var/lib/workspace/workspace/test_develop/database/mysql/ruby/2.1/slave/fast/tmp/cache/paralleltests
    test/unit/compute_resource_cache_test.rb:5:in `block in <class:ComputeResourceCacheTest>'

This is already handled in the reset_setting_cache setup/teardown methods in active_support_test_case_helper as the Rails cache may be missing on a clean checkout and when executing the very first tests.

The cache clear can be removed from ComputeResourceCacheTest and other similar test cases.

Associated revisions

Revision 0fccd4c0
Added by Dominic Cleal about 1 year ago

fixes #19437 - remove duplicate Rails.cache.clear calls

Rely on the default cache clear in the AS test helper, which catches
errors from Rails when the file cache doesn't exist yet.

History

#1 Updated by The Foreman Bot about 1 year ago

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

#2 Updated by Dominic Cleal about 1 year ago

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

#3 Updated by Marek Hulán about 1 year ago

  • Legacy Backlogs Release (now unused) set to 240

Also available in: Atom PDF