aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorjade <lix@jade.fyi>2024-06-17 22:08:48 +0000
committerGerrit Code Review <gerrit@localhost>2024-06-17 22:08:48 +0000
commitce2b48aa41ed8e6f3eed60a20e3e2afb244457b6 (patch)
tree4f00ca96dfb58bcbf35ce9ccc67407e143d30fec /tests/unit
parentbcb774688feea4e1fc7919d4890361f4f8ea1f60 (diff)
parentc1f2733dd63eb04a8a192da72835b15f9363869f (diff)
Merge changes from topic "protocol" into main
* changes: libstore client: remove remaining dead code libstore: refuse to serialise ancient protocols libstore client: remove support for <2.3 clients libstore daemon: remove very old protocol support (<2.3) Delete old ValidPathInfo test, fix UnkeyedValidPathInfo Set up minimum protocol version
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/libstore/data/libstore/worker-protocol/unkeyed-valid-path-info-1.15.binbin328 -> 0 bytes
-rw-r--r--tests/unit/libstore/data/libstore/worker-protocol/unkeyed-valid-path-info.binbin0 -> 376 bytes
-rw-r--r--tests/unit/libstore/data/libstore/worker-protocol/valid-path-info-1.15.binbin488 -> 0 bytes
-rw-r--r--tests/unit/libstore/data/libstore/worker-protocol/valid-path-info.bin (renamed from tests/unit/libstore/data/libstore/worker-protocol/valid-path-info-1.16.bin)bin952 -> 952 bytes
-rw-r--r--tests/unit/libstore/protocol.hh11
-rw-r--r--tests/unit/libstore/worker-protocol.cc63
6 files changed, 11 insertions, 63 deletions
diff --git a/tests/unit/libstore/data/libstore/worker-protocol/unkeyed-valid-path-info-1.15.bin b/tests/unit/libstore/data/libstore/worker-protocol/unkeyed-valid-path-info-1.15.bin
deleted file mode 100644
index e69ccbe83..000000000
--- a/tests/unit/libstore/data/libstore/worker-protocol/unkeyed-valid-path-info-1.15.bin
+++ /dev/null
Binary files differ
diff --git a/tests/unit/libstore/data/libstore/worker-protocol/unkeyed-valid-path-info.bin b/tests/unit/libstore/data/libstore/worker-protocol/unkeyed-valid-path-info.bin
new file mode 100644
index 000000000..7bf72e0f4
--- /dev/null
+++ b/tests/unit/libstore/data/libstore/worker-protocol/unkeyed-valid-path-info.bin
Binary files differ
diff --git a/tests/unit/libstore/data/libstore/worker-protocol/valid-path-info-1.15.bin b/tests/unit/libstore/data/libstore/worker-protocol/valid-path-info-1.15.bin
deleted file mode 100644
index 7adc8dd44..000000000
--- a/tests/unit/libstore/data/libstore/worker-protocol/valid-path-info-1.15.bin
+++ /dev/null
Binary files differ
diff --git a/tests/unit/libstore/data/libstore/worker-protocol/valid-path-info-1.16.bin b/tests/unit/libstore/data/libstore/worker-protocol/valid-path-info.bin
index a72de6bd6..a72de6bd6 100644
--- a/tests/unit/libstore/data/libstore/worker-protocol/valid-path-info-1.16.bin
+++ b/tests/unit/libstore/data/libstore/worker-protocol/valid-path-info.bin
Binary files differ
diff --git a/tests/unit/libstore/protocol.hh b/tests/unit/libstore/protocol.hh
index 7fdd3e11c..f480f4ad1 100644
--- a/tests/unit/libstore/protocol.hh
+++ b/tests/unit/libstore/protocol.hh
@@ -39,10 +39,8 @@ public:
StringSource from { expected };
Proto::template Serialise<T>::read(
*LibStoreTest::store,
- typename Proto::ReadConn {
- .from = from,
- .version = version,
- });
+ typename Proto::ReadConn {from, version}
+ );
});
ASSERT_EQ(got, value);
@@ -60,10 +58,7 @@ public:
StringSink to;
Proto::write(
*LibStoreTest::store,
- typename Proto::WriteConn {
- .to = to,
- .version = version,
- },
+ typename Proto::WriteConn {to, version},
value);
if (testAccept())
diff --git a/tests/unit/libstore/worker-protocol.cc b/tests/unit/libstore/worker-protocol.cc
index 2d6fbd58f..f36de9cf9 100644
--- a/tests/unit/libstore/worker-protocol.cc
+++ b/tests/unit/libstore/worker-protocol.cc
@@ -18,9 +18,9 @@ struct WorkerProtoTest : VersionedProtoTest<WorkerProto, workerProtoDir>
{
/**
* For serializers that don't care about the minimum version, we
- * used the oldest one: 1.0.
+ * have to use the minimum supported to not throw an assert.
*/
- WorkerProto::Version defaultVersion = 1 << 8 | 0;
+ WorkerProto::Version defaultVersion = MIN_SUPPORTED_WORKER_PROTO_VERSION;
};
@@ -331,9 +331,9 @@ VERSIONED_CHARACTERIZATION_TEST(
VERSIONED_CHARACTERIZATION_TEST(
WorkerProtoTest,
- unkeyedValidPathInfo_1_15,
- "unkeyed-valid-path-info-1.15",
- 1 << 8 | 15,
+ unkeyedValidPathInfo,
+ "unkeyed-valid-path-info",
+ defaultVersion,
(std::tuple<UnkeyedValidPathInfo, UnkeyedValidPathInfo> {
({
UnkeyedValidPathInfo info {
@@ -363,56 +363,9 @@ VERSIONED_CHARACTERIZATION_TEST(
VERSIONED_CHARACTERIZATION_TEST(
WorkerProtoTest,
- validPathInfo_1_15,
- "valid-path-info-1.15",
- 1 << 8 | 15,
- (std::tuple<ValidPathInfo, ValidPathInfo> {
- ({
- ValidPathInfo info {
- StorePath {
- "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
- },
- UnkeyedValidPathInfo {
- Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
- },
- };
- info.registrationTime = 23423;
- info.narSize = 34878;
- info;
- }),
- ({
- ValidPathInfo info {
- StorePath {
- "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
- },
- UnkeyedValidPathInfo {
- Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
- },
- };
- info.deriver = StorePath {
- "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
- };
- info.references = {
- // other reference
- StorePath {
- "g1w7hyyyy1w7hy3qg1w7hy3qgqqqqy3q-foo",
- },
- // self reference
- StorePath {
- "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
- },
- };
- info.registrationTime = 23423;
- info.narSize = 34878;
- info;
- }),
- }))
-
-VERSIONED_CHARACTERIZATION_TEST(
- WorkerProtoTest,
- validPathInfo_1_16,
- "valid-path-info-1.16",
- 1 << 8 | 16,
+ validPathInfo,
+ "valid-path-info",
+ defaultVersion,
(std::tuple<ValidPathInfo, ValidPathInfo, ValidPathInfo> {
({
ValidPathInfo info {