From 3b2a07b110d7b19cd6545df1f4f555fb15a914eb Mon Sep 17 00:00:00 2001 From: Luke Bakken Date: Thu, 15 Jun 2017 07:52:21 -0700 Subject: [PATCH] Correctly find schema for rabbit application named "rabbitmq.schema" Changes to support renaming rabbitmq.schema to rabbit.schema --- .../src/rabbit_ct_config_schema.erl | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/deps/rabbitmq_ct_helpers/src/rabbit_ct_config_schema.erl b/deps/rabbitmq_ct_helpers/src/rabbit_ct_config_schema.erl index 1e61f554ea..db27e00ad9 100644 --- a/deps/rabbitmq_ct_helpers/src/rabbit_ct_config_schema.erl +++ b/deps/rabbitmq_ct_helpers/src/rabbit_ct_config_schema.erl @@ -22,8 +22,7 @@ init_schemas(App, Config) -> DepsDir = ?config(erlang_mk_depsdir, Config), - % Note: the schema for the rabbit app is named "rabbitmq.schema" - RabbitSchema = filename:join([DepsDir, "rabbit", "priv", "schema", "rabbitmq.schema"]), + RabbitSchema = find_app_schema(rabbit, DepsDir), Schemas = case App of rabbit -> [RabbitSchema]; _ -> [RabbitSchema, find_app_schema(App, DepsDir)] @@ -46,20 +45,21 @@ init_schemas(App, Config) -> ]). find_app_schema(App, DepsDir) -> - Schema = get_schema_for([DepsDir, App, "priv"], App), - does_schema_exist(filelib:is_regular(Schema), App, DepsDir, Schema, cont). + SchemaFile = get_schema_for([DepsDir, App], App), + does_schema_exist(filelib:is_regular(SchemaFile), App, DepsDir, SchemaFile, cont). -does_schema_exist(true, _App, _DepsDir, Schema, _) -> - Schema; -does_schema_exist(false, App, _DepsDir, _Schema, stop) -> +does_schema_exist(true, _App, _DepsDir, SchemaFile, _) -> + SchemaFile; +does_schema_exist(false, App, _DepsDir, _SchemaFile, stop) -> ct:fail("Could not find schema for app: ~p~n", [App]); -does_schema_exist(false, App, DepsDir, _Schema, cont) -> +does_schema_exist(false, App, DepsDir, _SchemaFile, cont) -> % If not in umbrella, priv will be at ../priv - Schema = get_schema_for([DepsDir, "..", "priv"], App), - does_schema_exist(filelib:is_regular(Schema), App, DepsDir, Schema, stop). + SchemaFile = get_schema_for([DepsDir, ".."], App), + does_schema_exist(filelib:is_regular(SchemaFile), App, DepsDir, SchemaFile, stop). get_schema_for(Prefix, App) -> - filename:join(Prefix ++ ["schema", atom_to_list(App) ++ ".schema"]). + SchemaFileName = atom_to_list(App) ++ ".schema", + filename:join(Prefix ++ ["priv", "schema", SchemaFileName]). copy_to(File, Dir) -> BaseName = filename:basename(File),