Merge pull request #8278 from ieQu1/bpapi-5.0
test(bpapi): Add API dump for 5.0.0
This commit is contained in:
commit
e4b5c3a9c4
|
@ -63,6 +63,6 @@ erlang_ls.config
|
||||||
.envrc
|
.envrc
|
||||||
# elixir
|
# elixir
|
||||||
mix.lock
|
mix.lock
|
||||||
apps/emqx/test/emqx_static_checks_data/
|
apps/emqx/test/emqx_static_checks_data/master.bpapi
|
||||||
# rendered configurations
|
# rendered configurations
|
||||||
*.conf.rendered
|
*.conf.rendered
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
%% (Major.Minor.Patch), and extra info can be added after a final
|
%% (Major.Minor.Patch), and extra info can be added after a final
|
||||||
%% hyphen.
|
%% hyphen.
|
||||||
|
|
||||||
|
%% NOTE: ALso make sure to follow the instructions in end of
|
||||||
|
%% `apps/emqx/src/bpapi/README.md'
|
||||||
|
|
||||||
%% Community edition
|
%% Community edition
|
||||||
-define(EMQX_RELEASE_CE, "5.0.1").
|
-define(EMQX_RELEASE_CE, "5.0.1").
|
||||||
|
|
||||||
|
|
|
@ -142,3 +142,14 @@ be useful when the protocol involves multicalls or multicasts.
|
||||||
The business logic can assume that the supported protocol version is
|
The business logic can assume that the supported protocol version is
|
||||||
not going to change on the remote node, while it is running. So it is
|
not going to change on the remote node, while it is running. So it is
|
||||||
free to cache it for the duration of the session.
|
free to cache it for the duration of the session.
|
||||||
|
|
||||||
|
# New minor release
|
||||||
|
|
||||||
|
After releasing, let's say, 5.1.0, the following actions should be performed to prepare for the next release:
|
||||||
|
|
||||||
|
1. Checkout 5.1.0 tag
|
||||||
|
1. Build the code
|
||||||
|
1. Rename `apps/emqx/test/emqx_static_checks_data/master.bpapi` to `apps/emqx/test/emqx_static_checks_data/5.1.bpapi`
|
||||||
|
1. Add `apps/emqx/test/emqx_static_checks_data/5.1.bpapi` to the repo
|
||||||
|
1. Delete the previous file (e.g. `5.0.bpapi`), unless there is plan to support rolling upgrade from 5.0 to 5.2
|
||||||
|
1. Merge the commit to master branch
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
-module(emqx_bpapi_static_checks).
|
-module(emqx_bpapi_static_checks).
|
||||||
|
|
||||||
-export([run/0, dump/1, dump/0, check_compat/1, versions_file/0]).
|
-export([run/0, dump/1, dump/0, check_compat/1, versions_file/0, dumps_dir/0]).
|
||||||
|
|
||||||
%% Using an undocumented API here :(
|
%% Using an undocumented API here :(
|
||||||
-include_lib("dialyzer/src/dialyzer.hrl").
|
-include_lib("dialyzer/src/dialyzer.hrl").
|
||||||
|
@ -238,8 +238,7 @@ dump(Opts) ->
|
||||||
warn_nonbpapi_rpcs(NonBPAPICalls),
|
warn_nonbpapi_rpcs(NonBPAPICalls),
|
||||||
APIDump = collect_bpapis(BPAPICalls),
|
APIDump = collect_bpapis(BPAPICalls),
|
||||||
DialyzerDump = collect_signatures(PLT, APIDump),
|
DialyzerDump = collect_signatures(PLT, APIDump),
|
||||||
[Release | _] = string:split(emqx_app:get_release(), "-"),
|
dump_api(#{api => APIDump, signatures => DialyzerDump, release => "master"}),
|
||||||
dump_api(#{api => APIDump, signatures => DialyzerDump, release => Release}),
|
|
||||||
dump_versions(APIDump),
|
dump_versions(APIDump),
|
||||||
xref:stop(?XREF),
|
xref:stop(?XREF),
|
||||||
erase(bpapi_ok).
|
erase(bpapi_ok).
|
||||||
|
@ -293,7 +292,7 @@ is_bpapi_call({Module, _Function, _Arity}) ->
|
||||||
dump_api(Term = #{api := _, signatures := _, release := Release}) ->
|
dump_api(Term = #{api := _, signatures := _, release := Release}) ->
|
||||||
Filename = filename:join(dumps_dir(), Release ++ ".bpapi"),
|
Filename = filename:join(dumps_dir(), Release ++ ".bpapi"),
|
||||||
ok = filelib:ensure_dir(Filename),
|
ok = filelib:ensure_dir(Filename),
|
||||||
file:write_file(Filename, io_lib:format("~0p.", [Term])).
|
file:write_file(Filename, io_lib:format("~0p.~n", [Term])).
|
||||||
|
|
||||||
-spec dump_versions(api_dump()) -> ok.
|
-spec dump_versions(api_dump()) -> ok.
|
||||||
dump_versions(APIs) ->
|
dump_versions(APIs) ->
|
||||||
|
|
|
@ -52,7 +52,12 @@ t_run_check(_) ->
|
||||||
"'bpapi.versions' files to the commit."
|
"'bpapi.versions' files to the commit."
|
||||||
),
|
),
|
||||||
error(version_mismatch)
|
error(version_mismatch)
|
||||||
end
|
end,
|
||||||
|
BpapiDumps = filelib:wildcard(
|
||||||
|
filename:join(emqx_bpapi_static_checks:dumps_dir(), "*.bpapi")
|
||||||
|
),
|
||||||
|
logger:info("Backplane API dump files: ~p", [BpapiDumps]),
|
||||||
|
?assert(emqx_bpapi_static_checks:check_compat(BpapiDumps))
|
||||||
catch
|
catch
|
||||||
EC:Err:Stack ->
|
EC:Err:Stack ->
|
||||||
logger:critical("Test suite failed: ~p:~p~nStack:~p", [EC, Err, Stack]),
|
logger:critical("Test suite failed: ~p:~p~nStack:~p", [EC, Err, Stack]),
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue