2023-05-18 00:31:33 +03:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
2023-05-12 01:01:41 +03:00
|
|
|
#include "downstream-placeholder.hh"
|
2023-05-18 00:31:33 +03:00
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
2023-05-12 01:01:41 +03:00
|
|
|
TEST(DownstreamPlaceholder, unknownCaOutput) {
|
2023-07-13 06:33:43 +03: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-18 00:31:33 +03:00
|
|
|
ASSERT_EQ(
|
2023-05-12 01:01:41 +03:00
|
|
|
DownstreamPlaceholder::unknownCaOutput(
|
2023-05-18 00:31:33 +03:00
|
|
|
StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv" },
|
2023-07-13 06:33:43 +03:00
|
|
|
"out",
|
|
|
|
mockXpSettings).render(),
|
2023-05-18 00:31:33 +03:00
|
|
|
"/0c6rn30q4frawknapgwq386zq358m8r6msvywcvc89n6m5p2dgbz");
|
|
|
|
}
|
|
|
|
|
2023-05-12 01:01:41 +03:00
|
|
|
TEST(DownstreamPlaceholder, unknownDerivation) {
|
|
|
|
/**
|
2023-07-13 06:33:43 +03:00
|
|
|
* Same reason as above
|
2023-05-12 01:01:41 +03: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 06:33:43 +03:00
|
|
|
"out",
|
|
|
|
mockXpSettings),
|
2023-05-12 01:01:41 +03:00
|
|
|
"out",
|
|
|
|
mockXpSettings).render(),
|
|
|
|
"/0gn6agqxjyyalf0dpihgyf49xq5hqxgw100f0wydnj6yqrhqsb3w");
|
|
|
|
}
|
|
|
|
|
2023-05-18 00:31:33 +03:00
|
|
|
}
|