fix(bridge_v1_schema): undo changing v1 schema to avoid confusion
This commit is contained in:
parent
f94b943ec2
commit
432ddc5a3b
|
@ -235,11 +235,10 @@ mongodb_structs() ->
|
|||
|
||||
kafka_structs() ->
|
||||
[
|
||||
{kafka_producer,
|
||||
{kafka,
|
||||
mk(
|
||||
hoconsc:map(name, ref(emqx_bridge_kafka, kafka_producer)),
|
||||
#{
|
||||
aliases => [kafka],
|
||||
desc => <<"Kafka Producer Bridge Config">>,
|
||||
required => false,
|
||||
converter => fun kafka_producer_converter/2
|
||||
|
|
|
@ -168,11 +168,10 @@ roots() -> [{bridges, ?HOCON(?R_REF(bridges), #{importance => ?IMPORTANCE_LOW})}
|
|||
|
||||
fields(bridges) ->
|
||||
[
|
||||
{http,
|
||||
{webhook,
|
||||
mk(
|
||||
hoconsc:map(name, ref(emqx_bridge_http_schema, "config")),
|
||||
#{
|
||||
aliases => [webhook],
|
||||
desc => ?DESC("bridges_webhook"),
|
||||
required => false,
|
||||
converter => fun http_bridge_converter/2
|
||||
|
|
|
@ -21,7 +21,7 @@ empty_config_test() ->
|
|||
Conf1 = #{<<"bridges">> => #{}},
|
||||
Conf2 = #{<<"bridges">> => #{<<"webhook">> => #{}}},
|
||||
?assertEqual(Conf1, check(Conf1)),
|
||||
?assertEqual(#{<<"bridges">> => #{<<"http">> => #{}}}, check(Conf2)),
|
||||
?assertEqual(#{<<"bridges">> => #{<<"webhook">> => #{}}}, check(Conf2)),
|
||||
ok.
|
||||
|
||||
%% ensure webhook config can be checked
|
||||
|
@ -33,7 +33,7 @@ webhook_config_test() ->
|
|||
?assertMatch(
|
||||
#{
|
||||
<<"bridges">> := #{
|
||||
<<"http">> := #{
|
||||
<<"webhook">> := #{
|
||||
<<"the_name">> :=
|
||||
#{
|
||||
<<"method">> := get,
|
||||
|
@ -48,7 +48,7 @@ webhook_config_test() ->
|
|||
?assertMatch(
|
||||
#{
|
||||
<<"bridges">> := #{
|
||||
<<"http">> := #{
|
||||
<<"webhook">> := #{
|
||||
<<"the_name">> :=
|
||||
#{
|
||||
<<"method">> := get,
|
||||
|
@ -61,7 +61,7 @@ webhook_config_test() ->
|
|||
),
|
||||
#{
|
||||
<<"bridges">> := #{
|
||||
<<"http">> := #{
|
||||
<<"webhook">> := #{
|
||||
<<"the_name">> :=
|
||||
#{
|
||||
<<"method">> := get,
|
||||
|
|
|
@ -22,7 +22,7 @@ kafka_producer_test() ->
|
|||
#{
|
||||
<<"bridges">> :=
|
||||
#{
|
||||
<<"kafka_producer">> :=
|
||||
<<"kafka">> :=
|
||||
#{
|
||||
<<"myproducer">> :=
|
||||
#{<<"kafka">> := #{}}
|
||||
|
@ -35,7 +35,7 @@ kafka_producer_test() ->
|
|||
#{
|
||||
<<"bridges">> :=
|
||||
#{
|
||||
<<"kafka_producer">> :=
|
||||
<<"kafka">> :=
|
||||
#{
|
||||
<<"myproducer">> :=
|
||||
#{<<"local_topic">> := _}
|
||||
|
@ -48,7 +48,7 @@ kafka_producer_test() ->
|
|||
#{
|
||||
<<"bridges">> :=
|
||||
#{
|
||||
<<"kafka_producer">> :=
|
||||
<<"kafka">> :=
|
||||
#{
|
||||
<<"myproducer">> :=
|
||||
#{
|
||||
|
@ -64,7 +64,7 @@ kafka_producer_test() ->
|
|||
#{
|
||||
<<"bridges">> :=
|
||||
#{
|
||||
<<"kafka_producer">> :=
|
||||
<<"kafka">> :=
|
||||
#{
|
||||
<<"myproducer">> :=
|
||||
#{
|
||||
|
@ -166,7 +166,7 @@ message_key_dispatch_validations_test() ->
|
|||
?assertThrow(
|
||||
{_, [
|
||||
#{
|
||||
path := "bridges.kafka_producer.myproducer.kafka",
|
||||
path := "bridges.kafka.myproducer.kafka",
|
||||
reason := "Message key cannot be empty when `key_dispatch` strategy is used"
|
||||
}
|
||||
]},
|
||||
|
@ -175,7 +175,7 @@ message_key_dispatch_validations_test() ->
|
|||
?assertThrow(
|
||||
{_, [
|
||||
#{
|
||||
path := "bridges.kafka_producer.myproducer.kafka",
|
||||
path := "bridges.kafka.myproducer.kafka",
|
||||
reason := "Message key cannot be empty when `key_dispatch` strategy is used"
|
||||
}
|
||||
]},
|
||||
|
|
|
@ -80,7 +80,7 @@ worker_pool_size_test_() ->
|
|||
Conf = emqx_utils_maps:deep_put(
|
||||
[
|
||||
<<"bridges">>,
|
||||
<<"http">>,
|
||||
<<"webhook">>,
|
||||
<<"simple">>,
|
||||
<<"resource_opts">>,
|
||||
<<"worker_pool_size">>
|
||||
|
@ -88,7 +88,7 @@ worker_pool_size_test_() ->
|
|||
BaseConf,
|
||||
WorkerPoolSize
|
||||
),
|
||||
#{<<"bridges">> := #{<<"http">> := #{<<"simple">> := CheckedConf}}} = check(Conf),
|
||||
#{<<"bridges">> := #{<<"webhook">> := #{<<"simple">> := CheckedConf}}} = check(Conf),
|
||||
#{<<"resource_opts">> := #{<<"worker_pool_size">> := WPS}} = CheckedConf,
|
||||
WPS
|
||||
end,
|
||||
|
@ -117,7 +117,7 @@ worker_pool_size_test_() ->
|
|||
%%===========================================================================
|
||||
|
||||
parse_and_check_webhook_bridge(Hocon) ->
|
||||
#{<<"bridges">> := #{<<"http">> := #{<<"simple">> := Conf}}} = check(parse(Hocon)),
|
||||
#{<<"bridges">> := #{<<"webhook">> := #{<<"simple">> := Conf}}} = check(parse(Hocon)),
|
||||
Conf.
|
||||
|
||||
parse(Hocon) ->
|
||||
|
|
Loading…
Reference in New Issue