Add tests for fdbcli quota commands

This commit is contained in:
sfc-gh-tclinkenbeard 2022-10-17 16:27:45 -07:00
parent 9a1876dd11
commit 7e4f380423
3 changed files with 42 additions and 4 deletions

View File

@ -103,6 +103,42 @@ def maintenance(logger):
output3 = run_fdbcli_command('maintenance')
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()
def setclass(logger):
@ -1035,10 +1071,12 @@ if __name__ == '__main__':
integer_options()
tls_address_suffix()
knobmanagement()
quota()
else:
assert args.process_number > 1, "Process number should be positive"
coordinators()
exclude()
killall()
quota()
# TODO: fix the failure where one process is not available after setclass call
# setclass()

View File

@ -150,8 +150,8 @@ ThrottleApi::TagQuotaValue ThrottleApi::TagQuotaValue::fromValue(ValueRef value)
}
TagQuotaValue result;
try {
result.reservedQuota = tuple.getDouble(0);
result.totalQuota = tuple.getDouble(1);
result.reservedQuota = tuple.getInt(0);
result.totalQuota = tuple.getInt(1);
} catch (Error& e) {
TraceEvent(SevWarnAlways, "TagQuotaValueFailedToDeserialize").error(e);
throw invalid_throttle_quota_value();

View File

@ -597,8 +597,8 @@ Future<Void> enableAuto(Reference<DB> db, bool enabled) {
class TagQuotaValue {
public:
double reservedQuota{ 0.0 };
double totalQuota{ 0.0 };
int64_t reservedQuota{ 0 };
int64_t totalQuota{ 0 };
bool isValid() const;
Value toValue() const;
static TagQuotaValue fromValue(ValueRef);