test(bpapi): Add API dump for 5.0.0

This commit is contained in:
ieQu1 2022-06-17 18:13:21 +02:00
parent ceb384145b
commit 78ffb2b2b1
6 changed files with 25 additions and 6 deletions

2
.gitignore vendored
View File

@ -63,6 +63,6 @@ erlang_ls.config
.envrc
# elixir
mix.lock
apps/emqx/test/emqx_static_checks_data/
apps/emqx/test/emqx_static_checks_data/master.bpapi
# rendered configurations
*.conf.rendered

View File

@ -28,6 +28,9 @@
%% (Major.Minor.Patch), and extra info can be added after a final
%% hyphen.
%% NOTE: ALso make sure to follow the instructions in end of
%% `apps/emqx/src/bpapi/README.md'
%% Community edition
-define(EMQX_RELEASE_CE, "5.0.1").

View File

@ -142,3 +142,14 @@ be useful when the protocol involves multicalls or multicasts.
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
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

View File

@ -16,7 +16,7 @@
-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 :(
-include_lib("dialyzer/src/dialyzer.hrl").
@ -238,8 +238,7 @@ dump(Opts) ->
warn_nonbpapi_rpcs(NonBPAPICalls),
APIDump = collect_bpapis(BPAPICalls),
DialyzerDump = collect_signatures(PLT, APIDump),
[Release | _] = string:split(emqx_app:get_release(), "-"),
dump_api(#{api => APIDump, signatures => DialyzerDump, release => Release}),
dump_api(#{api => APIDump, signatures => DialyzerDump, release => "master"}),
dump_versions(APIDump),
xref:stop(?XREF),
erase(bpapi_ok).
@ -293,7 +292,7 @@ is_bpapi_call({Module, _Function, _Arity}) ->
dump_api(Term = #{api := _, signatures := _, release := Release}) ->
Filename = filename:join(dumps_dir(), Release ++ ".bpapi"),
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.
dump_versions(APIs) ->

View File

@ -52,7 +52,12 @@ t_run_check(_) ->
"'bpapi.versions' files to the commit."
),
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
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