diff --git a/lib-ee/emqx_ee_schema_registry/test/emqx_ee_schema_registry_http_api_SUITE.erl b/lib-ee/emqx_ee_schema_registry/test/emqx_ee_schema_registry_http_api_SUITE.erl index ee6a693db..f3fdcd52f 100644 --- a/lib-ee/emqx_ee_schema_registry/test/emqx_ee_schema_registry_http_api_SUITE.erl +++ b/lib-ee/emqx_ee_schema_registry/test/emqx_ee_schema_registry_http_api_SUITE.erl @@ -12,6 +12,8 @@ -include_lib("common_test/include/ct.hrl"). -include_lib("snabbkaffe/include/snabbkaffe.hrl"). +-include("emqx_ee_schema_registry.hrl"). + -define(APPS, [emqx_conf, emqx_ee_schema_registry]). %%------------------------------------------------------------------------------ @@ -182,7 +184,6 @@ t_crud(Config) -> }}, request({delete, SchemaName}) ), - %% create a schema ?assertMatch( {ok, 201, #{ @@ -193,6 +194,18 @@ t_crud(Config) -> }}, 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( {ok, 200, #{ <<"type">> := SerdeTypeBin,