mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 06:22:42 +01:00
These stragglers have been accidentally left out when implementing the StoreConfig::getReference. Also HttpBinaryCacheStore::getReference now returns the actual store parameters, not the cacheUri parameters.
37 lines
1.2 KiB
C++
37 lines
1.2 KiB
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");
|
|
}
|
|
|
|
TEST(HttpBinaryCacheStore, constructConfigWithParams)
|
|
{
|
|
StoreConfig::Params params{{"compression", "xz"}};
|
|
HttpBinaryCacheStoreConfig config{"https", "foo.bar.baz/a/b/", params};
|
|
EXPECT_EQ(config.cacheUri.to_string(), "https://foo.bar.baz/a/b");
|
|
EXPECT_EQ(config.getReference().params, params);
|
|
}
|
|
|
|
TEST(HttpBinaryCacheStore, constructConfigWithParamsAndUrlWithParams)
|
|
{
|
|
StoreConfig::Params params{{"compression", "xz"}};
|
|
HttpBinaryCacheStoreConfig config{"https", "foo.bar.baz/a/b?some-param=some-value", params};
|
|
EXPECT_EQ(config.cacheUri.to_string(), "https://foo.bar.baz/a/b?some-param=some-value");
|
|
EXPECT_EQ(config.getReference().params, params);
|
|
}
|
|
|
|
} // namespace nix
|