aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/mass-pnf-sim
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-05-25 01:09:30 -0700
committerMorgan Richomme <morgan.richomme@orange.com>2020-05-25 14:06:11 +0000
commit97bb31dd9dd3f6cc0f28645b94a6e65536d1ace0 (patch)
treeb78b401ce29bcf5b8b31a8f432f9bf668b359684 /test/mocks/mass-pnf-sim
parent2b709a7ffb716cb44d31c784f8dc4a9254ebebaf (diff)
Add functional tests for 'start' command
Change-Id: I6a0e6bf35384e861511972aab45faed2fa13a90e Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'test/mocks/mass-pnf-sim')
-rw-r--r--test/mocks/mass-pnf-sim/test_lifecycle.py18
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 c3ef1ee6f..cb83b7d3a 100644
--- a/test/mocks/mass-pnf-sim/test_lifecycle.py
+++ b/test/mocks/mass-pnf-sim/test_lifecycle.py
@@ -58,3 +58,21 @@ def test_bootstrap(args_bootstrap, parser, caplog):
assert str(ip_address(IPSTART) + ip_offset + instance_ip_offset) == yml['ippnfsim']
start_port += 2
print(yml['ippnfsim'])
+
+def test_start(args_start, caplog, capfd):
+ MassPnfSim(args_start).start()
+ msg = capfd.readouterr()
+ for instance in range(SIM_INSTANCES):
+ instance_ip_offset = instance * 16
+ ip_offset = 2
+ assert f'Starting 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 'Starting simulator containers' in msg.out
+ caplog.clear()
+
+def test_start_idempotence(args_start, capfd):
+ '''Verify start idempotence'''
+ MassPnfSim(args_start).start()
+ msg = capfd.readouterr()
+ assert 'Simulator containers are already up' in msg.out
+ assert 'Starting simulator containers' not in msg.out