Skip the case where the test client gets zero workers in setclass test
This commit is contained in:
parent
d270b15c89
commit
443385b052
|
@ -630,36 +630,42 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload {
|
||||||
ASSERT(self->getRangeResultInOrder(result));
|
ASSERT(self->getRangeResultInOrder(result));
|
||||||
// check correctness of classType of each process
|
// check correctness of classType of each process
|
||||||
vector<ProcessData> workers = wait(getWorkers(&tx->getTransaction()));
|
vector<ProcessData> workers = wait(getWorkers(&tx->getTransaction()));
|
||||||
for (const auto& worker : workers) {
|
if (workers.size()) {
|
||||||
Key addr =
|
for (const auto& worker : workers) {
|
||||||
|
Key addr =
|
||||||
|
Key("process/class_type/" + formatIpPort(worker.address.ip, worker.address.port))
|
||||||
|
.withPrefix(
|
||||||
|
SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::CONFIGURATION).begin);
|
||||||
|
bool found = false;
|
||||||
|
for (const auto& kv : result) {
|
||||||
|
if (kv.key == addr) {
|
||||||
|
ASSERT(kv.value.toString() == worker.processClass.toString());
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Each process should find its corresponding element
|
||||||
|
ASSERT(found);
|
||||||
|
}
|
||||||
|
state ProcessData worker = deterministicRandom()->randomChoice(workers);
|
||||||
|
state Key addr =
|
||||||
Key("process/class_type/" + formatIpPort(worker.address.ip, worker.address.port))
|
Key("process/class_type/" + formatIpPort(worker.address.ip, worker.address.port))
|
||||||
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::CONFIGURATION).begin);
|
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::CONFIGURATION).begin);
|
||||||
bool found = false;
|
tx->set(addr, LiteralStringRef("InvalidProcessType"));
|
||||||
for (const auto& kv : result) {
|
// test ryw
|
||||||
if (kv.key == addr) {
|
Optional<Value> processType = wait(tx->get(addr));
|
||||||
ASSERT(kv.value.toString() == worker.processClass.toString());
|
ASSERT(processType.present() && processType.get() == LiteralStringRef("InvalidProcessType"));
|
||||||
found = true;
|
// test ryw disabled
|
||||||
break;
|
tx->setOption(FDBTransactionOptions::READ_YOUR_WRITES_DISABLE);
|
||||||
}
|
Optional<Value> originalProcessType = wait(tx->get(addr));
|
||||||
}
|
ASSERT(originalProcessType.present() &&
|
||||||
// Each process should find its corresponding element
|
originalProcessType.get() == worker.processClass.toString());
|
||||||
ASSERT(found);
|
// test error handling (invalid value type)
|
||||||
|
wait(tx->commit());
|
||||||
|
ASSERT(false);
|
||||||
|
} else {
|
||||||
|
TraceEvent(SevDebug, "SpecialKeyCorrectnessTestGetZeroWorkers");
|
||||||
}
|
}
|
||||||
state ProcessData worker = deterministicRandom()->randomChoice(workers);
|
|
||||||
state Key addr =
|
|
||||||
Key("process/class_type/" + formatIpPort(worker.address.ip, worker.address.port))
|
|
||||||
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::CONFIGURATION).begin);
|
|
||||||
tx->set(addr, LiteralStringRef("InvalidProcessType"));
|
|
||||||
// test ryw
|
|
||||||
Optional<Value> processType = wait(tx->get(addr));
|
|
||||||
ASSERT(processType.present() && processType.get() == LiteralStringRef("InvalidProcessType"));
|
|
||||||
// test ryw disabled
|
|
||||||
tx->setOption(FDBTransactionOptions::READ_YOUR_WRITES_DISABLE);
|
|
||||||
Optional<Value> originalProcessType = wait(tx->get(addr));
|
|
||||||
ASSERT(originalProcessType.present() && originalProcessType.get() == worker.processClass.toString());
|
|
||||||
// test error handling (invalid value type)
|
|
||||||
wait(tx->commit());
|
|
||||||
ASSERT(false);
|
|
||||||
} catch (Error& e) {
|
} catch (Error& e) {
|
||||||
if (e.code() == error_code_actor_cancelled) throw;
|
if (e.code() == error_code_actor_cancelled) throw;
|
||||||
if (e.code() == error_code_special_keys_api_failure) {
|
if (e.code() == error_code_special_keys_api_failure) {
|
||||||
|
@ -691,36 +697,43 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload {
|
||||||
ASSERT(self->getRangeResultInOrder(class_source_result));
|
ASSERT(self->getRangeResultInOrder(class_source_result));
|
||||||
// check correctness of classType of each process
|
// check correctness of classType of each process
|
||||||
vector<ProcessData> workers = wait(getWorkers(&tx->getTransaction()));
|
vector<ProcessData> workers = wait(getWorkers(&tx->getTransaction()));
|
||||||
for (const auto& worker : workers) {
|
if (workers.size()) {
|
||||||
Key addr =
|
for (const auto& worker : workers) {
|
||||||
Key("process/class_source/" + formatIpPort(worker.address.ip, worker.address.port))
|
Key addr =
|
||||||
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::CONFIGURATION).begin);
|
Key("process/class_source/" + formatIpPort(worker.address.ip, worker.address.port))
|
||||||
bool found = false;
|
.withPrefix(
|
||||||
for (const auto& kv : class_source_result) {
|
SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::CONFIGURATION).begin);
|
||||||
if (kv.key == addr) {
|
bool found = false;
|
||||||
ASSERT(kv.value.toString() == worker.processClass.sourceString());
|
for (const auto& kv : class_source_result) {
|
||||||
// Default source string is command_line
|
if (kv.key == addr) {
|
||||||
ASSERT(kv.value == LiteralStringRef("command_line"));
|
ASSERT(kv.value.toString() == worker.processClass.sourceString());
|
||||||
found = true;
|
// Default source string is command_line
|
||||||
break;
|
ASSERT(kv.value == LiteralStringRef("command_line"));
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// Each process should find its corresponding element
|
||||||
|
ASSERT(found);
|
||||||
}
|
}
|
||||||
// Each process should find its corresponding element
|
ProcessData worker = deterministicRandom()->randomChoice(workers);
|
||||||
ASSERT(found);
|
state std::string address = formatIpPort(worker.address.ip, worker.address.port);
|
||||||
|
tx->setOption(FDBTransactionOptions::SPECIAL_KEY_SPACE_ENABLE_WRITES);
|
||||||
|
tx->set(
|
||||||
|
Key("process/class_type/" + address)
|
||||||
|
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::CONFIGURATION).begin),
|
||||||
|
Value(worker.processClass.toString())); // Set it as the same class type as before, thus only
|
||||||
|
// class source will be changed
|
||||||
|
wait(tx->commit());
|
||||||
|
Optional<Value> class_source = wait(tx->get(
|
||||||
|
Key("process/class_source/" + address)
|
||||||
|
.withPrefix(
|
||||||
|
SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::CONFIGURATION).begin)));
|
||||||
|
ASSERT(class_source.present() && class_source.get() == LiteralStringRef("set_class"));
|
||||||
|
tx->reset();
|
||||||
|
} else {
|
||||||
|
TraceEvent(SevDebug, "SpecialKeyCorrectnessTestGetZeroWorkers");
|
||||||
}
|
}
|
||||||
ProcessData worker = deterministicRandom()->randomChoice(workers);
|
|
||||||
state std::string address = formatIpPort(worker.address.ip, worker.address.port);
|
|
||||||
tx->setOption(FDBTransactionOptions::SPECIAL_KEY_SPACE_ENABLE_WRITES);
|
|
||||||
tx->set(Key("process/class_type/" + address)
|
|
||||||
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::CONFIGURATION).begin),
|
|
||||||
Value(worker.processClass.toString())); // Set it as the same class type as before, thus only
|
|
||||||
// class source will be changed
|
|
||||||
wait(tx->commit());
|
|
||||||
Optional<Value> class_source = wait(tx->get(
|
|
||||||
Key("process/class_source/" + address)
|
|
||||||
.withPrefix(SpecialKeySpace::getModuleRange(SpecialKeySpace::MODULE::CONFIGURATION).begin)));
|
|
||||||
ASSERT(class_source.present() && class_source.get() == LiteralStringRef("set_class"));
|
|
||||||
tx->reset();
|
|
||||||
} catch (Error& e) {
|
} catch (Error& e) {
|
||||||
if (e.code() == error_code_actor_cancelled) throw;
|
if (e.code() == error_code_actor_cancelled) throw;
|
||||||
wait(tx->onError(e));
|
wait(tx->onError(e));
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
buggify = false
|
|
||||||
|
|
||||||
[[test]]
|
[[test]]
|
||||||
testTitle = 'SpecialKeySpaceCorrectnessTest'
|
testTitle = 'SpecialKeySpaceCorrectnessTest'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue