diff options
author | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2020-06-17 10:54:33 +0200 |
---|---|---|
committer | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2020-06-17 10:54:33 +0200 |
commit | 4d5f4e0c53b068fcdb1aff5aefb94a8c6a097bea (patch) | |
tree | c37479f2d0fe62b8c742548a0a5702f201e71a07 /test/mocks/mass-pnf-sim/MassPnfSim.py | |
parent | cc01b3ae0b06fb12cb5a6fed672d50ca433598f5 (diff) |
Remove the existing_sim_instances instance attribute
Existing simulator instances should be enumerated on
each call to helper function, not statically in constructor.
Change-Id: I93b7ac11e9dc99ce9d3727d577f057b1469a9439
Issue-ID: INT-1629
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'test/mocks/mass-pnf-sim/MassPnfSim.py')
-rwxr-xr-x | test/mocks/mass-pnf-sim/MassPnfSim.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/test/mocks/mass-pnf-sim/MassPnfSim.py b/test/mocks/mass-pnf-sim/MassPnfSim.py index 4907755d5..c7886d3d3 100755 --- a/test/mocks/mass-pnf-sim/MassPnfSim.py +++ b/test/mocks/mass-pnf-sim/MassPnfSim.py @@ -106,25 +106,24 @@ class MassPnfSim: self.sim_dirname_pattern = "pnf-sim-lw-" self.mvn_build_cmd = 'mvn clean package docker:build -Dcheckstyle.skip' self.docker_compose_status_cmd = 'docker-compose ps' - self.existing_sim_instances = self._enum_sim_instances() # Validate 'trigger_custom' subcommand options if self.args.subcommand == 'trigger_custom': - if (self.args.triggerend + 1) > self.existing_sim_instances: + if (self.args.triggerend + 1) > self._enum_sim_instances(): self.logger.error('--triggerend value greater than existing instance count.') exit(1) # Validate --count option for subcommands that support it if self.args.subcommand in ['start', 'stop', 'trigger', 'status', 'stop_simulator']: - if self.args.count > self.existing_sim_instances: + if self.args.count > self._enum_sim_instances(): self.logger.error('--count value greater that existing instance count') exit(1) - if not self.existing_sim_instances: + if not self._enum_sim_instances(): self.logger.error('No bootstrapped instance found') exit(1) # Validate 'bootstrap' subcommand - if (self.args.subcommand == 'bootstrap') and self.existing_sim_instances: + if (self.args.subcommand == 'bootstrap') and self._enum_sim_instances(): self.logger.error('Bootstrapped instances detected, not overwiriting, clean first') exit(1) @@ -167,13 +166,13 @@ class MassPnfSim: for the lifecycle commands''' if hasattr(self.args, 'count'): if not self.args.count: - return [self.existing_sim_instances] + return [self._enum_sim_instances()] else: return [self.args.count] elif hasattr(self.args, 'triggerstart'): return [self.args.triggerstart, self.args.triggerend + 1] else: - return [self.existing_sim_instances] + return [self._enum_sim_instances()] def _archive_logs(self, sim_dir): '''Helper function to archive simulator logs or create the log dir''' @@ -309,7 +308,7 @@ class MassPnfSim: def clean(self): self.logger.info('Cleaning simulators workdirs') - for sim_id in range(self.existing_sim_instances): + for sim_id in range(self._enum_sim_instances()): rmtree(f"{self.sim_dirname_pattern}{sim_id}") def start(self): |