Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vlan] Revise sleep time for pytest case "test_addMaxVlan". #904

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions tests/test_vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ def setup_db(self, dvs):
self.adb = swsscommon.DBConnector(1, dvs.redis_sock, 0)
self.cdb = swsscommon.DBConnector(4, dvs.redis_sock, 0)

def create_vlan(self, vlan):
def create_vlan(self, vlan, sleep=1):
tbl = swsscommon.Table(self.cdb, "VLAN")
fvs = swsscommon.FieldValuePairs([("vlanid", vlan)])
tbl.set("Vlan" + vlan, fvs)
time.sleep(1)
time.sleep(sleep)

def remove_vlan(self, vlan):
def remove_vlan(self, vlan, sleep=1):
tbl = swsscommon.Table(self.cdb, "VLAN")
tbl._del("Vlan" + vlan)
time.sleep(1)
time.sleep(sleep)

def create_vlan_member(self, vlan, interface):
tbl = swsscommon.Table(self.cdb, "VLAN_MEMBER")
Expand Down Expand Up @@ -251,7 +251,6 @@ def test_AddVlanWithIncorrectValueType(self, dvs, testlog, test_input, expected)
#remove vlan
self.remove_vlan(vlan)

@pytest.mark.skip(reason="AddMaxVlan take too long to execute")
def test_AddMaxVlan(self, dvs, testlog):
self.setup_db(dvs)

Expand All @@ -261,8 +260,9 @@ def test_AddMaxVlan(self, dvs, testlog):
# create max vlan
vlan = min_vid
while vlan <= max_vid:
self.create_vlan(str(vlan))
self.create_vlan(str(vlan), 0)
vlan += 1
time.sleep(360)

# check asic database
tbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_VLAN")
Expand All @@ -272,8 +272,9 @@ def test_AddMaxVlan(self, dvs, testlog):
# remove all vlan
vlan = min_vid
while vlan <= max_vid:
self.remove_vlan(str(vlan))
self.remove_vlan(str(vlan), 0)
vlan += 1
time.sleep(420)

# check asic database
tbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_VLAN")
Expand Down