A transition from disabled or optional to required does not seem to be permitted.
That also seems to supported from a reading of the code and the tests cases.
How are you supposed to initialize required tenant mode?
TEST_CASE("/ManagementAPI/ChangeConfig/TenantMode") {
DatabaseConfiguration oldConfig;
DatabaseConfiguration newConfig;
std::vector<TenantMode> tenantModes = { TenantMode::DISABLED, TenantMode::OPTIONAL_TENANT, TenantMode::REQUIRED };
// required tenant mode can change to any other tenant mode
oldConfig.tenantMode = TenantMode::REQUIRED;
newConfig.tenantMode = deterministicRandom()->randomChoice(tenantModes);
ASSERT(isTenantModeModeConfigValid(oldConfig, newConfig));
// optional/disabled tenant mode can switch to optional/disabled tenant mode
oldConfig.tenantMode = deterministicRandom()->coinflip() ? TenantMode::DISABLED : TenantMode::OPTIONAL_TENANT;
newConfig.tenantMode = deterministicRandom()->coinflip() ? TenantMode::DISABLED : TenantMode::OPTIONAL_TENANT;
ASSERT(isTenantModeModeConfigValid(oldConfig, newConfig));
// optional/disabled tenant mode CANNOT switch to required tenant mode
oldConfig.tenantMode = deterministicRandom()->coinflip() ? TenantMode::DISABLED : TenantMode::OPTIONAL_TENANT;
newConfig.tenantMode = TenantMode::REQUIRED;
ASSERT(!isTenantModeModeConfigValid(oldConfig, newConfig));
return Void();
}