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

Fix log/syslog not being correct when last test fails for given module #1395

Merged
merged 4 commits into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,8 @@ For those developing new features for SWSS or the DVS framework, you might find
```

You can mitigate this by upgrading to a newer version of Docker CE or editing the `DEFAULT_DOCKER_API_VERSION` in `/usr/local/lib/python3/dist-packages/docker/constants.py`, or by upgrading to a newer version of Docker CE. See [relevant GitHub discussion](https://github.com/drone/drone/issues/2048).

- Currently when pytest are run using --force-flaky and if the last test case fails pytest tear-down the module before retrying the failed test case and invoke module
setup again to run fail test case. This is know issue of pytest w.r.t flaky as tracked here (https://github.com/box/flaky/issues/128) and
(https://github.com/pytest-dev/pytest-rerunfailures/issues/51). Because of this issue all the logs are lost till last test case run as modules is teardown and setup again.
To avoid this as workaround a dummy always-pass test case is added in all modules/test files.
6 changes: 6 additions & 0 deletions tests/test_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,3 +492,9 @@ def test_AclActionValidation(self, dvs, dvs_acl):
dvs.runcmd("supervisorctl restart syncd")
dvs.stop_swss()
dvs.start_swss()


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
daall marked this conversation as resolved.
Show resolved Hide resolved
pass
6 changes: 6 additions & 0 deletions tests/test_acl_ctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,9 @@ def test_AclCtrl(self, dvs):
self.remove_acl_table(dvs)
self.remove_acl_rule(dvs)



# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_acl_egress_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,3 +340,9 @@ def test_EgressAclTableDeletion(self, dvs):
# Remove Acl table
self.remove_acl_table("egress_acl_table")
self.check_asic_table_absent(dvs)


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_acl_mclag.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,9 @@ def test_AclRuleOutPorts(self, dvs, testlog):
# check acl in asic db
acl_table_id = self.get_acl_table_id(dvs)
assert acl_table_id is None


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_acl_portchannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,9 @@ def test_AclOnPortChannelMember(self, dvs):

# remove port channel
self.remove_port_channel(dvs, "PortChannel01")


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_admin_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,9 @@ def test_PortChannelMemberAdminStatus(self, dvs, testlog):

# remove port channel
self.remove_port_channel(dvs, "PortChannel6")


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_crm.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,3 +904,9 @@ def test_Configure_fdb(self, dvs, testlog):
assert threshold_high == 90
threshold_type = getCrmConfigStr(dvs, 'Config', 'fdb_entry_threshold_type')
assert threshold_type == 'percentage'


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_dirbcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,9 @@ def test_DirectedBroadcast(self, dvs, testlog):

if neigh['ip'] == "192.169.0.30":
assert False


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_drop_counters.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,3 +705,9 @@ def test_createAndDeleteMultipleCounters(self, dvs, testlog):
# Cleanup for the next test.
self.delete_drop_counter(name1)
self.remove_drop_reason(name1, reason1)


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_dtel.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,9 @@ def test_DtelEventAttribs(self, dvs, testlog):
tbl._del("EVENT_TYPE_QUEUE_REPORT_THRESHOLD_BREACH")
tbl._del("EVENT_TYPE_QUEUE_REPORT_TAIL_DROP")
tbl._del("EVENT_TYPE_DROP_REPORT")


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_fdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,3 +382,9 @@ def test_FdbAddedAfterMemberCreated(self, dvs, testlog):
dvs.runcmd("sonic-clear fdb all")
dvs.remove_vlan_member("2", "Ethernet0")
dvs.remove_vlan("2")


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_fdb_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,9 @@ def test_FDBLearnedAndFlushed(self, dvs, testlog):

# restore the default value of the servers
dvs.servers[server].runcmd("ifconfig eth0 0 down")


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1962,3 +1962,9 @@ def test_LoopbackInterfaceIpv4AddressWithVrf(self, dvs, testlog):
route = json.loads(key)
if route["dest"] == "10.0.0.4/32":
assert False


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_intf_mac.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,9 @@ def test_InterfaceChangeMac(self, dvs, testlog):

# remove port channel
self.remove_port_channel(dvs, "PortChannel002")


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,3 +872,9 @@ def test_AclBindMirror(self, dvs, testlog):
self.remove_neighbor("Ethernet32", "20.0.0.1")
self.remove_ip_address("Ethernet32", "20.0.0.0/31")
self.set_interface_status(dvs, "Ethernet32", "down")


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_mirror_ipv6_combined.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,3 +556,9 @@ def test_AclBindMirrorV6WrongConfig(self, dvs, testlog):
self.set_interface_status("Ethernet32", "down")




# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_mirror_ipv6_separate.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,3 +663,9 @@ def test_AclBindMirrorV6WrongConfig(self, dvs, testlog):
self.set_interface_status("Ethernet32", "down")




# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_mirror_policer.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,9 @@ def test_MirrorPolicerWithAcl(self, dvs, testlog):

# remove policer
self.remove_policer(policer)


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_mirror_port_erspan.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,3 +542,9 @@ def test_LAGMirrorToERSPANLagAddRemove(self, dvs, testlog):
self.dvs_mirror.remove_mirror_session(session)
self.dvs_mirror.verify_no_mirror()



# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_mirror_port_span.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,3 +470,9 @@ def test_PortLAGMirrorUpdateLAG(self, dvs, testlog):
self.dvs_lag.get_and_verify_port_channel(0)
self.dvs_vlan.asic_db.wait_for_n_keys("ASIC_STATE:SAI_OBJECT_TYPE_LAG", 0)



# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_nat.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,9 @@ def test_VerifyConntrackTimeoutForNatEntry(self, dvs, testlog):
# delete a static nat entry
dvs.runcmd("config nat remove static basic 67.66.65.1 18.18.18.2")



# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
8 changes: 7 additions & 1 deletion tests/test_neighbor.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,4 +389,10 @@ def test_NeighborAddRemoveIpv4WithVrf(self, dvs, testlog):
tbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY")
current_neigh_entries_cnt = len(tbl.getKeys())
dec_neigh_entries_cnt = (old_neigh_entries_cnt - current_neigh_entries_cnt)
assert dec_neigh_entries_cnt == 1
assert dec_neigh_entries_cnt == 1


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_nhg.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,9 @@ def asic_route_nhg_fvs(k):
assert k is not None
fvs = asic_route_nhg_fvs(k)
assert fvs is not None


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_pfc.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,9 @@ def test_PfcAsymmetric(self, dvs, testlog):
pfc = getPortAttr(dvs, port_oid, 'SAI_PORT_ATTR_PRIORITY_FLOW_CONTROL')
assert pfc == pfc_tx



# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_policer.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,9 @@ def test_PolicerBasic(self, dvs, testlog):
tbl = swsscommon.Table(dvs.adb, "ASIC_STATE:SAI_OBJECT_TYPE_POLICER")
policer_entries = tbl.getKeys()
assert len(policer_entries) == 0


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_port.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,9 @@ def test_PortIpredriver(self, dvs, testlog):
for fv in fvs:
if fv[0] == "SAI_PORT_ATTR_SERDES_IPREDRIVER":
assert fv[1] == ipre_val_asic


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_port_an.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,9 @@ def test_PortAutoNegWarm(self, dvs, testlog):
dvs.runcmd("config warm_restart disable swss")
# slow down crm polling
dvs.runcmd("crm config polling interval 10000")


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_port_buffer_rel.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@ def test_PortsAreUpAfterBuffers(self, dvs, testlog):
num_set += 1
# make sure that state is set for all "num_ports" ports
assert num_set == num_ports, "Not all ports are up"


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_port_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,9 @@ def test_port_breakout(self, dvs, port_config):
assert hw_lane_value == "1:%s" % (new_lanes[i])




# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_port_dpb.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,9 @@ def test_port_breakout_all(self, dvs):
start = i*maxBreakOut
end = start+maxBreakOut
dpb.breakin(dvs, child_port_names[start:end])


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_port_dpb_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,9 @@ def test_many_ports_many_acl_tables(self, dvs, dvs_acl):
for aclTable in aclTableNames:
dvs_acl.remove_acl_table(aclTable)
dvs_acl.verify_acl_table_count(0)


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_port_dpb_vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,9 @@ def test_all_port_10_vlans(self, dvs):
for vlan_name in vlan_names:
self.dvs_vlan.remove_vlan(vlan_name)
self.dvs_vlan.get_and_verify_vlan_ids(0)


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_port_mac_learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,9 @@ def test_PortchannelMacLearnMode(self, dvs, testlog):
tbl = swsscommon.Table(self.cdb, "PORTCHANNEL")
tbl._del("PortChannel001")
time.sleep(1)


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_portchannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,3 +263,9 @@ def test_Portchannel_oper_down(self, dvs, testlog):
tbl._del("PortChannel003")
tbl._del("PortChannel004")
time.sleep(1)


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_qos_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,9 @@ def test_port_dot1p(self, dvs):

port_cnt = len(swsscommon.Table(self.config_db, CFG_PORT_TABLE_NAME).getKeys())
assert port_cnt == cnt


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,3 +623,9 @@ def test_RouteAndNexthopInDifferentVrf(self, dvs, testlog):
dvs.servers[2].runcmd("ip address del 20.0.0.2/24 dev eth0")
dvs.servers[3].runcmd("ip route del default dev eth0")
dvs.servers[3].runcmd("ip address del 20.0.1.2/24 dev eth0")


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_setro.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ def test_SetReadOnlyAttribute(self, dvs, testlog):

# make action on appdb so orchagent will get RO value
# read asic db to see if orchagent behaved correctly


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
6 changes: 6 additions & 0 deletions tests/test_sflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,9 @@ def test_Teardown(self, dvs, testlog):

self.cdb.delete_entry("SFLOW", "global")
self.adb.wait_for_n_keys("ASIC_STATE:SAI_OBJECT_TYPE_SAMPLEPACKET", 0)


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass
Loading