2024-03-04 03:46:48 +01:00
|
|
|
#include <regex>
|
|
|
|
|
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
#include "worker-protocol.hh"
|
|
|
|
#include "worker-protocol-impl.hh"
|
|
|
|
#include "derived-path.hh"
|
2024-03-04 03:48:50 +01:00
|
|
|
#include "build-result.hh"
|
2024-03-04 04:24:23 +01:00
|
|
|
#include "protocol.hh"
|
2024-03-10 09:32:43 +01:00
|
|
|
#include "tests/characterization.hh"
|
2024-03-04 03:46:48 +01:00
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
2024-03-04 04:24:23 +01:00
|
|
|
const char workerProtoDir[] = "worker-protocol";
|
2024-03-04 03:46:48 +01:00
|
|
|
|
2023-10-20 15:34:26 +02:00
|
|
|
struct WorkerProtoTest : VersionedProtoTest<WorkerProto, workerProtoDir>
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* For serializers that don't care about the minimum version, we
|
2024-05-25 04:45:05 +02:00
|
|
|
* have to use the minimum supported to not throw an assert.
|
2023-10-20 15:34:26 +02:00
|
|
|
*/
|
2024-05-25 04:45:05 +02:00
|
|
|
WorkerProto::Version defaultVersion = MIN_SUPPORTED_WORKER_PROTO_VERSION;
|
2023-10-20 15:34:26 +02:00
|
|
|
};
|
2024-03-04 03:46:48 +01:00
|
|
|
|
2023-10-20 15:34:26 +02:00
|
|
|
|
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
2024-03-04 04:24:23 +01:00
|
|
|
WorkerProtoTest,
|
2024-03-04 03:46:48 +01:00
|
|
|
string,
|
|
|
|
"string",
|
2023-10-20 15:34:26 +02:00
|
|
|
defaultVersion,
|
2024-03-04 03:46:48 +01:00
|
|
|
(std::tuple<std::string, std::string, std::string, std::string, std::string> {
|
|
|
|
"",
|
|
|
|
"hi",
|
|
|
|
"white rabbit",
|
|
|
|
"大白兔",
|
|
|
|
"oh no \0\0\0 what was that!",
|
|
|
|
}))
|
|
|
|
|
2023-10-20 15:34:26 +02:00
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
2024-03-04 04:24:23 +01:00
|
|
|
WorkerProtoTest,
|
2024-03-04 03:46:48 +01:00
|
|
|
storePath,
|
|
|
|
"store-path",
|
2023-10-20 15:34:26 +02:00
|
|
|
defaultVersion,
|
2024-03-04 03:46:48 +01:00
|
|
|
(std::tuple<StorePath, StorePath> {
|
|
|
|
StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
|
|
|
StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo-bar" },
|
|
|
|
}))
|
|
|
|
|
2023-10-20 15:34:26 +02:00
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
2024-03-04 04:24:23 +01:00
|
|
|
WorkerProtoTest,
|
2024-03-04 03:46:48 +01:00
|
|
|
contentAddress,
|
|
|
|
"content-address",
|
2023-10-20 15:34:26 +02:00
|
|
|
defaultVersion,
|
2024-03-04 03:46:48 +01:00
|
|
|
(std::tuple<ContentAddress, ContentAddress, ContentAddress> {
|
|
|
|
ContentAddress {
|
|
|
|
.method = TextIngestionMethod {},
|
2024-08-01 22:42:02 +02:00
|
|
|
.hash = hashString(HashType::SHA256, "Derive(...)"),
|
2024-03-04 03:46:48 +01:00
|
|
|
},
|
|
|
|
ContentAddress {
|
|
|
|
.method = FileIngestionMethod::Flat,
|
2024-08-01 22:42:02 +02:00
|
|
|
.hash = hashString(HashType::SHA1, "blob blob..."),
|
2024-03-04 03:46:48 +01:00
|
|
|
},
|
|
|
|
ContentAddress {
|
|
|
|
.method = FileIngestionMethod::Recursive,
|
2024-08-01 22:42:02 +02:00
|
|
|
.hash = hashString(HashType::SHA256, "(...)"),
|
2024-03-04 03:46:48 +01:00
|
|
|
},
|
|
|
|
}))
|
|
|
|
|
2023-10-20 15:34:26 +02:00
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
2024-03-04 04:24:23 +01:00
|
|
|
WorkerProtoTest,
|
2024-03-04 04:59:31 +01:00
|
|
|
derivedPath_1_29,
|
|
|
|
"derived-path-1.29",
|
|
|
|
1 << 8 | 29,
|
|
|
|
(std::tuple<DerivedPath, DerivedPath, DerivedPath> {
|
2024-03-04 03:46:48 +01:00
|
|
|
DerivedPath::Opaque {
|
|
|
|
.path = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
|
|
|
},
|
2024-03-04 04:59:31 +01:00
|
|
|
DerivedPath::Built {
|
|
|
|
.drvPath = makeConstantStorePathRef(StorePath {
|
|
|
|
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
|
|
|
}),
|
|
|
|
.outputs = OutputsSpec::All { },
|
|
|
|
},
|
|
|
|
DerivedPath::Built {
|
|
|
|
.drvPath = makeConstantStorePathRef(StorePath {
|
|
|
|
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
|
|
|
}),
|
|
|
|
.outputs = OutputsSpec::Names { "x", "y" },
|
|
|
|
},
|
|
|
|
}))
|
|
|
|
|
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
|
|
|
WorkerProtoTest,
|
|
|
|
derivedPath_1_30,
|
|
|
|
"derived-path-1.30",
|
|
|
|
1 << 8 | 30,
|
|
|
|
(std::tuple<DerivedPath, DerivedPath, DerivedPath, DerivedPath> {
|
|
|
|
DerivedPath::Opaque {
|
|
|
|
.path = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
|
|
|
},
|
|
|
|
DerivedPath::Opaque {
|
|
|
|
.path = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv" },
|
|
|
|
},
|
|
|
|
DerivedPath::Built {
|
|
|
|
.drvPath = makeConstantStorePathRef(StorePath {
|
|
|
|
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
|
|
|
}),
|
|
|
|
.outputs = OutputsSpec::All { },
|
|
|
|
},
|
2024-03-04 03:46:48 +01:00
|
|
|
DerivedPath::Built {
|
|
|
|
.drvPath = makeConstantStorePathRef(StorePath {
|
|
|
|
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
|
|
|
}),
|
|
|
|
.outputs = OutputsSpec::Names { "x", "y" },
|
|
|
|
},
|
|
|
|
}))
|
|
|
|
|
2023-10-20 15:34:26 +02:00
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
2024-03-04 04:24:23 +01:00
|
|
|
WorkerProtoTest,
|
2024-03-04 03:48:50 +01:00
|
|
|
drvOutput,
|
|
|
|
"drv-output",
|
2023-10-20 15:34:26 +02:00
|
|
|
defaultVersion,
|
2024-03-04 03:48:50 +01:00
|
|
|
(std::tuple<DrvOutput, DrvOutput> {
|
|
|
|
{
|
|
|
|
.drvHash = Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
|
|
|
.outputName = "baz",
|
|
|
|
},
|
|
|
|
DrvOutput {
|
|
|
|
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
|
|
|
.outputName = "quux",
|
|
|
|
},
|
|
|
|
}))
|
|
|
|
|
2023-10-20 15:34:26 +02:00
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
2024-03-04 04:24:23 +01:00
|
|
|
WorkerProtoTest,
|
2024-03-04 03:48:50 +01:00
|
|
|
realisation,
|
|
|
|
"realisation",
|
2023-10-20 15:34:26 +02:00
|
|
|
defaultVersion,
|
2024-03-04 03:48:50 +01:00
|
|
|
(std::tuple<Realisation, Realisation> {
|
|
|
|
Realisation {
|
|
|
|
.id = DrvOutput {
|
|
|
|
.drvHash = Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
|
|
|
.outputName = "baz",
|
|
|
|
},
|
|
|
|
.outPath = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
|
|
|
.signatures = { "asdf", "qwer" },
|
|
|
|
},
|
|
|
|
Realisation {
|
|
|
|
.id = {
|
|
|
|
.drvHash = Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
|
|
|
.outputName = "baz",
|
|
|
|
},
|
|
|
|
.outPath = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
|
|
|
.signatures = { "asdf", "qwer" },
|
|
|
|
.dependentRealisations = {
|
|
|
|
{
|
|
|
|
DrvOutput {
|
|
|
|
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
|
|
|
.outputName = "quux",
|
|
|
|
},
|
|
|
|
StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}))
|
|
|
|
|
2023-10-20 15:34:26 +02:00
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
2024-03-04 04:24:23 +01:00
|
|
|
WorkerProtoTest,
|
2024-03-04 04:59:31 +01:00
|
|
|
buildResult_1_27,
|
|
|
|
"build-result-1.27",
|
|
|
|
1 << 8 | 27,
|
|
|
|
({
|
|
|
|
using namespace std::literals::chrono_literals;
|
|
|
|
std::tuple<BuildResult, BuildResult, BuildResult> t {
|
|
|
|
BuildResult {
|
|
|
|
.status = BuildResult::OutputRejected,
|
|
|
|
.errorMsg = "no idea why",
|
|
|
|
},
|
|
|
|
BuildResult {
|
|
|
|
.status = BuildResult::NotDeterministic,
|
|
|
|
.errorMsg = "no idea why",
|
|
|
|
},
|
|
|
|
BuildResult {
|
|
|
|
.status = BuildResult::Built,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
t;
|
|
|
|
}))
|
|
|
|
|
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
|
|
|
WorkerProtoTest,
|
|
|
|
buildResult_1_28,
|
|
|
|
"build-result-1.28",
|
|
|
|
1 << 8 | 28,
|
|
|
|
({
|
|
|
|
using namespace std::literals::chrono_literals;
|
|
|
|
std::tuple<BuildResult, BuildResult, BuildResult> t {
|
|
|
|
BuildResult {
|
|
|
|
.status = BuildResult::OutputRejected,
|
|
|
|
.errorMsg = "no idea why",
|
|
|
|
},
|
|
|
|
BuildResult {
|
|
|
|
.status = BuildResult::NotDeterministic,
|
|
|
|
.errorMsg = "no idea why",
|
|
|
|
},
|
|
|
|
BuildResult {
|
|
|
|
.status = BuildResult::Built,
|
|
|
|
.builtOutputs = {
|
|
|
|
{
|
|
|
|
"foo",
|
|
|
|
{
|
|
|
|
.id = DrvOutput {
|
|
|
|
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
|
|
|
.outputName = "foo",
|
|
|
|
},
|
|
|
|
.outPath = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"bar",
|
|
|
|
{
|
|
|
|
.id = DrvOutput {
|
|
|
|
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
|
|
|
.outputName = "bar",
|
|
|
|
},
|
|
|
|
.outPath = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
t;
|
|
|
|
}))
|
|
|
|
|
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
|
|
|
WorkerProtoTest,
|
|
|
|
buildResult_1_29,
|
|
|
|
"build-result-1.29",
|
|
|
|
1 << 8 | 29,
|
2024-03-04 03:48:50 +01:00
|
|
|
({
|
|
|
|
using namespace std::literals::chrono_literals;
|
2024-03-04 03:49:09 +01:00
|
|
|
std::tuple<BuildResult, BuildResult, BuildResult> t {
|
2024-03-04 03:48:50 +01:00
|
|
|
BuildResult {
|
|
|
|
.status = BuildResult::OutputRejected,
|
|
|
|
.errorMsg = "no idea why",
|
|
|
|
},
|
|
|
|
BuildResult {
|
|
|
|
.status = BuildResult::NotDeterministic,
|
|
|
|
.errorMsg = "no idea why",
|
|
|
|
.timesBuilt = 3,
|
|
|
|
.isNonDeterministic = true,
|
|
|
|
.startTime = 30,
|
|
|
|
.stopTime = 50,
|
|
|
|
},
|
|
|
|
BuildResult {
|
|
|
|
.status = BuildResult::Built,
|
|
|
|
.timesBuilt = 1,
|
|
|
|
.builtOutputs = {
|
|
|
|
{
|
|
|
|
"foo",
|
|
|
|
{
|
|
|
|
.id = DrvOutput {
|
|
|
|
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
|
|
|
.outputName = "foo",
|
|
|
|
},
|
|
|
|
.outPath = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"bar",
|
|
|
|
{
|
|
|
|
.id = DrvOutput {
|
|
|
|
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
|
|
|
.outputName = "bar",
|
|
|
|
},
|
|
|
|
.outPath = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.startTime = 30,
|
|
|
|
.stopTime = 50,
|
2024-03-04 03:49:09 +01:00
|
|
|
#if 0
|
|
|
|
// These fields are not yet serialized.
|
|
|
|
// FIXME Include in next version of protocol or document
|
|
|
|
// why they are skipped.
|
2024-03-04 03:48:50 +01:00
|
|
|
.cpuUser = std::chrono::milliseconds(500s),
|
|
|
|
.cpuSystem = std::chrono::milliseconds(604s),
|
|
|
|
#endif
|
2024-03-04 03:49:09 +01:00
|
|
|
},
|
2024-03-04 03:48:50 +01:00
|
|
|
};
|
|
|
|
t;
|
|
|
|
}))
|
|
|
|
|
2023-10-20 15:34:26 +02:00
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
2024-03-04 04:24:23 +01:00
|
|
|
WorkerProtoTest,
|
2024-03-04 04:59:31 +01:00
|
|
|
keyedBuildResult_1_29,
|
|
|
|
"keyed-build-result-1.29",
|
|
|
|
1 << 8 | 29,
|
2024-03-04 03:48:50 +01:00
|
|
|
({
|
|
|
|
using namespace std::literals::chrono_literals;
|
|
|
|
std::tuple<KeyedBuildResult, KeyedBuildResult/*, KeyedBuildResult*/> t {
|
|
|
|
KeyedBuildResult {
|
|
|
|
{
|
|
|
|
.status = KeyedBuildResult::OutputRejected,
|
|
|
|
.errorMsg = "no idea why",
|
|
|
|
},
|
|
|
|
/* .path = */ DerivedPath::Opaque {
|
|
|
|
StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-xxx" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
KeyedBuildResult {
|
|
|
|
{
|
|
|
|
.status = KeyedBuildResult::NotDeterministic,
|
|
|
|
.errorMsg = "no idea why",
|
|
|
|
.timesBuilt = 3,
|
|
|
|
.isNonDeterministic = true,
|
|
|
|
.startTime = 30,
|
|
|
|
.stopTime = 50,
|
|
|
|
},
|
|
|
|
/* .path = */ DerivedPath::Built {
|
|
|
|
.drvPath = makeConstantStorePathRef(StorePath {
|
|
|
|
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
|
|
|
}),
|
|
|
|
.outputs = OutputsSpec::Names { "out" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
t;
|
|
|
|
}))
|
|
|
|
|
2024-03-04 04:59:31 +01:00
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
|
|
|
WorkerProtoTest,
|
2024-05-25 04:45:05 +02:00
|
|
|
unkeyedValidPathInfo,
|
|
|
|
"unkeyed-valid-path-info",
|
|
|
|
defaultVersion,
|
2024-03-04 04:59:31 +01:00
|
|
|
(std::tuple<UnkeyedValidPathInfo, UnkeyedValidPathInfo> {
|
|
|
|
({
|
|
|
|
UnkeyedValidPathInfo info {
|
|
|
|
Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
|
|
|
};
|
|
|
|
info.registrationTime = 23423;
|
|
|
|
info.narSize = 34878;
|
|
|
|
info;
|
|
|
|
}),
|
|
|
|
({
|
|
|
|
UnkeyedValidPathInfo info {
|
|
|
|
Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
|
|
|
};
|
|
|
|
info.deriver = StorePath {
|
|
|
|
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
|
|
|
};
|
|
|
|
info.references = {
|
|
|
|
StorePath {
|
|
|
|
"g1w7hyyyy1w7hy3qg1w7hy3qgqqqqy3q-foo.drv",
|
|
|
|
},
|
|
|
|
};
|
|
|
|
info.registrationTime = 23423;
|
|
|
|
info.narSize = 34878;
|
|
|
|
info;
|
|
|
|
}),
|
|
|
|
}))
|
|
|
|
|
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
|
|
|
WorkerProtoTest,
|
2024-05-25 04:45:05 +02:00
|
|
|
validPathInfo,
|
|
|
|
"valid-path-info",
|
|
|
|
defaultVersion,
|
2024-03-04 04:59:31 +01:00
|
|
|
(std::tuple<ValidPathInfo, ValidPathInfo, ValidPathInfo> {
|
|
|
|
({
|
|
|
|
ValidPathInfo info {
|
|
|
|
StorePath {
|
|
|
|
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
|
|
|
|
},
|
|
|
|
UnkeyedValidPathInfo {
|
|
|
|
Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
|
|
|
},
|
|
|
|
};
|
|
|
|
info.registrationTime = 23423;
|
|
|
|
info.narSize = 34878;
|
|
|
|
info.ultimate = true;
|
|
|
|
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.sigs = {
|
|
|
|
"fake-sig-1",
|
|
|
|
"fake-sig-2",
|
|
|
|
},
|
|
|
|
info;
|
|
|
|
}),
|
|
|
|
({
|
|
|
|
ValidPathInfo info {
|
|
|
|
*LibStoreTest::store,
|
|
|
|
"foo",
|
|
|
|
FixedOutputInfo {
|
|
|
|
.method = FileIngestionMethod::Recursive,
|
2024-08-01 22:42:02 +02:00
|
|
|
.hash = hashString(HashType::SHA256, "(...)"),
|
2024-03-04 04:59:31 +01:00
|
|
|
.references = {
|
|
|
|
.others = {
|
|
|
|
StorePath {
|
|
|
|
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.self = true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
|
|
|
};
|
|
|
|
info.registrationTime = 23423;
|
|
|
|
info.narSize = 34878;
|
|
|
|
info;
|
|
|
|
}),
|
|
|
|
}))
|
|
|
|
|
2023-10-20 15:34:26 +02:00
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
2024-03-04 04:24:23 +01:00
|
|
|
WorkerProtoTest,
|
2024-03-04 03:48:50 +01:00
|
|
|
optionalTrustedFlag,
|
|
|
|
"optional-trusted-flag",
|
2023-10-20 15:34:26 +02:00
|
|
|
defaultVersion,
|
2024-03-04 03:48:50 +01:00
|
|
|
(std::tuple<std::optional<TrustedFlag>, std::optional<TrustedFlag>, std::optional<TrustedFlag>> {
|
|
|
|
std::nullopt,
|
|
|
|
std::optional { Trusted },
|
|
|
|
std::optional { NotTrusted },
|
|
|
|
}))
|
|
|
|
|
2023-10-20 15:34:26 +02:00
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
2024-03-04 04:24:23 +01:00
|
|
|
WorkerProtoTest,
|
2024-03-04 03:48:50 +01:00
|
|
|
vector,
|
|
|
|
"vector",
|
2023-10-20 15:34:26 +02:00
|
|
|
defaultVersion,
|
2024-03-04 03:48:50 +01:00
|
|
|
(std::tuple<std::vector<std::string>, std::vector<std::string>, std::vector<std::string>, std::vector<std::vector<std::string>>> {
|
|
|
|
{ },
|
|
|
|
{ "" },
|
|
|
|
{ "", "foo", "bar" },
|
|
|
|
{ {}, { "" }, { "", "1", "2" } },
|
|
|
|
}))
|
|
|
|
|
2023-10-20 15:34:26 +02:00
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
2024-03-04 04:24:23 +01:00
|
|
|
WorkerProtoTest,
|
2024-03-04 03:48:50 +01:00
|
|
|
set,
|
|
|
|
"set",
|
2023-10-20 15:34:26 +02:00
|
|
|
defaultVersion,
|
2024-03-04 03:48:50 +01:00
|
|
|
(std::tuple<std::set<std::string>, std::set<std::string>, std::set<std::string>, std::set<std::set<std::string>>> {
|
|
|
|
{ },
|
|
|
|
{ "" },
|
|
|
|
{ "", "foo", "bar" },
|
|
|
|
{ {}, { "" }, { "", "1", "2" } },
|
|
|
|
}))
|
|
|
|
|
2023-10-20 15:34:26 +02:00
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
2024-03-04 04:24:23 +01:00
|
|
|
WorkerProtoTest,
|
2024-03-04 03:48:50 +01:00
|
|
|
optionalStorePath,
|
|
|
|
"optional-store-path",
|
2023-10-20 15:34:26 +02:00
|
|
|
defaultVersion,
|
2024-03-04 03:48:50 +01:00
|
|
|
(std::tuple<std::optional<StorePath>, std::optional<StorePath>> {
|
|
|
|
std::nullopt,
|
|
|
|
std::optional {
|
|
|
|
StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo-bar" },
|
|
|
|
},
|
|
|
|
}))
|
|
|
|
|
2023-10-20 15:34:26 +02:00
|
|
|
VERSIONED_CHARACTERIZATION_TEST(
|
2024-03-04 04:24:23 +01:00
|
|
|
WorkerProtoTest,
|
2024-03-04 03:48:50 +01:00
|
|
|
optionalContentAddress,
|
|
|
|
"optional-content-address",
|
2023-10-20 15:34:26 +02:00
|
|
|
defaultVersion,
|
2024-03-04 03:48:50 +01:00
|
|
|
(std::tuple<std::optional<ContentAddress>, std::optional<ContentAddress>> {
|
|
|
|
std::nullopt,
|
|
|
|
std::optional {
|
|
|
|
ContentAddress {
|
|
|
|
.method = FileIngestionMethod::Flat,
|
2024-08-01 22:42:02 +02:00
|
|
|
.hash = hashString(HashType::SHA1, "blob blob..."),
|
2024-03-04 03:48:50 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}))
|
|
|
|
|
2024-03-04 03:46:48 +01:00
|
|
|
}
|