diff options
author | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2020-05-25 01:10:32 -0700 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2020-05-25 14:06:11 +0000 |
commit | 5ca49c964c385b8277c7e9bf0f344f8cbc3c2602 (patch) | |
tree | 921fb8c50169296ee2722a51fbc0e9fbe9bf4512 /test | |
parent | 97bb31dd9dd3f6cc0f28645b94a6e65536d1ace0 (diff) |
Add functional tests for 'trigger' command
Change-Id: Ie3f0a5c5b5276c058da3d284d5531ab5c821e3b8
Issue-ID: INT-1577
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/mocks/mass-pnf-sim/test_lifecycle.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/mocks/mass-pnf-sim/test_lifecycle.py b/test/mocks/mass-pnf-sim/test_lifecycle.py index cb83b7d3a..5eaa40946 100644 --- a/test/mocks/mass-pnf-sim/test_lifecycle.py +++ b/test/mocks/mass-pnf-sim/test_lifecycle.py @@ -5,6 +5,7 @@ from yaml import load, SafeLoader from ipaddress import ip_address from test_settings import * import pytest +from time import sleep # These test routines perform functional testing in current file tree context # thus they require that no simulator instances are bootstrapped and running @@ -76,3 +77,20 @@ def test_start_idempotence(args_start, capfd): msg = capfd.readouterr() assert 'Simulator containers are already up' in msg.out assert 'Starting simulator containers' not in msg.out + +def test_trigger(args_trigger, caplog, capfd): + sleep(5) # Wait for the simulator to settle + MassPnfSim(args_trigger).trigger() + msg = capfd.readouterr() + for instance in range(SIM_INSTANCES): + instance_ip_offset = instance * 16 + ip_offset = 2 + 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 + +def test_trigger_idempotence(args_trigger, capfd): + MassPnfSim(args_trigger).trigger() + msg = capfd.readouterr() + assert "Cannot start simulator since it's already running" in msg.out + assert 'Simulator started' not in msg.out |