2023-05-17 21:31:33 +00:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
2024-11-12 23:07:17 +00:00
|
|
|
#include "lix/libstore/downstream-placeholder.hh"
|
2023-05-17 21:31:33 +00:00
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
2023-05-11 22:01:41 +00:00
|
|
|
TEST(DownstreamPlaceholder, unknownCaOutput) {
|
2023-07-13 03:33:43 +00:00
|
|
|
/**
|
|
|
|
* We set these in tests rather than the regular globals so we don't have
|
|
|
|
* to worry about race conditions if the tests run concurrently.
|
|
|
|
*/
|
|
|
|
ExperimentalFeatureSettings mockXpSettings;
|
|
|
|
mockXpSettings.set("experimental-features", "ca-derivations");
|
|
|
|
|
2023-05-17 21:31:33 +00:00
|
|
|
ASSERT_EQ(
|
2023-05-11 22:01:41 +00:00
|
|
|
DownstreamPlaceholder::unknownCaOutput(
|
2023-05-17 21:31:33 +00:00
|
|
|
StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv" },
|
2023-07-13 03:33:43 +00:00
|
|
|
"out",
|
|
|
|
mockXpSettings).render(),
|
2023-05-17 21:31:33 +00:00
|
|
|
"/0c6rn30q4frawknapgwq386zq358m8r6msvywcvc89n6m5p2dgbz");
|
|
|
|
}
|
|
|
|
|
2023-05-11 22:01:41 +00:00
|
|
|
TEST(DownstreamPlaceholder, unknownDerivation) {
|
|
|
|
/**
|
2023-07-13 03:33:43 +00:00
|
|
|
* Same reason as above
|
2023-05-11 22:01:41 +00:00
|
|
|
*/
|
|
|
|
ExperimentalFeatureSettings mockXpSettings;
|
|
|
|
mockXpSettings.set("experimental-features", "dynamic-derivations ca-derivations");
|
|
|
|
|
|
|
|
ASSERT_EQ(
|
|
|
|
DownstreamPlaceholder::unknownDerivation(
|
|
|
|
DownstreamPlaceholder::unknownCaOutput(
|
|
|
|
StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv.drv" },
|
2023-07-13 03:33:43 +00:00
|
|
|
"out",
|
|
|
|
mockXpSettings),
|
2023-05-11 22:01:41 +00:00
|
|
|
"out",
|
|
|
|
mockXpSettings).render(),
|
|
|
|
"/0gn6agqxjyyalf0dpihgyf49xq5hqxgw100f0wydnj6yqrhqsb3w");
|
|
|
|
}
|
|
|
|
|
2023-05-17 21:31:33 +00:00
|
|
|
}
|