log.info('TEST_DATA_PATH: %s' % TEST_DATA_PATH) if not os.path.exists(TEST_DATA_PATH): log.info('test data dir not exists, creating.. ') os.makedirs(TEST_DATA_PATH) parser = argparse.ArgumentParser(description='RGW S3 Automation') parser.add_argument('-c', dest="config", help='RGW Test yaml configuration') args = parser.parse_args() yaml_file = args.config config = Config(yaml_file) with open(yaml_file, 'r') as f: doc = yaml.load(f) test_info.name = 'storage_policy for %s' % config.rgw_client test_info.started_info() config.objects_size_range = doc['config']['objects_size_range'] config.rgw_client = doc['rgw_client'] test_exec(config) test_info.success_status('test passed') sys.exit(0) except (RGWBaseException, Exception) as e: log.info(e) log.info(traceback.format_exc()) test_info.failed_status('test failed') sys.exit(1)
sys.exit(0) except Exception as e: log.info(e) log.info(traceback.format_exc()) test_info.failed_status("test failed") sys.exit(1) except TestExecError as e: log.info(e) log.info(traceback.format_exc()) test_info.failed_status("test failed") sys.exit(1) if __name__ == "__main__": project_dir = os.path.abspath(os.path.join(__file__, "../../..")) test_data_dir = "test_data" TEST_DATA_PATH = os.path.join(project_dir, test_data_dir) log.info("TEST_DATA_PATH: %s" % TEST_DATA_PATH) if not os.path.exists(TEST_DATA_PATH): log.info("test data dir not exists, creating.. ") os.makedirs(TEST_DATA_PATH) parser = argparse.ArgumentParser(description="RGW S3 Automation") parser.add_argument("-c", dest="config", help="RGW Test yaml configuration") args = parser.parse_args() yaml_file = args.config config = Config() with open(yaml_file, "r") as f: doc = yaml.load(f) config.rgw_client = doc["rgw_client"] test_exec(config)