From ee15fa4d68876e79e809ba6e11341e81e41fc047 Mon Sep 17 00:00:00 2001 From: Bartek Grzybowski Date: Mon, 25 May 2020 03:56:58 -0700 Subject: Add functional test for 'clean' subcommand Change-Id: Iac2b7d5f912b22c6c4b342e350a71ee6ad8b1fbb Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski --- test/mocks/mass-pnf-sim/conftest.py | 4 ++++ test/mocks/mass-pnf-sim/test_lifecycle.py | 6 ++++++ 2 files changed, 10 insertions(+) (limited to 'test/mocks/mass-pnf-sim') diff --git a/test/mocks/mass-pnf-sim/conftest.py b/test/mocks/mass-pnf-sim/conftest.py index b5502f304..3323440da 100644 --- a/test/mocks/mass-pnf-sim/conftest.py +++ b/test/mocks/mass-pnf-sim/conftest.py @@ -32,3 +32,7 @@ def args_trigger(parser): @pytest.fixture(scope="module") def args_trigger_custom(parser): return parser.parse_args(['trigger_custom', '--triggerstart', '0', '--triggerend', str(SIM_INSTANCES-1)]) + +@pytest.fixture +def args_clean(parser): + return parser.parse_args(['clean']) diff --git a/test/mocks/mass-pnf-sim/test_lifecycle.py b/test/mocks/mass-pnf-sim/test_lifecycle.py index 9c5ff89be..dc1160c75 100644 --- a/test/mocks/mass-pnf-sim/test_lifecycle.py +++ b/test/mocks/mass-pnf-sim/test_lifecycle.py @@ -126,3 +126,9 @@ def test_stop_idempotence(args_stop, caplog, capfd): assert f'Stopping pnf-sim-lw-{instance} instance:' in caplog.text assert 'ROP_file_creator.sh already not running' in msg.out assert 'Simulator containers are already down' in msg.out + caplog.clear() + +def test_clean(args_clean): + m = MassPnfSim(args_clean) + m.clean() + assert not glob(f"{m.sim_dirname_pattern}*") -- cgit 1.2.3-korg