Skip to content

Commit 49df256

Browse files
committed
Revert "Add keepenv"
This reverts commit d7c79dd.
1 parent 852f3b0 commit 49df256

1 file changed

Lines changed: 9 additions & 20 deletions

File tree

tests/conftest.py

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -100,21 +100,15 @@ def pytest_addoption(parser):
100100
type=int,
101101
help="number of ports")
102102

103-
parser.addoption("--keepenv",
104-
action="store_true",
105-
default=False,
106-
help="Keep the current environment to skip validations and restart")
107-
108103

109104
def random_string(size=4, chars=string.ascii_uppercase + string.digits):
110105
return "".join(random.choice(chars) for x in range(size))
111106

112107

113108
class AsicDbValidator(DVSDatabase):
114-
def __init__(self, db_id: int, connector: str, wait_for_init = True):
109+
def __init__(self, db_id: int, connector: str):
115110
DVSDatabase.__init__(self, db_id, connector)
116-
if wait_for_init:
117-
self._wait_for_asic_db_to_initialize()
111+
self._wait_for_asic_db_to_initialize()
118112
self._populate_default_asic_db_values()
119113
self._generate_oid_to_interface_mapping()
120114

@@ -282,7 +276,6 @@ def __init__(
282276
newctnname: str = None,
283277
ctnmounts: Dict[str, str] = None,
284278
buffer_model: str = None,
285-
keepenv: bool = False
286279
):
287280
self.basicd = ["redis-server", "rsyslogd"]
288281
self.swssd = [
@@ -311,7 +304,6 @@ def __init__(
311304
ctn_sw_name = None
312305

313306
self.persistent = False
314-
self.keepenv = keepenv
315307

316308
self.client = docker.from_env()
317309

@@ -363,9 +355,8 @@ def __init__(
363355
# As part of https://github.com/Azure/sonic-buildimage/pull/4499
364356
# VS support dynamically create Front-panel ports so save the orginal
365357
# config db for persistent DVS
366-
if not self.keepenv:
367-
self.runcmd("mv /etc/sonic/config_db.json /etc/sonic/config_db.json.orig")
368-
self.ctn_restart()
358+
self.runcmd("mv /etc/sonic/config_db.json /etc/sonic/config_db.json.orig")
359+
self.ctn_restart()
369360

370361
# Dynamically create a DVS container and servers
371362
else:
@@ -478,9 +469,8 @@ def check_ready_status_and_init_db(self) -> None:
478469
self.init_appl_db_validator()
479470
self.reset_dbs()
480471

481-
if not self.keepenv:
482-
# Verify that SWSS has finished initializing.
483-
self.check_swss_ready()
472+
# Verify that SWSS has finished initializing.
473+
self.check_swss_ready()
484474

485475
except Exception:
486476
self.get_logs()
@@ -513,7 +503,7 @@ def _polling_function():
513503
wait_for_result(_polling_function, service_polling_config)
514504

515505
def init_asic_db_validator(self) -> None:
516-
self.asicdb = AsicDbValidator(self.ASIC_DB_ID, self.redis_sock, wait_for_init = not self.keepenv)
506+
self.asicdb = AsicDbValidator(self.ASIC_DB_ID, self.redis_sock)
517507

518508
def init_appl_db_validator(self) -> None:
519509
self.appldb = ApplDbValidator(self.APPL_DB_ID, self.redis_sock)
@@ -1752,7 +1742,6 @@ def manage_dvs(request) -> str:
17521742
buffer_model = request.config.getoption("--buffer_model")
17531743
force_recreate = request.config.getoption("--force-recreate-dvs")
17541744
graceful_stop = request.config.getoption("--graceful-stop")
1755-
keepenv = request.config.getoption("--keepenv")
17561745
global NUM_PORTS
17571746
NUM_PORTS = request.config.getoption("--num-ports")
17581747

@@ -1786,7 +1775,7 @@ def update_dvs(log_path, new_dvs_env=[]):
17861775
dvs.get_logs()
17871776
dvs.destroy()
17881777

1789-
dvs = DockerVirtualSwitch(name, imgname, keeptb, new_dvs_env, log_path, max_cpu, forcedvs, buffer_model = buffer_model, keepenv = keepenv)
1778+
dvs = DockerVirtualSwitch(name, imgname, keeptb, new_dvs_env, log_path, max_cpu, forcedvs, buffer_model = buffer_model)
17901779

17911780
curr_dvs_env = new_dvs_env
17921781

@@ -1809,7 +1798,7 @@ def update_dvs(log_path, new_dvs_env=[]):
18091798
dvs.get_logs()
18101799
dvs.destroy()
18111800

1812-
if dvs.persistent and not keepenv:
1801+
if dvs.persistent:
18131802
dvs.runcmd("mv /etc/sonic/config_db.json.orig /etc/sonic/config_db.json")
18141803
dvs.ctn_restart()
18151804

0 commit comments

Comments
 (0)