Add tests for fdbcli quota commands
This commit is contained in:
parent
9a1876dd11
commit
7e4f380423
|
@ -103,6 +103,42 @@ def maintenance(logger):
|
||||||
output3 = run_fdbcli_command('maintenance')
|
output3 = run_fdbcli_command('maintenance')
|
||||||
assert output3 == no_maintenance_output
|
assert output3 == no_maintenance_output
|
||||||
|
|
||||||
|
@enable_logging()
|
||||||
|
def quota(logger):
|
||||||
|
command = 'quota get green total_throughput'
|
||||||
|
output = run_fdbcli_command(command)
|
||||||
|
logger.debug(command + ' : ' + output)
|
||||||
|
assert output == '<empty>'
|
||||||
|
|
||||||
|
command = 'quota set green total_throughput 32768'
|
||||||
|
output = run_fdbcli_command(command)
|
||||||
|
logger.debug(command + ' : ' + output)
|
||||||
|
assert output == ''
|
||||||
|
|
||||||
|
command = 'quota set green reserved_throughput 16384'
|
||||||
|
output = run_fdbcli_command(command)
|
||||||
|
logger.debug(command + ' : ' + output)
|
||||||
|
assert output == ''
|
||||||
|
|
||||||
|
command = 'quota get green total_throughput'
|
||||||
|
output = run_fdbcli_command(command)
|
||||||
|
logger.debug(command + ' : ' + output)
|
||||||
|
assert output == '32768'
|
||||||
|
|
||||||
|
command = 'quota get green reserved_throughput'
|
||||||
|
output = run_fdbcli_command(command)
|
||||||
|
logger.debug(command + ' : ' + output)
|
||||||
|
assert output == '16384'
|
||||||
|
|
||||||
|
command = 'quota clear green'
|
||||||
|
output = run_fdbcli_command(command)
|
||||||
|
logger.debug(command + ' : ' + output)
|
||||||
|
assert output == ''
|
||||||
|
|
||||||
|
command = 'quota get green total_throughput'
|
||||||
|
output = run_fdbcli_command(command)
|
||||||
|
logger.debug(command + ' : ' + output)
|
||||||
|
assert output == '<empty>'
|
||||||
|
|
||||||
@enable_logging()
|
@enable_logging()
|
||||||
def setclass(logger):
|
def setclass(logger):
|
||||||
|
@ -1035,10 +1071,12 @@ if __name__ == '__main__':
|
||||||
integer_options()
|
integer_options()
|
||||||
tls_address_suffix()
|
tls_address_suffix()
|
||||||
knobmanagement()
|
knobmanagement()
|
||||||
|
quota()
|
||||||
else:
|
else:
|
||||||
assert args.process_number > 1, "Process number should be positive"
|
assert args.process_number > 1, "Process number should be positive"
|
||||||
coordinators()
|
coordinators()
|
||||||
exclude()
|
exclude()
|
||||||
killall()
|
killall()
|
||||||
|
quota()
|
||||||
# TODO: fix the failure where one process is not available after setclass call
|
# TODO: fix the failure where one process is not available after setclass call
|
||||||
# setclass()
|
# setclass()
|
||||||
|
|
|
@ -150,8 +150,8 @@ ThrottleApi::TagQuotaValue ThrottleApi::TagQuotaValue::fromValue(ValueRef value)
|
||||||
}
|
}
|
||||||
TagQuotaValue result;
|
TagQuotaValue result;
|
||||||
try {
|
try {
|
||||||
result.reservedQuota = tuple.getDouble(0);
|
result.reservedQuota = tuple.getInt(0);
|
||||||
result.totalQuota = tuple.getDouble(1);
|
result.totalQuota = tuple.getInt(1);
|
||||||
} catch (Error& e) {
|
} catch (Error& e) {
|
||||||
TraceEvent(SevWarnAlways, "TagQuotaValueFailedToDeserialize").error(e);
|
TraceEvent(SevWarnAlways, "TagQuotaValueFailedToDeserialize").error(e);
|
||||||
throw invalid_throttle_quota_value();
|
throw invalid_throttle_quota_value();
|
||||||
|
|
|
@ -597,8 +597,8 @@ Future<Void> enableAuto(Reference<DB> db, bool enabled) {
|
||||||
|
|
||||||
class TagQuotaValue {
|
class TagQuotaValue {
|
||||||
public:
|
public:
|
||||||
double reservedQuota{ 0.0 };
|
int64_t reservedQuota{ 0 };
|
||||||
double totalQuota{ 0.0 };
|
int64_t totalQuota{ 0 };
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
Value toValue() const;
|
Value toValue() const;
|
||||||
static TagQuotaValue fromValue(ValueRef);
|
static TagQuotaValue fromValue(ValueRef);
|
||||||
|
|
Loading…
Reference in New Issue