1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-14 14:32:42 +01:00

Implement realisation operations on dummy store

This commit is contained in:
John Ericson 2025-09-27 16:30:36 -04:00
parent e06968ec25
commit 5592bb717b
5 changed files with 62 additions and 5 deletions

View file

@ -1,6 +1,6 @@
#include <gtest/gtest.h>
#include "nix/store/dummy-store.hh"
#include "nix/store/dummy-store-impl.hh"
#include "nix/store/globals.hh"
#include "nix/store/realisation.hh"
@ -13,7 +13,7 @@ TEST(DummyStore, realisation_read)
auto store = [] {
auto cfg = make_ref<DummyStoreConfig>(StoreReference::Params{});
cfg->readOnly = false;
return cfg->openStore();
return cfg->openDummyStore();
}();
auto drvHash = Hash::parseExplicitFormatUnprefixed(
@ -22,6 +22,17 @@ TEST(DummyStore, realisation_read)
auto outputName = "foo";
EXPECT_EQ(store->queryRealisation({drvHash, outputName}), nullptr);
UnkeyedRealisation value{
.outPath = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv"},
};
store->buildTrace.insert({drvHash, {{outputName, make_ref<UnkeyedRealisation>(value)}}});
auto value2 = store->queryRealisation({drvHash, outputName});
ASSERT_TRUE(value2);
EXPECT_EQ(*value2, value);
}
} // namespace nix