From 24255748b484984b5fed21c75e0cf836524a4916 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Fri, 24 May 2024 20:45:05 -0600 Subject: Delete old ValidPathInfo test, fix UnkeyedValidPathInfo The UnkeyedValidPathInfo test was testing an ancient version but not the current version. Doesn't make much sense to me. Change-Id: Ib476a4297d9075f2dcd31a073b3e7b149b2189af --- .../unkeyed-valid-path-info-1.15.bin | Bin 328 -> 0 bytes .../worker-protocol/unkeyed-valid-path-info.bin | Bin 0 -> 376 bytes .../worker-protocol/valid-path-info-1.15.bin | Bin 488 -> 0 bytes .../worker-protocol/valid-path-info-1.16.bin | Bin 952 -> 0 bytes .../libstore/worker-protocol/valid-path-info.bin | Bin 0 -> 952 bytes tests/unit/libstore/worker-protocol.cc | 63 +++------------------ 6 files changed, 8 insertions(+), 55 deletions(-) delete mode 100644 tests/unit/libstore/data/libstore/worker-protocol/unkeyed-valid-path-info-1.15.bin create mode 100644 tests/unit/libstore/data/libstore/worker-protocol/unkeyed-valid-path-info.bin delete mode 100644 tests/unit/libstore/data/libstore/worker-protocol/valid-path-info-1.15.bin delete mode 100644 tests/unit/libstore/data/libstore/worker-protocol/valid-path-info-1.16.bin create mode 100644 tests/unit/libstore/data/libstore/worker-protocol/valid-path-info.bin (limited to 'tests') 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 Binary files a/tests/unit/libstore/data/libstore/worker-protocol/unkeyed-valid-path-info-1.15.bin and /dev/null 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 Binary files /dev/null and b/tests/unit/libstore/data/libstore/worker-protocol/unkeyed-valid-path-info.bin 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 Binary files a/tests/unit/libstore/data/libstore/worker-protocol/valid-path-info-1.15.bin and /dev/null 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-1.16.bin deleted file mode 100644 index a72de6bd6..000000000 Binary files a/tests/unit/libstore/data/libstore/worker-protocol/valid-path-info-1.16.bin and /dev/null differ diff --git a/tests/unit/libstore/data/libstore/worker-protocol/valid-path-info.bin b/tests/unit/libstore/data/libstore/worker-protocol/valid-path-info.bin new file mode 100644 index 000000000..a72de6bd6 Binary files /dev/null and b/tests/unit/libstore/data/libstore/worker-protocol/valid-path-info.bin differ 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 { /** * 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 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 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 info { -- cgit v1.2.3 From c22a7f50cb4a476f0c276d8e0d2194da5144ce92 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Fri, 24 May 2024 20:45:05 -0600 Subject: libstore: refuse to serialise ancient protocols We don't want to deal with these at all, let's stop doing so. (marking this one as the fix commit since its immediate predecessors aren't the complete fix) Fixes: https://git.lix.systems/lix-project/lix/issues/325 Change-Id: Ieea1b0b8ac0f903d1e24e5b3e63cfe12eeec119d --- tests/unit/libstore/protocol.hh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'tests') 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::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()) -- cgit v1.2.3