Open jwiegley opened 6 years ago
Greg and I have already talked about both a readonly and true mock version of hnix-store, so once that's ready the only effects necessary to mock on the hnix end will be file import and downloading I think.
Mocking downloading seems like it will be really useful in the future for making a --offline
option that doesn't need the internet.
I believe @ryantrinkle is working on this?
I'd like to build a mocking platform for
hnix
. This would have the following benefits:It would work in all its various modes, you'd just need to specify
--mock
and pass it a Nix file declaring the contents of the store.It would give us a set of "known store contents" to run tests against.
The mocked store could reside in memory, isolating the system's store from accumulating cruft during testing (right now, a lot of bogus stuff gets added due to calls to
addPath
).The mocked store, being in memory, could run at a much higher speed, which is needed for testing options like
--find
.I see this work consisting of a few parts:
[ ] Create a variant of
MonadEffects
andLazy
to implement the Mock store and ensure there are no other effects allowed other than a newMonadStore
interface (i.e., noMonadIO
in this mode).[ ] Write the code that takes a Nix file describing the contents of the store, and which can instantiate this store given a
MonadStore
instance.[ ] Evolve
MonadStore
into what we'd use for talking to the real store via its wire protocol.[ ] Add a new
--mock FILE
option to enable this machinery.I then imagine we would always run the tests against a mocked store, meaning that a build + test cycle of
hnix
should never have any impact on the system outside of the Cabaldist
directory.