Skip to content

Commit fc6d558

Browse files
authored
Merge pull request #12 from rabbitmq/find-rabbit-schema
Correctly find schema for rabbit application named "rabbit.schema"
2 parents 6dee656 + 00dfc2e commit fc6d558

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/rabbit_ct_config_schema.erl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
init_schemas(App, Config) ->
2424
DepsDir = ?config(erlang_mk_depsdir, Config),
25-
% Note: the schema for the rabbit app is named "rabbitmq.schema"
26-
RabbitSchema = filename:join([DepsDir, "rabbit", "priv", "schema", "rabbitmq.schema"]),
25+
RabbitSchema = find_app_schema(rabbit, DepsDir),
2726
Schemas = case App of
2827
rabbit -> [RabbitSchema];
2928
_ -> [RabbitSchema, find_app_schema(App, DepsDir)]
@@ -46,20 +45,21 @@ init_schemas(App, Config) ->
4645
]).
4746

4847
find_app_schema(App, DepsDir) ->
49-
Schema = get_schema_for([DepsDir, App, "priv"], App),
50-
does_schema_exist(filelib:is_regular(Schema), App, DepsDir, Schema, cont).
48+
SchemaFile = get_schema_for([DepsDir, App], App),
49+
does_schema_exist(filelib:is_regular(SchemaFile), App, DepsDir, SchemaFile, cont).
5150

52-
does_schema_exist(true, _App, _DepsDir, Schema, _) ->
53-
Schema;
54-
does_schema_exist(false, App, _DepsDir, _Schema, stop) ->
51+
does_schema_exist(true, _App, _DepsDir, SchemaFile, _) ->
52+
SchemaFile;
53+
does_schema_exist(false, App, _DepsDir, _SchemaFile, stop) ->
5554
ct:fail("Could not find schema for app: ~p~n", [App]);
56-
does_schema_exist(false, App, DepsDir, _Schema, cont) ->
55+
does_schema_exist(false, App, DepsDir, _SchemaFile, cont) ->
5756
% If not in umbrella, priv will be at ../priv
58-
Schema = get_schema_for([DepsDir, "..", "priv"], App),
59-
does_schema_exist(filelib:is_regular(Schema), App, DepsDir, Schema, stop).
57+
SchemaFile = get_schema_for([DepsDir, ".."], App),
58+
does_schema_exist(filelib:is_regular(SchemaFile), App, DepsDir, SchemaFile, stop).
6059

6160
get_schema_for(Prefix, App) ->
62-
filename:join(Prefix ++ ["schema", atom_to_list(App) ++ ".schema"]).
61+
SchemaFileName = atom_to_list(App) ++ ".schema",
62+
filename:join(Prefix ++ ["priv", "schema", SchemaFileName]).
6363

6464
copy_to(File, Dir) ->
6565
BaseName = filename:basename(File),

0 commit comments

Comments
 (0)