mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-28 10:52:03 +08:00
Update setclass' test to have random class type and use the specific network address
This commit is contained in:
parent
0fd60cd334
commit
cd594be0f8
@ -6,6 +6,7 @@ import logging
|
|||||||
import functools
|
import functools
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
import random
|
||||||
|
|
||||||
def enable_logging(level=logging.ERROR):
|
def enable_logging(level=logging.ERROR):
|
||||||
"""Enable logging in the function with the specified logging level
|
"""Enable logging in the function with the specified logging level
|
||||||
@ -93,32 +94,40 @@ 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()
|
@enable_logging(logging.DEBUG)
|
||||||
def setclass(logger):
|
def setclass(logger):
|
||||||
output1 = run_fdbcli_command('setclass')
|
output1 = run_fdbcli_command('setclass')
|
||||||
class_type_line_1 = output1.split('\n')[-1]
|
class_type_line_1 = output1.split('\n')[-1]
|
||||||
logger.debug(class_type_line_1)
|
logger.debug(class_type_line_1)
|
||||||
# check process' network address
|
# check process' network address
|
||||||
assert '127.0.0.1' in class_type_line_1
|
assert '127.0.0.1' in class_type_line_1
|
||||||
|
network_address = ':'.join(class_type_line_1.split(':')[:2])
|
||||||
|
logger.debug("Network address: {}".format(network_address))
|
||||||
# check class type
|
# check class type
|
||||||
assert 'unset' in class_type_line_1
|
assert 'unset' in class_type_line_1
|
||||||
# check class source
|
# check class source
|
||||||
assert 'command_line' in class_type_line_1
|
assert 'command_line' in class_type_line_1
|
||||||
# set class to a random value
|
# set class to a random valid type
|
||||||
random_class_type = 'storage'
|
class_types = ['storage', 'storage', 'transaction', 'resolution',
|
||||||
run_fdbcli_command('setclass', '127.0.0.1', random_class_type)
|
'commit_proxy', 'grv_proxy', 'master', 'stateless', 'log',
|
||||||
|
'router', 'cluster_controller', 'fast_restore', 'data_distributor',
|
||||||
|
'coordinator', 'ratekeeper', 'storage_cache', 'backup',
|
||||||
|
'default']
|
||||||
|
random_class_type = random.choice(class_types)
|
||||||
|
logger.debug("Change to type: {}".format(random_class_type))
|
||||||
|
run_fdbcli_command('setclass', network_address, random_class_type)
|
||||||
# check the set successful
|
# check the set successful
|
||||||
output2 = run_fdbcli_command('setclass')
|
output2 = run_fdbcli_command('setclass')
|
||||||
class_type_line_2 = output2.split('\n')[-1]
|
class_type_line_2 = output2.split('\n')[-1]
|
||||||
logger.debug(class_type_line_2)
|
logger.debug(class_type_line_2)
|
||||||
# check process' network address
|
# check process' network address
|
||||||
assert '127.0.0.1' in class_type_line_2
|
assert network_address in class_type_line_2
|
||||||
# check class type changed to the specified value
|
# check class type changed to the specified value
|
||||||
assert random_class_type in class_type_line_2
|
assert random_class_type in class_type_line_2
|
||||||
# check class source
|
# check class source
|
||||||
assert 'set_class' in class_type_line_2
|
assert 'set_class' in class_type_line_2
|
||||||
# set back to default
|
# set back to default
|
||||||
run_fdbcli_command('setclass', '127.0.0.1', 'default')
|
run_fdbcli_command('setclass', network_address, 'default')
|
||||||
# everything should be back to the same as before
|
# everything should be back to the same as before
|
||||||
output3 = run_fdbcli_command('setclass')
|
output3 = run_fdbcli_command('setclass')
|
||||||
class_type_line_3 = output3.split('\n')[-1]
|
class_type_line_3 = output3.split('\n')[-1]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user