diff options
author | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2020-06-03 11:46:51 +0200 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2020-06-05 13:47:18 +0000 |
commit | c17ed78948a2b08384ba82f084f5b1366eca4e24 (patch) | |
tree | 8dd6c9222aadf832fc3fbc74d246ca99458e5c20 /test/mocks/mass-pnf-sim/test_lifecycle.py | |
parent | 7c41c16ed62fef316f6e93faeb18bec350c5fbf5 (diff) |
Drop shell wrapper for stopping simulator instances
Instance method is added to manage stopping simulator
instances and ROP scripts directly in MassPnfSim class.
Change-Id: Ic551f99c0f5f2a177b9c72daac02690b0bbded04
Issue-ID: INT-1610
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.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/test/mocks/mass-pnf-sim/test_lifecycle.py b/test/mocks/mass-pnf-sim/test_lifecycle.py index c61b72dd1..beaa084a8 100644 --- a/test/mocks/mass-pnf-sim/test_lifecycle.py +++ b/test/mocks/mass-pnf-sim/test_lifecycle.py @@ -133,24 +133,32 @@ def test_trigger_custom(args_trigger_custom, caplog, capfd): assert "Cannot start simulator since it's already running" in msg.out caplog.clear() -def test_stop(args_stop, caplog, capfd): +def test_stop(args_stop, caplog): 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'PNF-Sim IP: {str(ip_address(IPSTART) + ip_offset + instance_ip_offset)}' in caplog.text + assert f'ROP_file_creator.sh {instance} successfully killed' in caplog.text assert f"ROP_file_creator.sh {instance}" not in popen('ps afx').read() caplog.clear() -def test_stop_idempotence(args_stop, caplog, capfd): +def test_stop_status(args_status, docker_containers, caplog): + MassPnfSim(args_status).status() + for instance in range(SIM_INSTANCES): + assert f"{PNF_SIM_CONTAINER_NAME}{instance}" not in docker_containers + assert 'Simulator containers are down' in caplog.text + caplog.clear() + +def test_stop_idempotence(args_stop, caplog, docker_containers): 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 + assert f'ROP_file_creator.sh {instance} already not running' in caplog.text + assert 'Simulator containers are already down' in caplog.text + assert f"ROP_file_creator.sh {instance}" not in popen('ps afx').read() + assert f"{PNF_SIM_CONTAINER_NAME}{instance}" not in docker_containers caplog.clear() def test_clean(args_clean): |