tests/libstore-support: avoid host configuration

setting a global like this is a hacky solution, but it works for now.

without this, unit tests try to use configuration under `/etc/nix/`.

Signed-off-by: Dusk Banks <me@bb010g.com>
Change-Id: Ic7966a67d52646818991646439225a7af20f011c
This commit is contained in:
Dusk Banks 2024-10-17 23:15:47 -07:00
parent 3f07c65510
commit 7924b37d1b

View file

@ -4,6 +4,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include "globals.hh"
#include "store-api.hh" #include "store-api.hh"
namespace nix { namespace nix {
@ -11,6 +12,7 @@ namespace nix {
class LibStoreTest : public ::testing::Test { class LibStoreTest : public ::testing::Test {
public: public:
static void SetUpTestSuite() { static void SetUpTestSuite() {
settings.nixConfDir = "/dev/null"; // intentionally invalid path
initLibStore(); initLibStore();
} }