test: allow tests to run without desc cache
This commit is contained in:
parent
466a28daf2
commit
373e7b33f9
|
@ -60,7 +60,7 @@ lookup(Lang, Namespace, Id, Tag) ->
|
||||||
%% @doc Lookup the description of the configuration item from the given cache.
|
%% @doc Lookup the description of the configuration item from the given cache.
|
||||||
lookup(EtsTab, Lang0, Namespace, Id, Tag) ->
|
lookup(EtsTab, Lang0, Namespace, Id, Tag) ->
|
||||||
Lang = bin(Lang0),
|
Lang = bin(Lang0),
|
||||||
case ets:lookup(EtsTab, {Lang, bin(Namespace), bin(Id), bin(Tag)}) of
|
try ets:lookup(EtsTab, {Lang, bin(Namespace), bin(Id), bin(Tag)}) of
|
||||||
[{_, Desc}] ->
|
[{_, Desc}] ->
|
||||||
Desc;
|
Desc;
|
||||||
[] when Lang =/= <<"en">> ->
|
[] when Lang =/= <<"en">> ->
|
||||||
|
@ -69,6 +69,11 @@ lookup(EtsTab, Lang0, Namespace, Id, Tag) ->
|
||||||
_ ->
|
_ ->
|
||||||
%% undefined but not <<>>
|
%% undefined but not <<>>
|
||||||
undefined
|
undefined
|
||||||
|
catch
|
||||||
|
error:badarg ->
|
||||||
|
%% schema is not initialized
|
||||||
|
%% most likely in test cases
|
||||||
|
undefined
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% The desc files are of names like:
|
%% The desc files are of names like:
|
||||||
|
|
Loading…
Reference in New Issue