mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
Factor out ServeProto::Serialiser<UnkeyedValidPathInfo>
and test
In the process, partially undo e89b5bd0bf
in that the ancient < 2.4 version is now supported again by the
serializer again. `LegacySSHStore`, instead of also asserting that the
version is at least 4, just checks that `narHash` is set.
This allows us to better test the serializer in isolation for both
versions (< 4 and >= 4).
This commit is contained in:
parent
c3827ff634
commit
a5521b7d94
7 changed files with 131 additions and 27 deletions
|
@ -225,6 +225,83 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
t;
|
||||
}))
|
||||
|
||||
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(HashAlgorithm::SHA256, "(...)"),
|
||||
.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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue