Ejemplo n.º 1
0
def main(config_file, test_duration, print_output=False):
    """ main function which uses AutomaticTester class and tests if bb works or not

    :config_file: string (file path of the config file to be used)
    :test_duration: float/int (time for which the publishers should be on)
    """
    # only proceed if black box is running
    if not is_bb_running():
        print('Blackbox is not running. Please make sure it is running before',
              'executing this test script.')
        sys.exit(1)

    config_params = ConfigFileReader.load_config(config_file)
    DBUtils.clear_db(config_params.default.db_name)

    tester = AutomaticTester(config_params, test_duration)
    print("initialised all publisher")

    tester.start()
    print("publishers running")

    tester.stop()
    print("publishers stopped")

    return check_logs(config_params, test_duration, print_output=print_output)
Ejemplo n.º 2
0
 def test_clear_db(self):
     DBUtils.clear_db(db_name=self.test_db_name)
     database = self.client[self.test_db_name]
     self.assertSetEqual(set(database.list_collection_names()) - {'system.indexes'},
                         {'black_box_metadata'})