1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-14 22:42:41 +01:00

getUri should be const and on Store::Config not Store

It is a side-effect property of the configuration alone, not the rest of
the store.
This commit is contained in:
John Ericson 2025-08-11 17:28:01 -04:00
parent f93d25c0e7
commit 0ef6f72c9c
33 changed files with 123 additions and 122 deletions

View file

@ -27,6 +27,6 @@ TEST(LegacySSHStore, constructConfig)
}));
auto store = config->openStore();
EXPECT_EQ(store->getUri(), "ssh://me@localhost:2222?remote-program=foo%20bar");
EXPECT_EQ(store->config.getUri(), "ssh://me@localhost:2222?remote-program=foo%20bar");
}
} // namespace nix

View file

@ -104,7 +104,7 @@ TEST_F(nix_api_util_context, nix_store_open_dummy)
nix_libstore_init(ctx);
Store * store = nix_store_open(ctx, "dummy://", nullptr);
ASSERT_EQ(NIX_OK, ctx->last_err_code);
ASSERT_STREQ("dummy", store->ptr->getUri().c_str());
ASSERT_STREQ("dummy", store->ptr->config.getUri().c_str());
std::string str;
nix_store_get_version(ctx, store, OBSERVE_STRING(str));

View file

@ -8,9 +8,7 @@ namespace nix {
TEST(SSHStore, constructConfig)
{
initLibStore(/*loadConfig=*/false);
auto config = make_ref<SSHStoreConfig>(
SSHStoreConfig config{
"ssh-ng",
"me@localhost:2222",
StoreConfig::Params{
@ -19,20 +17,19 @@ TEST(SSHStore, constructConfig)
// TODO #11106, no more split on space
"foo bar",
},
});
},
};
EXPECT_EQ(
config->remoteProgram.get(),
config.remoteProgram.get(),
(Strings{
"foo",
"bar",
}));
auto store = config->openStore();
EXPECT_EQ(store->getUri(), "ssh-ng://me@localhost:2222?remote-program=foo%20bar");
config->resetOverridden();
store = config->openStore();
EXPECT_EQ(store->getUri(), "ssh-ng://me@localhost:2222");
EXPECT_EQ(config.getUri(), "ssh-ng://me@localhost:2222?remote-program=foo%20bar");
config.resetOverridden();
EXPECT_EQ(config.getUri(), "ssh-ng://me@localhost:2222");
}
TEST(MountedSSHStore, constructConfig)