Skip to content

Commit

Permalink
[tests]: fix drops_group_test failure on second run (sonic-net#1023)
Browse files Browse the repository at this point in the history
a few tests in drops_group_test fails on second run.
The reason is that /tmp/dropstat is not cleaned, the first
run leave some state in the folder which cause the subsequent
run to fail.

The fix is the always clean up the folder.

Signed-off-by: Guohan Lu <lguohan@gmail.com>
  • Loading branch information
lguohan authored Aug 3, 2020
1 parent dfaae69 commit c9d3550
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/drops_group_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import sys
import os
import sys

import shutil
from click.testing import CliRunner

test_path = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -8,7 +10,6 @@
sys.path.insert(0, test_path)
sys.path.insert(0, modules_path)

import mock_tables.dbconnector
import show.main as show
import clear.main as clear

Expand Down Expand Up @@ -75,10 +76,14 @@
sonic_drops_test 0
"""

dropstat_path = "/tmp/dropstat"

class TestDropCounters(object):
@classmethod
def setup_class(cls):
print("SETUP")
if os.path.exists(dropstat_path):
shutil.rmtree(dropstat_path)
os.environ["PATH"] += os.pathsep + scripts_path
os.environ["UTILITIES_UNIT_TESTING"] = "1"

Expand Down

0 comments on commit c9d3550

Please sign in to comment.