mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 03:56:01 +01:00
Rather than having store implementations return a free-form URI string, have them return a `StoreReference`. This reflects that fact that this method is supposed to invert `resolveStoreConfig`, which goes from a `StoreReference` to some `StoreConfig` concrete derived class (based on the registry). `StoreConfig::getUri` is kept only as a convenience for the common case that we want to immediately render the `StoreReference`. A few tests were changed to use `local://` not `local`, since `StoreReference` does not encode the `local` and `daemon` shorthands (and instead desugars them to `local://` and `unix://` right away). I think that is fine. `local` and `daemon` still work as input.
21 lines
501 B
C++
21 lines
501 B
C++
#include <gtest/gtest.h>
|
|
|
|
#include "nix/store/http-binary-cache-store.hh"
|
|
|
|
namespace nix {
|
|
|
|
TEST(HttpBinaryCacheStore, constructConfig)
|
|
{
|
|
HttpBinaryCacheStoreConfig config{"http", "foo.bar.baz", {}};
|
|
|
|
EXPECT_EQ(config.cacheUri.to_string(), "http://foo.bar.baz");
|
|
}
|
|
|
|
TEST(HttpBinaryCacheStore, constructConfigNoTrailingSlash)
|
|
{
|
|
HttpBinaryCacheStoreConfig config{"https", "foo.bar.baz/a/b/", {}};
|
|
|
|
EXPECT_EQ(config.cacheUri.to_string(), "https://foo.bar.baz/a/b");
|
|
}
|
|
|
|
} // namespace nix
|