aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/mass-pnf-sim/test_lifecycle.py
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-05-25 03:38:06 -0700
committerMorgan Richomme <morgan.richomme@orange.com>2020-05-25 14:06:11 +0000
commitb299db21973b0f73e0de20004ec8f77c537d6c0d (patch)
tree1fa23d5d77f875af609b4a8ad006d761be7cd9e8 /test/mocks/mass-pnf-sim/test_lifecycle.py
parent5196e3367b316faeb8b6b7d5204333e55e4ea61d (diff)
Add functional tests for 'stop' subcommand
Change-Id: Id3640c494f21fb4869fcf412dc83824dc8670d12 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'test/mocks/mass-pnf-sim/test_lifecycle.py')
-rw-r--r--test/mocks/mass-pnf-sim/test_lifecycle.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/mocks/mass-pnf-sim/test_lifecycle.py b/test/mocks/mass-pnf-sim/test_lifecycle.py
index 1ae696c84..9c5ff89be 100644
--- a/test/mocks/mass-pnf-sim/test_lifecycle.py
+++ b/test/mocks/mass-pnf-sim/test_lifecycle.py
@@ -88,6 +88,7 @@ def test_trigger(args_trigger, caplog, capfd):
assert f'Triggering pnf-sim-lw-{instance} instance:' in caplog.text
assert f'PNF-Sim IP: {str(ip_address(IPSTART) + ip_offset + instance_ip_offset)}' in msg.out
assert 'Simulator started' in msg.out
+ caplog.clear()
def test_trigger_idempotence(args_trigger, capfd):
MassPnfSim(args_trigger).trigger()
@@ -105,3 +106,23 @@ def test_trigger_custom(args_trigger_custom, caplog, capfd):
assert f'PNF-Sim IP: {str(ip_address(IPSTART) + ip_offset + instance_ip_offset)}' in msg.out
assert 'Simulator started' not in msg.out
assert "Cannot start simulator since it's already running" in msg.out
+ caplog.clear()
+
+def test_stop(args_stop, caplog, capfd):
+ MassPnfSim(args_stop).stop()
+ msg = capfd.readouterr()
+ for instance in range(SIM_INSTANCES):
+ instance_ip_offset = instance * 16
+ ip_offset = 2
+ assert f'Stopping pnf-sim-lw-{instance} instance:' in caplog.text
+ assert f'PNF-Sim IP: {str(ip_address(IPSTART) + ip_offset + instance_ip_offset)}' in msg.out
+ assert f"ROP_file_creator.sh {instance}" not in popen('ps afx').read()
+ caplog.clear()
+
+def test_stop_idempotence(args_stop, caplog, capfd):
+ MassPnfSim(args_stop).stop()
+ msg = capfd.readouterr()
+ for instance in range(SIM_INSTANCES):
+ 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