1
0
Fork 0

improve shutdown and feature reusability in tests (#2935)

This commit is contained in:
Jan 2017-08-03 20:44:04 +02:00 committed by Frank Celler
parent 0b6d6d9287
commit 07875791e5
3 changed files with 10 additions and 0 deletions

View File

@ -37,6 +37,14 @@ FeatureCacheFeature::FeatureCacheFeature(application_features::ApplicationServer
_databaseFeature(nullptr) {
setOptional(false);
requiresElevatedPrivileges(false);
// reset it so it can be used in multiple tests
Instance = nullptr;
}
FeatureCacheFeature::~FeatureCacheFeature() {
// reset it so it can be used in multiple tests
Instance = nullptr;
}
void FeatureCacheFeature::prepare() {

View File

@ -32,6 +32,7 @@ class DatabaseFeature;
class FeatureCacheFeature final : public application_features::ApplicationFeature {
public:
explicit FeatureCacheFeature(application_features::ApplicationServer*);
~FeatureCacheFeature();
public:
void prepare() override final;

View File

@ -611,6 +611,7 @@ void ApplicationServer::start() {
if (feature->state() == FeatureState::STARTED) {
LOG_TOPIC(TRACE, Logger::STARTUP) << "forcefully stopping feature '" << feature->name() << "'";
try {
feature->beginShutdown();
feature->stop();
feature->state(FeatureState::STOPPED);
} catch (...) {