Skip to content

Commit

Permalink
removed the delayed and logs
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammadalihussnain committed Sep 6, 2024
1 parent 71ac850 commit 60eef36
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 26 deletions.
4 changes: 1 addition & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def _verify_db_contents():
return (True, None)

# Verify that ASIC DB has been fully initialized
init_polling_config = PollingConfig(2, 60, strict=True)
init_polling_config = PollingConfig(2, 30, strict=True)
wait_for_result(_verify_db_contents, init_polling_config)

def _generate_oid_to_interface_mapping(self) -> None:
Expand Down Expand Up @@ -1856,7 +1856,6 @@ def update_dvs(log_path, new_dvs_env=[]):
dvs.destroy_servers()
dvs.create_servers()
dvs.restart()
time.sleep(60)

return dvs

Expand All @@ -1873,7 +1872,6 @@ def update_dvs(log_path, new_dvs_env=[]):
if dvs.persistent:
dvs.runcmd("mv /etc/sonic/config_db.json.orig /etc/sonic/config_db.json")
dvs.ctn_restart()
time.sleep(60)

@pytest.fixture(scope="module")
def dvs(request, manage_dvs) -> DockerVirtualSwitch:
Expand Down
3 changes: 1 addition & 2 deletions tests/dvslib/dvs_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PollingConfig:
"""

polling_interval: float = 0.01
timeout: float = 30.00
timeout: float = 20.00
strict: bool = True

def iterations(self) -> int:
Expand Down Expand Up @@ -57,7 +57,6 @@ def wait_for_result(


if polling_config.strict:
print("polling_config.strict not status by function [status, result = polling_function()]")
message = failure_message or f"Operation timed out after {polling_config.timeout} seconds with result {result}"
assert False, message

Expand Down
2 changes: 0 additions & 2 deletions tests/dvslib/dvs_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,6 @@ def access_function():
status, result = wait_for_result(
access_function, self._disable_strict_polling(polling_config)
)
print(f'status is : {status} and result is {result}')

if not status:
message = failure_message or (
f"Expected field/value pairs not found: expected={expected_fields}, "
Expand Down
2 changes: 0 additions & 2 deletions tests/test_drop_counters.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,6 @@ def test_add_remove_port(self, dvs, testlog):
This test verifies that debug counters are removed when we remove a port
and debug counters are added each time we add ports (if debug counter is enabled)
"""
time.sleep(3) # Ensure the system has time to remove the counters

self.setup_db(dvs)

# save port info
Expand Down
11 changes: 1 addition & 10 deletions tests/test_fgnhg.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,8 @@ def shutdown_link(dvs, db, port):

def startup_link(dvs, db, port):
dvs.servers[port].runcmd("ip link set up dev eth0") == 0
print(f"Port status before wait: {db.get_entry('PORT_TABLE', 'Ethernet%d' % (port * 4))}")
db.wait_for_field_match("PORT_TABLE", "Ethernet%d" % (port * 4), {"oper_status": "up"})
time.sleep(5)
print(f"Port status after wait: {db.get_entry('PORT_TABLE', 'Ethernet%d' % (port * 4))}")



def run_warm_reboot(dvs):
dvs.warm_restart_swss("true")

