Skip to content

Commit

Permalink
Fix test instability because of uninitialized settings
Browse files Browse the repository at this point in the history
  • Loading branch information
halfgaar committed May 3, 2024
1 parent 7e5d0d0 commit d08f376
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion FlashMQTests/maintests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ void MainTests::initBeforeEachTest(const std::vector<std::string> &args)

// We test functions directly that the server normally only calls from worker threads, in which thread data is available. This is kind of a dummy-fix, until
// we actually need correct thread data at those points (at this point, it's only to increase message counters).
Settings settings;
PluginLoader pluginLoader;
this->dummyThreadData = std::make_shared<ThreadData>(666, settings, pluginLoader);
ThreadGlobals::assignThreadData(dummyThreadData.get());
ThreadGlobals::assignSettings(&this->settings);
}

void MainTests::initBeforeEachTest()
Expand Down
1 change: 1 addition & 0 deletions FlashMQTests/maintests.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class MainTests

std::unique_ptr<MainAppInThread> mainApp;
std::shared_ptr<ThreadData> dummyThreadData;
Settings settings;

std::map<std::string, std::function<void()>> testFunctions;

Expand Down

0 comments on commit d08f376

Please sign in to comment.