diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 0000000..1e7b7db --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,11 @@ +coverage: + status: + project: + default: + # Allow total coverage to drop by at most 2% + target: auto + threshold: 2% + patch: + default: + # Force any given PR to be at least 70% covered + target: 70% diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..de3dd09 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,155 @@ +name: Erlang Library CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ '**' ] + +env: + OTP_VERSION: 24.2 + REBAR_VERSION: 3.18 + THRIFT_VERSION: 0.14.2.1 + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup BEAM + uses: erlef/setup-beam@v1.10 + with: + otp-version: ${{ env.OTP_VERSION }} + rebar3-version: ${{ env.REBAR_VERSION }} + + - name: Cache _build + uses: actions/cache@v2 + with: + path: _build/*/lib + key: ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-build-${{ hashFiles('rebar.lock') }} + restore-keys: | + ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-build- + + - name: Compile + run: rebar3 compile + + check: + name: Check + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup BEAM + uses: erlef/setup-beam@v1.10 + with: + otp-version: ${{ env.OTP_VERSION }} + rebar3-version: ${{ env.REBAR_VERSION }} + + - name: Cache _build + uses: actions/cache@v2 + with: + path: _build/*/lib + key: ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-build-${{ hashFiles('rebar.lock') }} + restore-keys: | + ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-build- + + - name: Check formatting + run: rebar3 fmt -c + + - name: Run linting + run: rebar3 lint + + - name: Run xref + run: rebar3 xref + + dialyze: + name: Dialyze + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Thrift compiler + uses: valitydev/action-setup-thrift@v0.0.5 + with: + thrift-version: ${{ env.THRIFT_VERSION }} + + - name: Setup BEAM + uses: erlef/setup-beam@v1.10 + with: + otp-version: ${{ env.OTP_VERSION }} + rebar3-version: ${{ env.REBAR_VERSION }} + + - name: Cache _build + uses: actions/cache@v2 + with: + path: _build/*/lib + key: ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-build-${{ hashFiles('rebar.lock') }} + restore-keys: | + ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-build- + + - name: Cache PLTs + uses: actions/cache@v2 + with: + path: _build/test/rebar3_*_plt + key: ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-plt-${{ hashFiles('rebar.lock') }} + restore-keys: | + ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-plt- + + - name: Run dialyzer + run: rebar3 as test dialyzer + + test: + name: Test + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Thrift compiler + uses: valitydev/action-setup-thrift@v0.0.5 + with: + thrift-version: ${{ env.THRIFT_VERSION }} + + - name: Setup BEAM + uses: erlef/setup-beam@v1.10 + with: + otp-version: ${{ env.OTP_VERSION }} + rebar3-version: ${{ env.REBAR_VERSION }} + + - name: Cache _build + uses: actions/cache@v2 + with: + path: _build/*/lib + key: ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-build-${{ hashFiles('rebar.lock') }} + restore-keys: | + ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-build- + + - name: Run EUnit + run: rebar3 eunit --cover + + - name: Run CT + id: run-common-test + run: rebar3 ct --cover + + - name: Store CT Logs + if: ${{ failure() && steps.run-common-test.outcome == 'failure' }} + uses: actions/upload-artifact@v2 + with: + name: ct-logs + path: _build/test/logs + + - name: Generate coverage reports + run: rebar3 covertool generate + + - name: Upload coverage reports + uses: codecov/codecov-action@v2 + with: + files: _build/test/covertool/*.covertool.xml diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index ca5a761..0000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "build_utils"] - path = build_utils - url = git@github.com:rbkmoney/build_utils.git - branch = master diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 34abea0..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,42 +0,0 @@ -#!groovy -// -*- mode: groovy -*- -// -// Copyright 2017 RBKmoney -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -def finalHook = { - runStage('store CT logs') { - archive '_build/test/logs/' - } -} - -build('woody_erlang', 'docker-host', finalHook) { - checkoutRepo() - loadBuildUtils() - - def pipeErlangLib - runStage('load pipeline') { - env.JENKINS_LIB = "build_utils/jenkins_lib" - env.SH_TOOLS = "build_utils/sh" - pipeErlangLib = load("${env.JENKINS_LIB}/pipeErlangLib.groovy") - } - - // NOTE: Parallel pipeline almost always fails because of - // rebar3's design (it uses link for libraries, so - // parallel runs with different profiles brake each other) - // To prevent this use sequential pipleine here - - pipeErlangLib.runPipe(false, false, 'test') -} diff --git a/Makefile b/Makefile index 4c591d6..3f550d3 100644 --- a/Makefile +++ b/Makefile @@ -1,43 +1,19 @@ REBAR := $(shell which rebar3 2>/dev/null || which ./rebar3) -SUBMODULES = build_utils -SUBTARGETS = $(patsubst %,%/.git,$(SUBMODULES)) -UTILS_PATH := build_utils -# ToDo: remove unused TEMPLATES_PATH here, when the bug -# with handling of the varriable in build_utils is fixed -TEMPLATES_PATH := . -SERVICE_NAME := woody +.PHONY: compile test xref lint check_format format clean distclean dialyze cover bench -BUILD_IMAGE_NAME := build-erlang -BUILD_IMAGE_TAG := c60896ef07d41e7ae2e5f9b6ce845a60ad79acc7 - -CALL_W_CONTAINER := all submodules compile xref lint test bench dialyze clean distclean \ - check_format format - -.PHONY: $(CALL_W_CONTAINER) - -all: compile - --include $(UTILS_PATH)/make_lib/utils_container.mk - -$(SUBTARGETS): %/.git: % - git submodule update --init $< - touch $@ - -submodules: $(SUBTARGETS) - -compile: submodules +compile: $(REBAR) compile -test: submodules +test: $(REBAR) eunit $(REBAR) ct -xref: submodules +xref: $(REBAR) xref -lint: compile - elvis rock +lint: + $(REBAR) lint check_format: $(REBAR) fmt -c @@ -57,6 +33,10 @@ distclean: dialyze: $(REBAR) as test dialyzer +cover: + $(REBAR) cover + $(REBAR) covertool generate + bench: $(REBAR) as test bench -m bench_woody_event_handler -n 1000 $(REBAR) as test bench -m bench_woody_formatter -n 10 diff --git a/README.md b/README.md index 76e42b2..318a622 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -Woody [![Build Status](http://ci.rbkmoney.com/buildStatus/icon?job=rbkmoney_private/woody_erlang/master)](http://ci.rbkmoney.com/job/rbkmoney_private/view/Erlang/job/woody_erlang/job/master/) +Woody ====== -Erlang реализация [Библиотеки RPC вызовов для общения между микросервисами](http://coredocs.rbkmoney.com/design/ms/platform/rpc-lib/) +Erlang реализация [Библиотеки RPC вызовов для общения между микросервисами](#coredocs/design/ms/platform/rpc-lib/) версия требований: __ac4d40cc22d649d03369fcd52fb1230e51cdf52e__ @@ -58,7 +58,7 @@ Erlang реализация [Библиотеки RPC вызовов для об В случае вызова _thrift_ `oneway` функции (_thrift_ реализация _cast_) `woody_client:call/3` вернет `{ok, ok}`. -Если сервер бросает `Exception`, описанный в _.thrift_ файле сервиса (т.е. _Бизнес ошибку_ в [терминологии](http://coredocs.rbkmoney.com/design/ms/platform/overview/#_7) макросервис платформы), `woody_client:call/3` вернет это исключение в виде: `{exception, Exception}`. +Если сервер бросает `Exception`, описанный в _.thrift_ файле сервиса (т.е. _Бизнес ошибку_ в [терминологии](#coredocs/design/ms/platform/overview/#_7) макросервис платформы), `woody_client:call/3` вернет это исключение в виде: `{exception, Exception}`. В случае получения _Системной_ ошибки клиент выбрасывает _erlang:error_ типа `{woody_error, woody_error:system_error()}`. @@ -74,7 +74,7 @@ Erlang реализация [Библиотеки RPC вызовов для об 18> {ok, Result2} = woody_client:call(Request, Opts1, Context2). ``` -`Context` позволяет аннотировать RPC запросы дополнительными мета данными в виде _key-value_. `Context` передается только в запросах и изменение мета данных возможно только в режиме _append-only_ (т.е. на попытку переопределить уже существующую запись в `context meta`, библиотека вернет ошибку). Поскольку на транспортном уровне контекст передается в виде custom HTTP заголовков, синтаксис метаданных _key-value_ должен следовать ограничениям [RFC7230 ](https://tools.ietf.org/html/rfc7230#section-3.2.6). Размер ключа записи метаданных не должен превышать _53 байта_ (см. остальные требования к метаданным в [описании библиотеки](http://coredocs.rbkmoney.com/design/ms/platform/rpc-lib/#rpc_2)). +`Context` позволяет аннотировать RPC запросы дополнительными мета данными в виде _key-value_. `Context` передается только в запросах и изменение мета данных возможно только в режиме _append-only_ (т.е. на попытку переопределить уже существующую запись в `context meta`, библиотека вернет ошибку). Поскольку на транспортном уровне контекст передается в виде custom HTTP заголовков, синтаксис метаданных _key-value_ должен следовать ограничениям [RFC7230 ](https://tools.ietf.org/html/rfc7230#section-3.2.6). Размер ключа записи метаданных не должен превышать _53 байта_ (см. остальные требования к метаданным в [описании библиотеки](#coredocs/design/ms/platform/rpc-lib/#rpc_2)). ```erlang 19> Meta1 = #{<<"client1-name">> => <<"Vasya">>}. @@ -87,7 +87,7 @@ Erlang реализация [Библиотеки RPC вызовов для об 26> FullMeta = woody_context:get_meta(Context4). ``` -`Context` также позволяет задать [deadline](http://coredocs.rbkmoney.com/design/ms/platform/rpc-lib/#deadline) на исполнение запроса. Значение _deadline_ вложенных запросов можно менять произвольным образом. Также таймауты на запрос, [вычисляемые по deadline](src/woody_client_thrift_http_transport.erl), можно явно переопределить из приложения через _transport_opts_ в `woody_client:options()`. Модуль [woody_deadline](src/woody_deadline.erl) содержит API для работы с deadline. +`Context` также позволяет задать [deadline](#coredocs/design/ms/platform/rpc-lib/#deadline) на исполнение запроса. Значение _deadline_ вложенных запросов можно менять произвольным образом. Также таймауты на запрос, [вычисляемые по deadline](src/woody_client_thrift_http_transport.erl), можно явно переопределить из приложения через _transport_opts_ в `woody_client:options()`. Модуль [woody_deadline](src/woody_deadline.erl) содержит API для работы с deadline. ```erlang 27> Deadline = {{{2017, 12, 31}, {23, 59, 59}}, 350}. diff --git a/build_utils b/build_utils deleted file mode 160000 index e131872..0000000 --- a/build_utils +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e1318727d4d0c3e48f5122bf3197158b6695f50e diff --git a/elvis.config b/elvis.config index ed26d1d..ad33777 100644 --- a/elvis.config +++ b/elvis.config @@ -2,29 +2,27 @@ {elvis, [ {config, [ #{ - dirs => ["src", "test"], + dirs => ["src", "include", "test"], filter => "*.erl", + ruleset => erl_files, rules => [ - {elvis_style, line_length, #{limit => 120, skip_comments => false}}, - {elvis_style, no_tabs}, - {elvis_style, no_trailing_whitespace}, - {elvis_style, operator_spaces, #{rules => [{right, ","}, {right, "++"}, {left, "++"}]}}, + % common conventions + {elvis_text_style, line_length, #{limit => 120}}, {elvis_style, nesting_level, #{level => 3}}, - {elvis_style, god_modules, #{limit => 25, ignore => [woody_tests_SUITE]}}, - {elvis_style, no_if_expression}, + {elvis_style, no_if_expression, disable}, + {elvis_style, state_record_and_type, disable}, + % woody_erlang specific + {elvis_style, function_naming_convention, #{regex => "^([a-z][a-z0-9_]*_?)*$"}}, + {elvis_style, atom_naming_convention, #{regex => "^([a-z][a-zA-Z0-9_]*_?)*$"}}, + {elvis_style, macro_names, #{ignore => [woody_transport_opts_SUITE]}}, + {elvis_style, macro_module_names, disable}, {elvis_style, invalid_dynamic_call, #{ ignore => [ - woody_client_thrift, woody_event_formatter, + woody_event_handler, woody_util ] }}, - {elvis_style, used_ignored_variable}, - {elvis_style, no_behavior_info}, - {elvis_style, module_naming_convention, #{regex => "^[a-z]([a-z0-9]*_?)*(_SUITE)?$"}}, - {elvis_style, function_naming_convention, #{regex => "^[a-z]([a-z0-9]*_?)*$"}}, - {elvis_style, no_spec_with_records}, - {elvis_style, dont_repeat_yourself, #{min_complexity => 17, ignore => [woody_test_thrift, woody_tests_SUITE]}}, {elvis_style, no_debug_call, #{ ignore => [ woody_ssl_SUITE, @@ -33,18 +31,14 @@ woody_ct_event_h, benchmark_memory_pressure ] + }}, + {elvis_style, god_modules, #{limit => 25, ignore => [woody_tests_SUITE]}}, + {elvis_style, dont_repeat_yourself, #{ + min_complexity => 17, + ignore => [woody_test_thrift, woody_tests_SUITE] }} ] }, - #{ - dirs => ["src"], - filter => "*.app.src", - rules => [ - {elvis_style, line_length, #{limit => 120, skip_comments => false}}, - {elvis_style, no_tabs}, - {elvis_style, no_trailing_whitespace} - ] - }, #{ dirs => ["."], filter => "Makefile", @@ -58,10 +52,22 @@ #{ dirs => ["."], filter => "rebar.config", + ruleset => rebar_config, rules => [ - {elvis_style, line_length, #{limit => 120, skip_comments => false}}, - {elvis_style, no_tabs}, - {elvis_style, no_trailing_whitespace} + {elvis_text_style, line_length, #{limit => 120, skip_comments => false}}, + {elvis_text_style, no_tabs}, + {elvis_text_style, no_trailing_whitespace}, + %% Temporarily disabled till regex pattern is available + {elvis_project, no_deps_master_rebar, disable} + ] + }, + #{ + dirs => ["src"], + filter => "*.app.src", + rules => [ + {elvis_text_style, line_length, #{limit => 120, skip_comments => false}}, + {elvis_text_style, no_tabs}, + {elvis_text_style, no_trailing_whitespace} ] } ]} diff --git a/rebar.config b/rebar.config index e99fd0d..c8829ea 100644 --- a/rebar.config +++ b/rebar.config @@ -22,11 +22,11 @@ {deps, [ {cowboy, "2.9.0"}, {hackney, "1.18.0"}, - {gproc , "0.9.0"}, - {cache , "2.3.3"}, - {thrift, {git, "https://github.com/rbkmoney/thrift_erlang.git", {branch, "master"}}}, - {snowflake, {git, "https://github.com/rbkmoney/snowflake.git", {branch, "master"}}}, - {genlib, {git, "https://github.com/rbkmoney/genlib.git", {branch, "master"}}} + {gproc, "0.9.0"}, + {cache, "2.3.3"}, + {thrift, {git, "https://github.com/valitydev/thrift_erlang.git", {branch, "master"}}}, + {snowflake, {git, "https://github.com/valitydev/snowflake.git", {branch, "master"}}}, + {genlib, {git, "https://github.com/valitydev/genlib.git", {branch, "master"}}} ]}. {xref_checks, [ @@ -70,9 +70,14 @@ {deps, [ {cth_readable, "1.4.9"}, {proper, "1.4.0"}, - {woody_api_hay,{git, "https://github.com/rbkmoney/woody_api_hay.git", {branch, "master"}}}, - {damsel , {git, "https://github.com/rbkmoney/damsel.git", {ref, "8911ac3"}}}, - {mg_proto , {git, "https://github.com/rbkmoney/machinegun_proto.git", {ref, "ebae56f"}}} + {woody_api_hay, + {git, "https://github.com/valitydev/woody_api_hay.git", + {ref, "4c39134cddaa9bf6fb8db18e7030ae64f1efb3a9"}}}, + {damsel, + {git, "https://github.com/valitydev/damsel.git", {ref, "3fa6f31db54b2ae781b27898ab4daf56bb36eb36"}}}, + {mg_proto, + {git, "https://github.com/valitydev/machinegun-proto.git", + {ref, "ebae56fe2b3e79e4eb34afc8cb55c9012ae989f8"}}} ]}, {dialyzer, [ {plt_extra_apps, [how_are_you, eunit, proper, common_test, cth_readable]} @@ -81,14 +86,25 @@ ]}. {plugins, [ - {rebar3_thrift_compiler, {git, "https://github.com/rbkmoney/rebar3_thrift_compiler.git", {branch, "master"}}}, - {erlfmt, "0.14.1"} + {rebar3_thrift_compiler, {git, "https://github.com/valitydev/rebar3_thrift_compiler.git", {tag, "0.3.1"}}}, + {erlfmt, "1.0.0"}, + {rebar3_lint, "1.0.1"}, + {covertool, "2.0.4"} ]}. {erlfmt, [ {print_width, 120}, {files, [ - "{src,include,test}/*.{hrl,erl}", - "test/*/*.{hrl,erl}" + "{src,include}/*.{hrl,erl}", + "test/*.{hrl,erl}", + "rebar.config", + "elvis.config" + ]} +]}. + +{covertool, [ + {coverdata_files, [ + "eunit.coverdata", + "ct.coverdata" ]} ]}. diff --git a/rebar.config.script b/rebar.config.script deleted file mode 100644 index 93ee90c..0000000 --- a/rebar.config.script +++ /dev/null @@ -1,5 +0,0 @@ -case os:getenv("WERCKER_CACHE_DIR") of - false -> CONFIG; - [] -> CONFIG; - Dir -> lists:keystore(global_rebar_dir, 1, CONFIG, {global_rebar_dir, Dir}) -end. diff --git a/rebar.lock b/rebar.lock index 1fa17dc..255b17c 100644 --- a/rebar.lock +++ b/rebar.lock @@ -4,8 +4,8 @@ {<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.9.0">>},0}, {<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},1}, {<<"genlib">>, - {git,"https://github.com/rbkmoney/genlib.git", - {ref,"4565a8d73f34a0b78cca32c9cd2b97d298bdadf8"}}, + {git,"https://github.com/valitydev/genlib.git", + {ref,"82c5ff3866e3019eb347c7f1d8f1f847bed28c10"}}, 0}, {<<"gproc">>,{pkg,<<"gproc">>,<<"0.9.0">>},0}, {<<"hackney">>,{pkg,<<"hackney">>,<<"1.18.0">>},0}, @@ -15,12 +15,12 @@ {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.1">>},1}, {<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},1}, {<<"snowflake">>, - {git,"https://github.com/rbkmoney/snowflake.git", + {git,"https://github.com/valitydev/snowflake.git", {ref,"de159486ef40cec67074afe71882bdc7f7deab72"}}, 0}, {<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.6">>},1}, {<<"thrift">>, - {git,"https://github.com/rbkmoney/thrift_erlang.git", + {git,"https://github.com/valitydev/thrift_erlang.git", {ref,"c280ff266ae1c1906fb0dcee8320bb8d8a4a3c75"}}, 0}, {<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},1}]}. diff --git a/src/woody.app.src b/src/woody.app.src index 1f9bc53..4dcb2f9 100644 --- a/src/woody.app.src +++ b/src/woody.app.src @@ -17,9 +17,6 @@ {enable_debug, false} ]}, {modules, []}, - {maintainers, [ - "Anton Belyaev " - ]}, {licenses, []}, {links, []} ]}. diff --git a/src/woody_client_thrift_http_transport.erl b/src/woody_client_thrift_http_transport.erl index 7cc56f1..d9ba61d 100644 --- a/src/woody_client_thrift_http_transport.erl +++ b/src/woody_client_thrift_http_transport.erl @@ -300,9 +300,11 @@ check_error_reason(Headers, Code, WoodyState) -> -spec do_check_error_reason(header_parse_value(), woody:http_code(), woody_state:st()) -> woody_error:details(). do_check_error_reason(none, 200, _WoodyState) -> <<>>; -do_check_error_reason(none, Code, WoodyState) -> +do_check_error_reason(none, _Code, WoodyState) -> _ = log_event(?EV_TRACE, WoodyState, #{event => woody_util:to_binary([?HEADER_E_REASON, " header missing"])}), - woody_util:to_binary(["got response with http code ", Code, " and without ", ?HEADER_E_REASON, " header"]); + woody_util:to_binary([ + "This server does not implement the woody protocol ('", ?HEADER_E_REASON, "' header missing)." + ]); do_check_error_reason(Reason, _, _) -> Reason. diff --git a/src/woody_client_thrift_v2.erl b/src/woody_client_thrift_v2.erl index b2f6046..e204d23 100644 --- a/src/woody_client_thrift_v2.erl +++ b/src/woody_client_thrift_v2.erl @@ -294,9 +294,11 @@ check_error_reason(Headers, Code, WoodyState) -> -spec do_check_error_reason(header_parse_value(), woody:http_code(), woody_state:st()) -> woody_error:details(). do_check_error_reason(none, 200, _WoodyState) -> <<>>; -do_check_error_reason(none, Code, WoodyState) -> +do_check_error_reason(none, _Code, WoodyState) -> _ = log_event(?EV_TRACE, WoodyState, #{event => woody_util:to_binary([?HEADER_E_REASON, " header missing"])}), - woody_util:to_binary(["got response with http code ", Code, " and without ", ?HEADER_E_REASON, " header"]); + woody_util:to_binary([ + "This server does not implement the woody protocol ('", ?HEADER_E_REASON, "' header missing)." + ]); do_check_error_reason(Reason, _, _) -> Reason. diff --git a/src/woody_event_handler.erl b/src/woody_event_handler.erl index 5b43c95..f819d41 100644 --- a/src/woody_event_handler.erl +++ b/src/woody_event_handler.erl @@ -661,14 +661,14 @@ format_service_request_test_() -> ), ?_assertEqual( "[1012689088739803136 1012689108264288256 1012689088534282240][client] calling " - "CustomerManagement:Create(params=CustomerParams{party_id='1CQdDqPROyW',shop_id='1CQdDwgt3R3'," - "contact_info=ContactInfo{email='invalid_shop'},metadata=Value{nl=Null{}}})", + "CustomerManagement:Create(params=CustomerParams{customer_id='1',party_id='1CQdDqPROyW'," + "shop_id='1CQdDwgt3R3',contact_info=ContactInfo{email='invalid_shop'},metadata=Value{nl=Null{}}})", format_msg_limited( format_event( ?EV_CALL_SERVICE, #{ args => - {{payproc_CustomerParams, <<"1CQdDqPROyW">>, <<"1CQdDwgt3R3">>, + {{payproc_CustomerParams, <<"1">>, <<"1CQdDqPROyW">>, <<"1CQdDwgt3R3">>, {domain_ContactInfo, undefined, <<"invalid_shop">>}, {nl, {json_Null}}}}, function => 'Create', metadata => #{ diff --git a/test/woody_tests_SUITE.erl b/test/woody_tests_SUITE.erl index 3c28e2e..a081c38 100644 --- a/test/woody_tests_SUITE.erl +++ b/test/woody_tests_SUITE.erl @@ -760,13 +760,12 @@ call_no_headers_503_test(_) -> call_no_headers_504_test(_) -> call_fail_w_no_headers(<<"call_no_headers_404">>, result_unknown, 504). -call_fail_w_no_headers(Id, Class, Code) -> +call_fail_w_no_headers(Id, Class, _Code) -> Gun = <<"Enforcer">>, Context = make_context(Id), {Url, Service} = get_service_endpoint('Weapons'), - BinCode = integer_to_binary(Code), ?assertError( - {woody_error, {external, Class, <<"got response with http code ", BinCode:3/binary, _/binary>>}}, + {woody_error, {external, Class, <<"This server does not implement the woody protocol", _/binary>>}}, woody_client:call( {Service, get_weapon, {Gun, self_to_bin()}}, #{url => Url, event_handler => ?MODULE},