Provide Fake KV Store for Mocking

Bug #1911919 reported by jarred wilson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Charm Helpers
Fix Committed
Undecided
Danny Cocks

Bug Description

It seems that we have run into several issues surrounding race conditions and the concurrency of tox when using the kv store provided by charm helpers. Examples of this can be found below:

https://bugs.launchpad.net/charm-neutron-openvswitch/+bug/1911430
https://bugs.launchpad.net/charm-hacluster/+bug/1908282
https://bugs.launchpad.net/charm-nova-cloud-controller/+bug/1908282

Can we provide a non-SQLite version of the kv for mocking as part of charm helpers? It should reduce the number of independent implementations across our charms.

jarred wilson (jardon)
tags: added: onboarding
tags: added: good-first-bug
Revision history for this message
Cory Johns (johnsca) wrote :

You can make it use an in-memory database by setting this environment var:

UNIT_STATE_DB=:memory:

Or by doing the following before kv() is called:

charmhelpers.core.unitdata._KV = charmhelpers.core.unitdata.Storage(':memory:')

Reference: https://charm-helpers.readthedocs.io/en/latest/api/charmhelpers.core.unitdata.html#charmhelpers.core.unitdata.Storage

tags: removed: onboarding
Danny Cocks (dannycocks)
Changed in charm-helpers:
assignee: nobody → Danny Cocks (dannycocks)
Revision history for this message
Danny Cocks (dannycocks) wrote :
Revision history for this message
Danny Cocks (dannycocks) wrote :

After merging in https://github.com/juju/charm-helpers/pull/823 this should now be addressed for unittests.

Changed in charm-helpers:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.