Expand Down Expand Up @@ -286,10 +282,8 @@ def create_interface_n_fg_ecmp_config(dvs, nh_range_start, nh_range_end, fg_nhg_
create_entry(config_db, IF_TB, if_name_key, fvs_nul)
create_entry(config_db, IF_TB, ip_pref_key, fvs_nul)
dvs.port_admin_set(if_name_key, "up")
time.sleep(5)
shutdown_link(dvs, app_db, i)
startup_link(dvs, app_db, i)
time.sleep(5)
bank = 1
if i >= (nh_range_end - nh_range_start)/2:
bank = 0
Expand Down Expand Up @@ -780,10 +774,7 @@ def test_fgnhg_matchmode_nexthop_multi_route(self, dvs, testlog):
shutdown_link(dvs, app_db, i)
startup_link(dvs, app_db, i)
dvs.runcmd("arp -s 10.0.0." + str(1 + i*2) + " 00:00:00:00:00:" + str(1 + i*2))

print(f" asic_nh_count + NUM_NHs + NUM_NHs_non_fgnhg============={ asic_nh_count + NUM_NHs + NUM_NHs_non_fgnhg}")
asic_db.wait_for_n_keys(ASIC_NH_TB, asic_nh_count + NUM_NHs + NUM_NHs_non_fgnhg)

# Program the route
ps = swsscommon.ProducerStateTable(app_db.db_connection, ROUTE_TB)
fvs = swsscommon.FieldValuePairs([("nexthop","10.0.0.1,10.0.0.5"),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def set_dhcp_rate_limit(self, interface, dhcp_rate_limit):
tbl = swsscommon.Table(self.cdb, tbl_name)
fvs = swsscommon.FieldValuePairs([("dhcp_rate_limit", dhcp_rate_limit)])
tbl.set(interface, fvs)
time.sleep(20)
time.sleep(1)

def test_PortInterfaceAddRemoveIpv6Address(self, dvs, testlog):
self.setup_db(dvs)
Expand Down
10 changes: 5 additions & 5 deletions tests/test_port_add_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_remove_add_remove_port_with_buffer_cfg(self, dvs, testlog):
config_db.delete_entry('PORT', PORT_A)
num = asic_db.wait_for_n_keys("ASIC_STATE:SAI_OBJECT_TYPE_PORT",
num_of_ports-1,
polling_config = PollingConfig(polling_interval = 1, timeout = 30.00, strict = True))
polling_config = PollingConfig(polling_interval = 1, timeout = 5.00, strict = True))

# verify that the port was removed properly since all buffer configuration was removed also
assert len(num) == num_of_ports - 1
Expand All @@ -90,7 +90,7 @@ def test_remove_add_remove_port_with_buffer_cfg(self, dvs, testlog):
# verify that the port has been readded
num = asic_db.wait_for_n_keys("ASIC_STATE:SAI_OBJECT_TYPE_PORT",
num_of_ports,
polling_config = PollingConfig(polling_interval = 1, timeout = 30.00, strict = True))
polling_config = PollingConfig(polling_interval = 1, timeout = 5.00, strict = True))

assert len(num) == num_of_ports

Expand All @@ -107,7 +107,7 @@ def test_remove_add_remove_port_with_buffer_cfg(self, dvs, testlog):
config_db.delete_entry('PORT', PORT_A)
num = asic_db.wait_for_n_keys("ASIC_STATE:SAI_OBJECT_TYPE_PORT",
num_of_ports-1,
polling_config = PollingConfig(polling_interval = 1, timeout = 30.00, strict = False))
polling_config = PollingConfig(polling_interval = 1, timeout = 5.00, strict = False))

# verify that the port wasn't removed since we still have buffer cfg
assert len(num) == num_of_ports
Expand All @@ -119,7 +119,7 @@ def test_remove_add_remove_port_with_buffer_cfg(self, dvs, testlog):

num = asic_db.wait_for_n_keys("ASIC_STATE:SAI_OBJECT_TYPE_PORT",
num_of_ports-1,
polling_config = PollingConfig(polling_interval = 1, timeout = 30.00, strict = False))
polling_config = PollingConfig(polling_interval = 1, timeout = 5.00, strict = False))

# verify that the port wasn't removed since we still have buffer cfg
assert len(num) == num_of_ports
Expand All @@ -131,7 +131,7 @@ def test_remove_add_remove_port_with_buffer_cfg(self, dvs, testlog):

num = asic_db.wait_for_n_keys("ASIC_STATE:SAI_OBJECT_TYPE_PORT",
num_of_ports-1,
polling_config = PollingConfig(polling_interval = 1, timeout = 30.00, strict = True))
polling_config = PollingConfig(polling_interval = 1, timeout = 5.00, strict = True))

# verify that the port wasn't removed since we still have buffer cfg
assert len(num) == num_of_ports - 1
Expand Down
2 changes: 1 addition & 1 deletion tests/test_port_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def test_recirc_port(self, dvs):
dvs.start_swss()
time.sleep(5)

polling_config = PollingConfig(polling_interval=0.1, timeout=30, strict=True)
polling_config = PollingConfig(polling_interval=0.1, timeout=5.00, strict=True)

# Verify recirc ports in port table in applDB
for i in range(2):
Expand Down

0 comments on commit 60eef36

Please sign in to comment.