diff --git a/SAS/TMSS/test/test_utils.py b/SAS/TMSS/test/test_utils.py index 71e8bb8423c1d5cb9f313be1472db2ddfd7f8de1..c24b714b8f8a4d9bf56aa7dddb26047787919fbd 100644 --- a/SAS/TMSS/test/test_utils.py +++ b/SAS/TMSS/test/test_utils.py @@ -521,6 +521,7 @@ def main_test_environment(): group.add_option('-w', '--websockets', dest='websockets', action='store_true', help='Enable json updates pushed via websockets') group.add_option('-f', '--feedbackservice', dest='feedbackservice', action='store_true', help='Enable feedbackservice to handle feedback from observations/pipelines which comes in via the (old qpid) otdb messagebus.') group.add_option('--all', dest='all', action='store_true', help='Enable/Start all the services, upload schemas and testdata') + group.add_option('--simulate', dest='simulate', action='store_true', help='Simulate a run of the first example scheduling_unit (implies --data and --eventmessages and --ra_test_environment)') group = OptionGroup(parser, 'Messaging options') parser.add_option_group(group) @@ -529,6 +530,11 @@ def main_test_environment(): (options, args) = parser.parse_args() + if options.simulate: + options.data = True + options.eventmessages = True + options.ra_test_environment = True + logging.basicConfig(format = '%(asctime)s %(levelname)s %(message)s', level = logging.INFO) with TMSSTestEnvironment(host=options.host, preferred_django_port=options.port, public_host=options.public_host, @@ -567,6 +573,15 @@ def main_test_environment(): print() print("Press Ctrl-C to exit (and remove the test database and django server automatically)") + if options.simulate: + stop_event = threading.Event() + with create_scheduling_unit_blueprint_simulator(1, stop_event=stop_event, + exchange=options.exchange, broker=options.broker): + try: + stop_event.wait() + except KeyboardInterrupt: + return + waitForInterrupt() @@ -631,6 +646,8 @@ def create_scheduling_unit_blueprint_simulator(scheduling_unit_blueprint_id: int if isProductionEnvironment(): raise RuntimeError("Do not use this tool to simulate running a scheduling_unit in a production environment!") + logger.info("starting to simulate a run for scheduling_unit id=%s ...", self.scheduling_unit_blueprint_id) + super().start_handling() try: