test: that one cannot register a schema with the magic SparkplugB name
This commit is contained in:
parent
b5e91422de
commit
70ce781cc0
|
@ -12,6 +12,8 @@
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
|
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
|
||||||
|
|
||||||
|
-include("emqx_ee_schema_registry.hrl").
|
||||||
|
|
||||||
-define(APPS, [emqx_conf, emqx_ee_schema_registry]).
|
-define(APPS, [emqx_conf, emqx_ee_schema_registry]).
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
@ -182,7 +184,6 @@ t_crud(Config) ->
|
||||||
}},
|
}},
|
||||||
request({delete, SchemaName})
|
request({delete, SchemaName})
|
||||||
),
|
),
|
||||||
|
|
||||||
%% create a schema
|
%% create a schema
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
{ok, 201, #{
|
{ok, 201, #{
|
||||||
|
@ -193,6 +194,18 @@ t_crud(Config) ->
|
||||||
}},
|
}},
|
||||||
request({post, Params})
|
request({post, Params})
|
||||||
),
|
),
|
||||||
|
%% Test that we can't create a schema with the special Sparkplug B name
|
||||||
|
%% (the special Sparkplug B name contains a random sequence of chars so
|
||||||
|
%% should be very unlikely that users try to do this)
|
||||||
|
ParmsWithForbiddenName = maps:put(
|
||||||
|
<<"name">>, ?EMQX_SCHEMA_REGISTRY_SPARKPLUGB_SCHEMA_NAME, Params
|
||||||
|
),
|
||||||
|
?assertMatch(
|
||||||
|
{ok, 400, #{
|
||||||
|
<<"code">> := <<"BAD_REQUEST">>
|
||||||
|
}},
|
||||||
|
request({post, ParmsWithForbiddenName})
|
||||||
|
),
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
{ok, 200, #{
|
{ok, 200, #{
|
||||||
<<"type">> := SerdeTypeBin,
|
<<"type">> := SerdeTypeBin,
|
||||||
|
|
Loading…
Reference in New Issue