Add IKnobCollection::clearTestKnobs to fix unit tests
This commit is contained in:
parent
b6c669be23
commit
0fcca0eb60
|
@ -54,6 +54,7 @@ public:
|
|||
virtual ClientKnobs const& getClientKnobs() const = 0;
|
||||
virtual ServerKnobs const& getServerKnobs() const = 0;
|
||||
virtual class TestKnobs const& getTestKnobs() const = 0;
|
||||
virtual void clearTestKnobs() {}
|
||||
virtual Optional<KnobValue> tryParseKnobValue(std::string const& knobName, std::string const& knobValue) const = 0;
|
||||
KnobValue parseKnobValue(std::string const& knobName, std::string const& knobValue) const;
|
||||
static KnobValue parseKnobValue(std::string const& knobName, std::string const& knobValue, Type);
|
||||
|
|
|
@ -35,6 +35,10 @@ void TestKnobCollection::reset(Randomize randomize, IsSimulated isSimulated) {
|
|||
testKnobs.reset();
|
||||
}
|
||||
|
||||
void TestKnobCollection::clearTestKnobs() {
|
||||
testKnobs.reset();
|
||||
}
|
||||
|
||||
Optional<KnobValue> TestKnobCollection::tryParseKnobValue(std::string const& knobName,
|
||||
std::string const& knobValue) const {
|
||||
auto result = serverKnobCollection.tryParseKnobValue(knobName, knobValue);
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
ClientKnobs const& getClientKnobs() const override { return serverKnobCollection.getClientKnobs(); }
|
||||
ServerKnobs const& getServerKnobs() const override { return serverKnobCollection.getServerKnobs(); }
|
||||
TestKnobs const& getTestKnobs() const override { return testKnobs; }
|
||||
void clearTestKnobs() override;
|
||||
Optional<KnobValue> tryParseKnobValue(std::string const& knobName, std::string const& knobValue) const override;
|
||||
bool trySetKnob(std::string const& knobName, KnobValueRef const& knobValue) override;
|
||||
};
|
||||
|
|
|
@ -227,6 +227,9 @@ class LocalConfigurationImpl {
|
|||
|
||||
void updateInMemoryState(Version lastSeenVersion) {
|
||||
this->lastSeenVersion = lastSeenVersion;
|
||||
if (g_network->isSimulated()) {
|
||||
getKnobs().clearTestKnobs();
|
||||
}
|
||||
configKnobOverrides.update(getKnobs());
|
||||
manualKnobOverrides.update(getKnobs());
|
||||
// FIXME: Reinitialize in order to update dependent knobs?
|
||||
|
|
Loading…
Reference in New Issue