From a9b9214f3a3fbd62c220cb8b8329cbe7512a589f Mon Sep 17 00:00:00 2001 From: Marcin Godzina Date: Thu, 27 Jan 2022 20:20:23 +0100 Subject: [PATCH] test_v4_request_selecting_success_client_id failed because of incorrect `client_id` format passed to functions --- tests/protosupport/multi_protocol_functions.py | 4 +++- tests/protosupport/v4/srv_msg.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/protosupport/multi_protocol_functions.py b/tests/protosupport/multi_protocol_functions.py index 3f44d5ae..93c2bb6b 100644 --- a/tests/protosupport/multi_protocol_functions.py +++ b/tests/protosupport/multi_protocol_functions.py @@ -322,7 +322,7 @@ def db_table_record_count(table_name, db_type, line="", grep_cmd=None, db_name=w elif table_name == 'lease4': select = "select" for attribute in lease: - if attribute in ["address", "hwaddr"]: + if attribute in ["address", "hwaddr", "client_id"]: select += ", hex(%s)" % attribute else: select += ", %s" % attribute @@ -744,6 +744,8 @@ def check_leases(leases_list, backend='memfile', destination=world.f_cfg.mgmt_ad if backend == 'memfile': for lease in leases_list_copy: cmd = "cat %s " % world.f_cfg.get_leases_path() + if "client_id" in lease: + lease['client_id'] = ':'.join(lease['client_id'][i:i + 2] for i in range(0, 14, 2)) for attribute in lease: cmd += "| grep -E %s " % lease[attribute] cmd += "| grep -c ^" diff --git a/tests/protosupport/v4/srv_msg.py b/tests/protosupport/v4/srv_msg.py index 70831484..08a4cc27 100644 --- a/tests/protosupport/v4/srv_msg.py +++ b/tests/protosupport/v4/srv_msg.py @@ -504,7 +504,7 @@ def get_all_leases(decode_duid=True): lease = {"hwaddr": mac, "address": world.srvmsg[0].yiaddr} try: - lease.update({"client_id": get_option(world.srvmsg[0], 61)[1]}) + lease.update({"client_id": get_option(world.srvmsg[0], 61)[1]}.hex()) except: pass lease.update({"valid_lifetime": get_option(world.srvmsg[0], 51)[1]}) -- GitLab