From 97bb31dd9dd3f6cc0f28645b94a6e65536d1ace0 Mon Sep 17 00:00:00 2001 From: Bartek Grzybowski Date: Mon, 25 May 2020 01:09:30 -0700 Subject: Add functional tests for 'start' command Change-Id: I6a0e6bf35384e861511972aab45faed2fa13a90e Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski --- test/mocks/mass-pnf-sim/test_lifecycle.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 -- cgit 1.2.3-korg