Commit graph

17 commits

Author SHA1 Message Date
Harm Geerts
9bd70045c9
Fix BaseFileCacheModule#keys to respect prefix ()
* Fix BaseFileCacheModule#keys to respect prefix

Change:
- Previously BaseFileCacheModule#keys would return keys with the cache
  prefix. These keys are impossible to retrieve from the cache without
  removing the prefix or using the cache without a prefix.
  Now it removes the prefix from the key and only returns keys that
  share the same prefix as the cache.

Test Plan:
- New unit tests

* Add explicit BaseFileCacheModule#keys test

Test that files that do not match the cache prefix are ignored.
Test that the prefix is removed from the cache key.
2021-04-30 15:28:28 -04:00
Sloane Hertel
ce96591313
Remove deprecated cache interfaces ()
* update unit test
* Remove FactCache 'update' method
2021-04-13 11:08:20 -04:00
Rick Elrod
7f62a9d7b5
Make cache adjudicator's flush call plugin flush ()
Change:
- Previously CachePluginAdjudicator#flush only removed entries from the
  cache backend that it knew about by using them earlier. Now it calls
  the underlying plugin's flush() method.

Test Plan:
- New unit tests

Tickets:
- Fixes 

Signed-off-by: Rick Elrod <rick@elrod.me>
2020-08-03 17:16:15 -05:00
Ansible Core Team
4e488d8435 Migrated to community.general 2020-03-23 11:14:21 -05:00
Matt Clay
04666c9fa1
Clean up unit tests to assist with migration. ()
* Split out cache plugin unit tests.

* Rename unit tests to match code under test.

* Relocate unit test code to match code under test.

* Another rename.

* Update sanity ignores.
2020-02-28 20:29:41 -08:00
Enno Gröper
1ed7a654ba Improve testing of FactCache ()
* Improve testing of FactCache
2019-06-10 16:26:24 -04:00
Sloane Hertel
598a058afe
[FactCache] define first_order_merge method ()
* Add first_order_merge method

Add test for updating a key that already exists

* changelog
2019-06-10 14:34:06 -04:00
Sloane Hertel
9687879840
Fix inventory cache interface ()
* Replace InventoryFileCacheModule with a better developer-interface

Use new interface for inventory plugins with backwards compatibility

Auto-update the backing cache-plugin if the cache has changed after parsing the inventory plugin

* Update CacheModules to use the config system and add a deprecation warning if they are being imported directly rather than using cache_loader

* Fix foreman inventory caching

* Add tests

* Add integration test to check that fact caching works normally with cache plugins using ansible.constants and inventory caching provides a helpful error for non-compatible cache plugins

* Add some developer documentation for inventory and cache plugins

* Add user documentation for inventory caching

* Add deprecation docs

* Apply suggestions from docs review

* Add changelog
2019-03-06 12:12:35 -06:00
Matt Clay
3033fd96b0
Move unit test compat code out of lib/ansible/. ()
* Move ansible.compat.tests to test/units/compat/.
* Fix unit test references to ansible.compat.tests.
* Move builtins compat to separate file.
* Fix classification of test/units/compat/ dir.
2018-10-12 20:01:14 -07:00
Toshio Kuratomi
802c9efaa3 Disable abstract-class-instantiated for smoketests
These tests are actually checking that the classes will error out if
they are still abstracted and instantiated
2017-07-25 15:58:23 -07:00
Matt Clay
cb76200c7d PEP 8 E111 & E114 cleanup. () 2017-01-30 15:01:47 -08:00
Adrian Likins
6c4f554f5a Provide slightly better msg on fact cache error ()
If the configured fact_cache plugin (fact_caching config)
fails, raise a fatal error instead of failing mysteriously
later.

Fixes 
2016-12-13 14:34:58 -05:00
Matt Clay
8c270ac75f Add empty-init code-smell script. ()
Also removed boilerplate from otherwise empty __init__.py files
which should not contain any code (checked by empty-init script).
2016-11-07 15:02:13 -08:00
Matt Clay
d2ad17e88f Fixed import typo for memcache module in tests.
The typo caused the test for the memcached cache plugin to be skipped
even when the necessary memcache python module was installed.
2015-12-19 00:08:49 -08:00
Toshio Kuratomi
457f86f61a Minor: Correct type pyhton => python 2015-12-14 08:50:37 -08:00
Marius Gedminas
a32bf1ec18 Simplify FactCache.copy()
Also fix the bug (missing from six import iteritems) I introduced in
823677b490.
2015-09-03 09:44:44 +03:00
James Cammarata
21fa385ce7 Reorganizing plugin unit tests and adding start of strategy tests (v2) 2015-05-18 17:26:59 -07:00