aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/libstore
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-07 12:37:33 +0100
committereldritch horrors <pennae@lix.systems>2024-03-07 12:37:33 +0100
commit8a268359b06471b463a8f3fc46c83a1fced8ab75 (patch)
treeb9a854b5faf432d158a449ec3f14146e4e6db00d /tests/unit/libstore
parent9eb58f5209f9cd1fd18f33b691c6a613075dffc4 (diff)
Merge pull request #9560 from obsidiansystems/serve-proto-unkeyed-valid-path-info-serializer
Factor out `ServeProto::Serialiser<UnkeyedValidPathInfo>` and test (cherry picked from commit 139982997eec493a0f74105c427953f6be77da6d) Change-Id: I28e4ba5a681a90d81915a56e6dbaa5456d64f96d
Diffstat (limited to 'tests/unit/libstore')
-rw-r--r--tests/unit/libstore/serve-protocol.cc77
1 files changed, 77 insertions, 0 deletions
diff --git a/tests/unit/libstore/serve-protocol.cc b/tests/unit/libstore/serve-protocol.cc
index b67b19dbf..138f31b47 100644
--- a/tests/unit/libstore/serve-protocol.cc
+++ b/tests/unit/libstore/serve-protocol.cc
@@ -227,6 +227,83 @@ VERSIONED_CHARACTERIZATION_TEST(
VERSIONED_CHARACTERIZATION_TEST(
ServeProtoTest,
+ unkeyedValidPathInfo_2_3,
+ "unkeyed-valid-path-info-2.3",
+ 2 << 8 | 3,
+ (std::tuple<UnkeyedValidPathInfo, UnkeyedValidPathInfo> {
+ ({
+ UnkeyedValidPathInfo info { Hash::dummy };
+ info.narSize = 34878;
+ info;
+ }),
+ ({
+ UnkeyedValidPathInfo info { Hash::dummy };
+ info.deriver = StorePath {
+ "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
+ };
+ info.references = {
+ StorePath {
+ "g1w7hyyyy1w7hy3qg1w7hy3qgqqqqy3q-foo.drv",
+ },
+ };
+ info.narSize = 34878;
+ info;
+ }),
+ }))
+
+VERSIONED_CHARACTERIZATION_TEST(
+ ServeProtoTest,
+ unkeyedValidPathInfo_2_4,
+ "unkeyed-valid-path-info-2.4",
+ 2 << 8 | 4,
+ (std::tuple<UnkeyedValidPathInfo, UnkeyedValidPathInfo> {
+ ({
+ UnkeyedValidPathInfo info {
+ Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
+ };
+ info.deriver = StorePath {
+ "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
+ };
+ info.references = {
+ StorePath {
+ "g1w7hyyyy1w7hy3qg1w7hy3qgqqqqy3q-foo.drv",
+ },
+ };
+ info.narSize = 34878;
+ info;
+ }),
+ ({
+ ValidPathInfo info {
+ *LibStoreTest::store,
+ "foo",
+ FixedOutputInfo {
+ .method = FileIngestionMethod::Recursive,
+ .hash = hashString(HashType::htSHA256, "(...)"),
+ .references = {
+ .others = {
+ StorePath {
+ "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
+ },
+ },
+ .self = true,
+ },
+ },
+ Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
+ };
+ info.deriver = StorePath {
+ "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
+ };
+ info.narSize = 34878;
+ info.sigs = {
+ "fake-sig-1",
+ "fake-sig-2",
+ },
+ static_cast<UnkeyedValidPathInfo>(std::move(info));
+ }),
+ }))
+
+VERSIONED_CHARACTERIZATION_TEST(
+ ServeProtoTest,
vector,
"vector",
defaultVersion,