mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 14:32:42 +01:00
Expose some core implementation details and write a basic unit test for the dummy store
This test currently doesn't use the new-exposed functionality, but with future changes the tests will be expanded and they will be used.
This commit is contained in:
parent
d76dc2406f
commit
9ac306c4df
6 changed files with 87 additions and 20 deletions
27
src/libstore-tests/dummy-store.cc
Normal file
27
src/libstore-tests/dummy-store.cc
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "nix/store/dummy-store.hh"
|
||||
#include "nix/store/globals.hh"
|
||||
#include "nix/store/realisation.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
TEST(DummyStore, realisation_read)
|
||||
{
|
||||
initLibStore(/*loadConfig=*/false);
|
||||
|
||||
auto store = [] {
|
||||
auto cfg = make_ref<DummyStoreConfig>(StoreReference::Params{});
|
||||
cfg->readOnly = false;
|
||||
return cfg->openStore();
|
||||
}();
|
||||
|
||||
auto drvHash = Hash::parseExplicitFormatUnprefixed(
|
||||
"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", HashAlgorithm::SHA256, HashFormat::Base16);
|
||||
|
||||
auto outputName = "foo";
|
||||
|
||||
EXPECT_EQ(store->queryRealisation({drvHash, outputName}), nullptr);
|
||||
}
|
||||
|
||||
} // namespace nix
|
||||
|
|
@ -61,6 +61,7 @@ sources = files(
|
|||
'derivation.cc',
|
||||
'derived-path.cc',
|
||||
'downstream-placeholder.cc',
|
||||
'dummy-store.cc',
|
||||
'http-binary-cache-store.cc',
|
||||
'legacy-ssh-store.cc',
|
||||
'local-binary-cache-store.cc',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue