* Bump to rbkmoney/image-build@07d3946f
* Bump hackney to 1.16.0
This commit is contained in:
Andrew Mayorov 2020-06-30 15:19:53 +03:00 committed by GitHub
parent dd5eaa73ce
commit a434e55e14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 86 additions and 25 deletions

3
Jenkinsfile vendored
View File

@ -33,7 +33,7 @@ build('woody_erlang', 'docker-host', finalHook) {
}
runStage('dialyze') {
withGithubPrivkey {
withWsCache("_build/test/rebar3_21.3.8.7_plt") {
withWsCache("_build/test/rebar3_23.0.1_plt") {
sh 'make wc_dialyze'
}
}
@ -43,4 +43,3 @@ build('woody_erlang', 'docker-host', finalHook) {
}
}
}

View File

@ -7,7 +7,7 @@ UTILS_PATH := build_utils
# with handling of the varriable in build_utils is fixed
TEMPLATES_PATH := .
SERVICE_NAME := woody
BUILD_IMAGE_TAG := 4536c31941b9c27c134e8daf0fd18848809219c9
BUILD_IMAGE_TAG := 07d3946f8f005782697de20270ac58cdcd18b011
CALL_W_CONTAINER := all submodules compile xref lint test bench dialyze clean distclean

View File

@ -21,7 +21,7 @@
% Common project dependencies.
{deps, [
{cowboy, "2.7.0"},
{hackney, "1.15.2"},
{hackney, "1.16.0"},
{gproc , "0.8.0"},
{cache , "2.2.0"},
{thrift, {git, "https://github.com/rbkmoney/thrift_erlang.git", {branch, "master"}}},

View File

@ -1,7 +1,7 @@
{"1.1.0",
[{<<"bear">>,{pkg,<<"bear">>,<<"0.8.7">>},2},
{<<"cache">>,{pkg,<<"cache">>,<<"2.2.0">>},0},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.5.1">>},1},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.5.2">>},1},
{<<"cg_mon">>,
{git,"git@github.com:rbkmoney/cg_mon.git",
{ref,"5a87a37694e42b6592d3b4164ae54e0e87e24e18"}},
@ -17,40 +17,40 @@
{ref,"a6b9f52d61372cdbea6c5967053662dd3309e0d7"}},
0},
{<<"gproc">>,{pkg,<<"gproc">>,<<"0.8.0">>},0},
{<<"hackney">>,{pkg,<<"hackney">>,<<"1.15.2">>},0},
{<<"hackney">>,{pkg,<<"hackney">>,<<"1.16.0">>},0},
{<<"how_are_you">>,
{git,"https://github.com/rbkmoney/how_are_you.git",
{ref,"8f11d17eeb6eb74096da7363a9df272fd3099718"}},
0},
{<<"idna">>,{pkg,<<"idna">>,<<"6.0.0">>},1},
{<<"idna">>,{pkg,<<"idna">>,<<"6.0.1">>},1},
{<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},1},
{<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.2.0">>},1},
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.0">>},2},
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.0">>},1},
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.7.1">>},1},
{<<"snowflake">>,
{git,"https://github.com/rbkmoney/snowflake.git",
{ref,"563d8ef9543c1e4424aefa9ec7b41aa68885f0ad"}},
0},
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.5">>},1},
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.6">>},1},
{<<"thrift">>,
{git,"https://github.com/rbkmoney/thrift_erlang.git",
{ref,"d393ef9cdb10f3d761ba3a603df2b2929dc19a10"}},
{ref,"aa233e29a8d8682ae9e088eedde772f0ee45d105"}},
0},
{<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.4.1">>},2}]}.
{<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.5.0">>},2}]}.
[
{pkg_hash,[
{<<"bear">>, <<"16264309AE5D005D03718A5C82641FCC259C9E8F09ADEB6FD79CA4271168656F">>},
{<<"cache">>, <<"3C11DBF4CD8FCD5787C95A5FB2A04038E3729CFCA0386016EEA8C953AB48A5AB">>},
{<<"certifi">>, <<"867CE347F7C7D78563450A18A6A28A8090331E77FA02380B4A21962A65D36EE5">>},
{<<"certifi">>, <<"B7CFEAE9D2ED395695DD8201C57A2D019C0C43ECAF8B8BCB9320B40D6662F340">>},
{<<"cowboy">>, <<"91ED100138A764355F43316B1D23D7FF6BDB0DE4EA618CB5D8677C93A7A2F115">>},
{<<"cowlib">>, <<"FD0FF1787DB84AC415B8211573E9A30A3EBE71B5CBFF7F720089972B2319C8A4">>},
{<<"gproc">>, <<"CEA02C578589C61E5341FCE149EA36CCEF236CC2ECAC8691FBA408E7EA77EC2F">>},
{<<"hackney">>, <<"07E33C794F8F8964EE86CEBEC1A8ED88DB5070E52E904B8F12209773C1036085">>},
{<<"idna">>, <<"689C46CBCDF3524C44D5F3DDE8001F364CD7608A99556D8FBD8239A5798D4C10">>},
{<<"hackney">>, <<"5096AC8E823E3A441477B2D187E30DD3FFF1A82991A806B2003845CE72CE2D84">>},
{<<"idna">>, <<"1D038FB2E7668CE41FBF681D2C45902E52B3CB9E9C77B55334353B222C2EE50C">>},
{<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>},
{<<"mimerl">>, <<"67E2D3F571088D5CFD3E550C383094B47159F3EEE8FFA08E64106CDF5E981BE3">>},
{<<"parse_trans">>, <<"09765507A3C7590A784615CFD421D101AEC25098D50B89D7AA1D66646BC571C1">>},
{<<"ranch">>, <<"6B1FAB51B49196860B733A49C07604465A47BDB78AA10C1C16A3D199F7F8C881">>},
{<<"ssl_verify_fun">>, <<"6EAF7AD16CB568BB01753DBBD7A95FF8B91C7979482B95F38443FE2C8852A79B">>},
{<<"unicode_util_compat">>, <<"D869E4C68901DD9531385BB0C8C40444EBF624E60B6962D95952775CAC5E90CD">>}]}
{<<"ssl_verify_fun">>, <<"CF344F5692C82D2CD7554F5EC8FD961548D4FD09E7D22F5B62482E5AEAEBD4B0">>},
{<<"unicode_util_compat">>, <<"8516502659002CEC19E244EBD90D312183064BE95025A319A6C7E89F4BCCD65B">>}]}
].

View File

@ -12,8 +12,11 @@
%% common test callbacks
-export([
all/0,
groups/0,
init_per_suite/1,
end_per_suite/1
end_per_suite/1,
init_per_group/2,
end_per_group/2
]).
%% tests
@ -33,6 +36,7 @@
-export([init/1]).
-type config() :: [{atom(), any()}].
-type group_name() :: atom().
-type case_name() :: atom().
-define(PATH, "/v1/test/weapons").
@ -57,9 +61,24 @@
all() ->
[
{group, 'tlsv1.3'},
{group, 'tlsv1.2'},
{group, 'tlsv1.1'}
].
-spec groups() ->
[{group_name(), list(), [case_name()]}].
groups() ->
TestGroup = [
client_wo_cert_test,
invalid_client_cert_test,
valid_client_cert_test
],
[
{'tlsv1.1', [parallel], TestGroup},
{'tlsv1.2', [parallel], TestGroup},
{'tlsv1.3', [parallel], TestGroup}
].
-spec init_per_suite(config()) ->
@ -69,9 +88,7 @@ init_per_suite(C) ->
{ok, Sup} = supervisor:start_link({local, ?MODULE}, ?MODULE, []),
true = erlang:unlink(Sup),
{ok, Apps} = application:ensure_all_started(woody),
NewConfig = [{sup, Sup}, {apps, Apps} | C],
{ok, _WoodyServer} = start_woody_server(NewConfig),
NewConfig.
[{sup, Sup}, {apps, Apps} | C].
-spec end_per_suite(config()) ->
ok.
@ -82,6 +99,19 @@ end_per_suite(C) ->
[application:stop(App) || App <- proplists:get_value(apps, C)],
ok.
-spec init_per_group(group_name(), config()) ->
config().
init_per_group(Name, C) ->
{ok, WoodyServer} = start_woody_server(Name, C),
[{woody_server, WoodyServer}, {group_name, Name} | C].
-spec end_per_group(group_name(), config()) ->
any().
end_per_group(_Name, C) ->
stop_woody_server(C).
%%%
%%% Tests
%%%
@ -89,11 +119,18 @@ end_per_suite(C) ->
-spec client_wo_cert_test(config()) -> _.
client_wo_cert_test(C) ->
SSLOptions = [{cacertfile, ?ca_cert(C)}],
Vsn = ?config(group_name, C),
SSLOptions = [{cacertfile, ?ca_cert(C)} | client_ssl_opts(Vsn)],
try
get_weapon(?FUNCTION_NAME, <<"BFG">>, SSLOptions),
error(unreachable)
catch
% NOTE
% Seems that TLSv1.3 connection setup kinda racy.
error:{woody_error, {internal, result_unexpected, Reason}} when Vsn =:= 'tlsv1.3' ->
?assertMatch(<<"{tls_alert,{certificate_required", _/binary>>, Reason);
error:{woody_error, {external, result_unknown, <<"closed">>}} when Vsn =:= 'tlsv1.3' ->
ok;
error:{woody_error, {internal, result_unexpected, Reason}} ->
{match, _} = re:run(Reason, <<"^{tls_alert,[\"\{]handshake[ _]failure.*$">>, [])
end.
@ -101,21 +138,38 @@ client_wo_cert_test(C) ->
-spec valid_client_cert_test(config()) -> _.
valid_client_cert_test(C) ->
SSLOptions = [{cacertfile, ?ca_cert(C)}, {certfile, ?client_cert(C)}],
Vsn = ?config(group_name, C),
SSLOptions = [{cacertfile, ?ca_cert(C)}, {certfile, ?client_cert(C)} | client_ssl_opts(Vsn)],
{ok, #'Weapon'{}} = get_weapon(?FUNCTION_NAME, <<"BFG">>, SSLOptions).
-spec invalid_client_cert_test(config()) -> _.
invalid_client_cert_test(C) ->
SSLOptions = [{cacertfile, ?ca_cert(C)}, {certfile, ?invalid_client_cert(C)}],
Vsn = ?config(group_name, C),
SSLOptions = [{cacertfile, ?ca_cert(C)}, {certfile, ?invalid_client_cert(C)} | client_ssl_opts(Vsn)],
try
get_weapon(?FUNCTION_NAME, <<"BFG">>, SSLOptions),
error(unreachable)
catch
% NOTE
% Seems that TLSv1.3 connection setup kinda racy.
error:{woody_error, {external, result_unknown, <<"closed">>}} when Vsn =:= 'tlsv1.3' ->
ok;
error:{woody_error, {internal, result_unexpected, Reason}} ->
{match, _} = re:run(Reason, <<"^{tls_alert,[\"\{]unknown[ _]ca.*$">>, [])
end.
-spec client_ssl_opts(atom()) ->
[ssl:tls_client_option()].
client_ssl_opts('tlsv1.3') ->
% NOTE
% We need at least an extra TLSv1.2 here, otherwise hackney messes up
% client options.
[{versions, ['tlsv1.3', 'tlsv1.2']}];
client_ssl_opts(Vsn) ->
[{versions, [Vsn]}].
%%%
%%% woody_event_handler callback
%%%
@ -161,7 +215,7 @@ init(_) ->
%%% Internal functions
%%%
start_woody_server(C) ->
start_woody_server(Vsn, C) ->
Sup = ?config(sup, C),
Server = woody_server:child_spec(?MODULE, #{
handlers => [{?PATH, {{?THRIFT_DEFS, 'Weapons'}, ?MODULE}}],
@ -174,12 +228,20 @@ start_woody_server(C) ->
{cacertfile, ?ca_cert(C)},
{certfile, ?server_cert(C)},
{verify, verify_peer},
{fail_if_no_peer_cert, true}
{fail_if_no_peer_cert, true},
{versions, [Vsn]}
]
}
}),
supervisor:start_child(Sup, Server).
-spec stop_woody_server(config()) ->
ok.
stop_woody_server(C) ->
ok = supervisor:terminate_child(?config(sup, C), ?MODULE),
ok = supervisor:delete_child(?config(sup, C), ?MODULE).
get_weapon(Id, Gun, SSLOptions) ->
Context = woody_context:new(to_binary(Id)),
{Url, Service} = get_service_endpoint('Weapons'),