diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..5401b79 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_size = 4 +indent_style = space +trim_trailing_whitespace = true +max_line_length = 120 diff --git a/.env b/.env new file mode 100644 index 0000000..eb41925 --- /dev/null +++ b/.env @@ -0,0 +1,6 @@ +# NOTE +# You SHOULD specify point releases here so that build time and run time Erlang/OTPs +# are the same. See: https://github.com/erlware/relx/pull/902 +OTP_VERSION=24.2.0 +REBAR_VERSION=3.18 +THRIFT_VERSION=0.14.2.2 diff --git a/.github/workflows/erlang-checks.yml b/.github/workflows/erlang-checks.yml new file mode 100644 index 0000000..d4fa15c --- /dev/null +++ b/.github/workflows/erlang-checks.yml @@ -0,0 +1,38 @@ +name: Erlang CI Checks + +on: + push: + branches: + - 'master' + - 'epic/**' + pull_request: + branches: ['**'] + +jobs: + setup: + name: Load .env + runs-on: ubuntu-latest + outputs: + otp-version: ${{ steps.otp-version.outputs.version }} + rebar-version: ${{ steps.rebar-version.outputs.version }} + thrift-version: ${{ steps.thrift-version.outputs.version }} + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - run: grep -v '^#' .env >> $GITHUB_ENV + - id: otp-version + run: echo "::set-output name=version::$OTP_VERSION" + - id: rebar-version + run: echo "::set-output name=version::$REBAR_VERSION" + - id: thrift-version + run: echo "::set-output name=version::$THRIFT_VERSION" + + run: + name: Run checks + needs: setup + uses: valitydev/erlang-workflows/.github/workflows/erlang-parallel-build.yml@v1.0.1 + with: + otp-version: ${{ needs.setup.outputs.otp-version }} + rebar-version: ${{ needs.setup.outputs.rebar-version }} + use-thrift: true + thrift-version: ${{ needs.setup.outputs.thrift-version }} diff --git a/.gitignore b/.gitignore index e786ace..8b14b84 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,13 @@ -# general -log +# Build artifacts /_build/ -*~ -erl_crash.dump -.tags* -*.sublime-* - -.DS_Store - -# rebar -/_checkouts/ - +*.o *.beam +*.plt -# generated -apps/swag_server/* -apps/swag_client/* +# Run artifacts +erl_crash.dump +log -# containerization -\#* -.\#* -Dockerfile -docker-compose.yml +# make stuff +/.image.* +Makefile.env diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 0000000..8d6db61 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,17 @@ +ARG OTP_VERSION + +FROM docker.io/library/erlang:${OTP_VERSION} + +# Install thrift compiler +ARG THRIFT_VERSION + +ARG TARGETARCH +RUN wget -q -O- "https://github.com/valitydev/thrift/releases/download/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}-linux-${TARGETARCH}.tar.gz" \ + | tar -xvz -C /usr/local/bin/ + +# Set env +ENV CHARSET=UTF-8 +ENV LANG=C.UTF-8 + +# Set runtime +CMD /bin/bash diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 85def9a..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,22 +0,0 @@ -#!groovy -// -*- mode: groovy -*- - -def finalHook = { - runStage('store CT logs') { - archive '_build/test/logs/' - } -} - -build('bouncer_client_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") - } - - pipeErlangLib.runPipe(false) -} diff --git a/Makefile b/Makefile index 17e09b2..7865479 100644 --- a/Makefile +++ b/Makefile @@ -1,35 +1,56 @@ -REBAR := $(shell which rebar3 2>/dev/null || which ./rebar3) -SUBMODULES = build_utils -SUBTARGETS = $(patsubst %,%/.git,$(SUBMODULES)) +# HINT +# Use this file to override variables here. +# For example, to run with podman put `DOCKER=podman` there. +-include Makefile.env -UTILS_PATH := build_utils -TEMPLATES_PATH := . +# NOTE +# Variables specified in `.env` file are used to pick and setup specific +# component versions, both when building a development image and when running +# CI workflows on GH Actions. This ensures that tasks run with `wc-` prefix +# (like `wc-dialyze`) are reproducible between local machine and CI runners. +DOTENV := $(shell grep -v '^\#' .env) -# Name of the service -SERVICE_NAME := bouncer_client_erlang - -BUILD_IMAGE_NAME := build-erlang -BUILD_IMAGE_TAG := aaa79c2d6b597f93f5f8b724eecfc31ec2e2a23b - -CALL_ANYWHERE := \ - submodules \ - all compile xref lint dialyze test cover \ - clean distclean \ - check_format format - -CALL_W_CONTAINER := $(CALL_ANYWHERE) - -.PHONY: $(CALL_W_CONTAINER) all +DOCKER ?= docker +REBAR ?= rebar3 +TEST_CONTAINER_NAME ?= testrunner all: compile --include $(UTILS_PATH)/make_lib/utils_container.mk +# Development images -$(SUBTARGETS): %/.git: % - git submodule update --init $< - touch $@ +DEV_IMAGE_TAG = $(TEST_CONTAINER_NAME)-dev +DEV_IMAGE_ID = $(file < .image.dev) -submodules: $(SUBTARGETS) +.PHONY: dev-image clean-dev-image wc-shell test + +dev-image: .image.dev + +.image.dev: Dockerfile.dev .env + $(DOCKER) build . -f Dockerfile.dev --tag $(DEV_IMAGE_TAG) $(DOTENV:%=--build-arg %) + $(DOCKER) image ls -q -f "reference=$(DEV_IMAGE_TAG)" | head -n1 > $@ + +clean-dev-image: +ifneq ($(DEV_IMAGE_ID),) + $(DOCKER) image rm -f $(DEV_IMAGE_TAG) + rm .image.dev +endif + +DOCKER_WC_OPTIONS := -v $(PWD):$(PWD) --workdir $(PWD) +DOCKER_WC_EXTRA_OPTIONS ?= --rm +DOCKER_RUN = $(DOCKER) run -t $(DOCKER_WC_OPTIONS) $(DOCKER_WC_EXTRA_OPTIONS) + +# Utility tasks + +wc-shell: dev-image + $(DOCKER_RUN) --interactive --tty $(DEV_IMAGE_TAG) + +wc-%: dev-image + $(DOCKER_RUN) $(DEV_IMAGE_TAG) make $* + +# Rebar tasks + +rebar-shell: + $(REBAR) shell compile: $(REBAR) compile @@ -40,26 +61,34 @@ xref: lint: $(REBAR) lint -check_format: +check-format: $(REBAR) fmt -c +dialyze: + $(REBAR) as test dialyzer + +release: + $(REBAR) as prod release + +eunit: + $(REBAR) eunit --cover + +common-test: + $(REBAR) ct --cover + +cover: + $(REBAR) covertool generate + format: $(REBAR) fmt -w -dialyze: - $(REBAR) dialyzer - clean: - $(REBAR) cover -r $(REBAR) clean -distclean: - $(REBAR) clean +distclean: clean-build-image rm -rf _build -cover: - $(REBAR) cover +test: eunit common-test -# CALL_W_CONTAINER -test: - $(REBAR) ct +cover-report: + $(REBAR) cover diff --git a/README.md b/README.md index b383e8a..4c58725 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,49 @@ # Bouncer client erlang -Клиент для сервиса Bouncer \ No newline at end of file +Erlang client for [bouncer][1] service + +## Building + +To build the project, run the following command: + +```bash +$ make compile +``` + +## Running + +To enter the [Erlang shell][2] with the project running, run the following command: + +```bash +$ make rebar-shell +``` + +## Development environment + +### Run in a docker container + +You can run any of the tasks defined in the Makefile from inside of a docker container (defined in `Dockerfile.dev`) by prefixing the task name with `wc-`. To successfully build the dev container you need `Docker BuildKit` enabled. This can be accomplished by either installing [docker-buildx](https://docs.docker.com/buildx/working-with-buildx/) locally, or exporting the `DOCKER_BUILDKIT=1` environment variable. + +#### Example + +* This command will run the `compile` task in a docker container: +```bash +$ make wc-compile +``` +#### Example + +* This command will run the `compile` task in a docker container: +```bash +$ make wc-compile +``` + +## Documentation + +@TODO More documentation. + +This library utilizes [woody][3] to provide a client for [bouncer][1] service using its [protocol][4]. Some generic helper functions are also provided in `bouncer_context_helpers` module. + +[1]: https://github.com/valitydev/bouncer +[2]: http://erlang.org/doc/man/shell.html +[3]: https://github.com/valitydev/woody_erlang +[4]: https://github.com/valitydev/bouncer-proto diff --git a/build_utils b/build_utils deleted file mode 160000 index a7655bc..0000000 --- a/build_utils +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a7655bc60c877a65cdfe3d9b668021d970d88a76 diff --git a/elvis.config b/elvis.config new file mode 100644 index 0000000..cfaddbe --- /dev/null +++ b/elvis.config @@ -0,0 +1,68 @@ +[ + {elvis, [ + {verbose, true}, + {config, [ + #{ + dirs => ["src", "include"], + filter => "*.erl", + ruleset => erl_files, + rules => [ + {elvis_text_style, line_length, #{limit => 120}}, + {elvis_style, nesting_level, #{level => 3}}, + {elvis_style, function_naming_convention, #{regex => "^([a-z][a-z0-9]*_?)*$"}}, + {elvis_style, no_if_expression, disable} + ] + }, + #{ + dirs => ["test"], + filter => "*.erl", + ruleset => erl_files, + rules => [ + {elvis_text_style, line_length, #{limit => 120}}, + {elvis_style, function_naming_convention, #{regex => "^([a-z][a-z0-9]*_?)*$"}}, + {elvis_style, no_if_expression, disable}, + % We want to use `ct:pal/2` and friends in test code. + {elvis_style, no_debug_call, disable}, + % Assert macros can trigger use of ignored binding, yet we want them for better + % readability. + {elvis_style, used_ignored_variable, disable}, + % Tests are usually more comprehensible when a bit more verbose. + {elvis_style, dont_repeat_yourself, #{min_complexity => 40}}, + {elvis_style, nesting_level, #{level => 4}}, + {elvis_style, god_modules, disable} + ] + }, + #{ + dirs => ["."], + filter => "Makefile", + ruleset => makefiles + }, + #{ + dirs => ["."], + filter => "elvis.config", + ruleset => elvis_config + }, + #{ + dirs => ["."], + filter => "rebar.config", + ruleset => rebar_config, + rules => [ + {elvis_text_style, line_length, #{limit => 120}}, + {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}}, + {elvis_text_style, no_tabs}, + {elvis_text_style, no_trailing_whitespace} + ] + } + ]} + ]} +]. diff --git a/rebar.config b/rebar.config index e60b884..7eba7c7 100644 --- a/rebar.config +++ b/rebar.config @@ -26,11 +26,11 @@ %% Common project dependencies. {deps, [ - {genlib, {git, "https://github.com/rbkmoney/genlib.git", {branch, "master"}}}, - {bouncer_proto, {git, "https://github.com/rbkmoney/bouncer-proto", {branch, "master"}}}, - {org_management_proto, {git, "git@github.com:rbkmoney/org-management-proto.git", {branch, "master"}}}, - {scoper, {git, "https://github.com/rbkmoney/scoper", {branch, master}}}, - {woody, {git, "https://github.com/rbkmoney/woody_erlang", {branch, master}}} + {genlib, {git, "https://github.com/valitydev/genlib.git", {branch, "master"}}}, + {bouncer_proto, {git, "https://github.com/valitydev/bouncer-proto", {branch, "master"}}}, + {org_management_proto, {git, "https://github.com/valitydev/org-management-proto", {branch, "master"}}}, + {scoper, {git, "https://github.com/valitydev/scoper", {branch, "master"}}}, + {woody, {git, "https://github.com/valitydev/woody_erlang", {branch, "master"}}} ]}. %% XRef checks @@ -58,42 +58,32 @@ {plt_apps, all_deps} ]}. -{plugins, [ - {erlfmt, "1.0.0"}, - {rebar3_lint, "0.5.0"} +{profiles, [ + {test, [ + {cover_enabled, true}, + {deps, []}, + {dialyzer, [ + {plt_extra_apps, [eunit, common_test]} + ]} + ]} ]}. +{project_plugins, [ + {rebar3_lint, "1.0.1"}, + {erlfmt, "1.0.0"}, + {covertool, "2.0.4"} +]}. + +{elvis_output_format, colors}. + {erlfmt, [ {print_width, 120}, - {files, "{src,include,test}/*.{hrl,erl}"} + {files, ["{src,include,test}/*.{hrl,erl}", "rebar.config", "elvis.config"]} ]}. -{elvis, [ - #{ - dirs => ["src"], - filter => "*.erl", - ruleset => erl_files, - rules => [ - {elvis_text_style, line_length, #{limit => 120}} - ] - }, - #{ - dirs => ["test"], - filter => "*.erl", - ruleset => erl_files, - rules => [ - {elvis_text_style, line_length, #{limit => 120}}, - % Tests are usually more comprehensible when a bit more verbose. - {elvis_style, dont_repeat_yourself, #{min_complexity => 20}} - ] - }, - #{ - dirs => ["."], - filter => "rebar.config", - rules => [ - {elvis_text_style, line_length, #{limit => 120}}, - {elvis_text_style, no_tabs}, - {elvis_text_style, no_trailing_whitespace} - ] - } +{covertool, [ + {coverdata_files, [ + "eunit.coverdata", + "ct.coverdata" + ]} ]}. diff --git a/rebar.lock b/rebar.lock index c6ab2b4..4951b61 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,53 +1,53 @@ {"1.2.0", [{<<"bouncer_proto">>, - {git,"https://github.com/rbkmoney/bouncer-proto", + {git,"https://github.com/valitydev/bouncer-proto", {ref,"8da12fe98bc751e7f8f17f64ad4f571a6a63b0fe"}}, 0}, {<<"cache">>,{pkg,<<"cache">>,<<"2.3.3">>},1}, - {<<"certifi">>,{pkg,<<"certifi">>,<<"2.6.1">>},2}, + {<<"certifi">>,{pkg,<<"certifi">>,<<"2.8.0">>},2}, {<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.9.0">>},1}, {<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},2}, {<<"genlib">>, - {git,"https://github.com/rbkmoney/genlib.git", + {git,"https://github.com/valitydev/genlib.git", {ref,"2bbc54d4abe0f779d57c8f5911dce64d295b1cd1"}}, 0}, {<<"gproc">>,{pkg,<<"gproc">>,<<"0.9.0">>},1}, - {<<"hackney">>,{pkg,<<"hackney">>,<<"1.17.4">>},1}, + {<<"hackney">>,{pkg,<<"hackney">>,<<"1.18.0">>},1}, {<<"idna">>,{pkg,<<"idna">>,<<"6.1.1">>},2}, {<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2}, {<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.2.0">>},2}, {<<"org_management_proto">>, - {git,"git@github.com:rbkmoney/org-management-proto.git", - {ref,"06c5c8430e445cb7874e54358e457cbb5697fc32"}}, + {git,"https://github.com/valitydev/org-management-proto", + {ref,"f433223706284000694e54e839fafb10db84e2b3"}}, 0}, {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.1">>},2}, {<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},2}, {<<"scoper">>, - {git,"https://github.com/rbkmoney/scoper", + {git,"https://github.com/valitydev/scoper", {ref,"7f3183df279bc8181efe58dafd9cae164f495e6f"}}, 0}, {<<"snowflake">>, - {git,"https://github.com/rbkmoney/snowflake.git", + {git,"https://github.com/valitydev/snowflake.git", {ref,"de159486ef40cec67074afe71882bdc7f7deab72"}}, 1}, {<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.6">>},2}, {<<"thrift">>, - {git,"https://github.com/rbkmoney/thrift_erlang.git", - {ref,"846a0819d9b6d09d0c31f160e33a78dbad2067b4"}}, + {git,"https://github.com/valitydev/thrift_erlang.git", + {ref,"c280ff266ae1c1906fb0dcee8320bb8d8a4a3c75"}}, 1}, {<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},2}, {<<"woody">>, - {git,"https://github.com/rbkmoney/woody_erlang", - {ref,"330bdcf71e99c2ea7aed424cd718939cb360ec1c"}}, + {git,"https://github.com/valitydev/woody_erlang", + {ref,"3ddacb9296691aa8ddad05498d1fd34b078eda75"}}, 0}]}. [ {pkg_hash,[ {<<"cache">>, <<"B23A5FE7095445A88412A6E614C933377E0137B44FFED77C9B3FEF1A731A20B2">>}, - {<<"certifi">>, <<"DBAB8E5E155A0763EEA978C913CA280A6B544BFA115633FA20249C3D396D9493">>}, + {<<"certifi">>, <<"D4FB0A6BB20B7C9C3643E22507E42F356AC090A1DCEA9AB99E27E0376D695EBA">>}, {<<"cowboy">>, <<"865DD8B6607E14CF03282E10E934023A1BD8BE6F6BACF921A7E2A96D800CD452">>}, {<<"cowlib">>, <<"0B9FF9C346629256C42EBE1EEB769A83C6CB771A6EE5960BD110AB0B9B872063">>}, {<<"gproc">>, <<"853CCB7805E9ADA25D227A157BA966F7B34508F386A3E7E21992B1B484230699">>}, - {<<"hackney">>, <<"99DA4674592504D3FB0CFEF0DB84C3BA02B4508BAE2DFF8C0108BAA0D6E0977C">>}, + {<<"hackney">>, <<"C4443D960BB9FBA6D01161D01CD81173089686717D9490E5D3606644C48D121F">>}, {<<"idna">>, <<"8A63070E9F7D0C62EB9D9FCB360A7DE382448200FBBD1B106CC96D3D8099DF8D">>}, {<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>}, {<<"mimerl">>, <<"67E2D3F571088D5CFD3E550C383094B47159F3EEE8FFA08E64106CDF5E981BE3">>}, @@ -57,11 +57,11 @@ {<<"unicode_util_compat">>, <<"BC84380C9AB48177092F43AC89E4DFA2C6D62B40B8BD132B1059ECC7232F9A78">>}]}, {pkg_hash_ext,[ {<<"cache">>, <<"44516CE6FA03594D3A2AF025DD3A87BFE711000EB730219E1DDEFC816E0AA2F4">>}, - {<<"certifi">>, <<"524C97B4991B3849DD5C17A631223896272C6B0AF446778BA4675A1DFF53BB7E">>}, + {<<"certifi">>, <<"6AC7EFC1C6F8600B08D625292D4BBF584E14847CE1B6B5C44D983D273E1097EA">>}, {<<"cowboy">>, <<"2C729F934B4E1AA149AFF882F57C6372C15399A20D54F65C8D67BEF583021BDE">>}, {<<"cowlib">>, <<"2B3E9DA0B21C4565751A6D4901C20D1B4CC25CBB7FD50D91D2AB6DD287BC86A9">>}, {<<"gproc">>, <<"587E8AF698CCD3504CF4BA8D90F893EDE2B0F58CABB8A916E2BF9321DE3CF10B">>}, - {<<"hackney">>, <<"DE16FF4996556C8548D512F4DBE22DD58A587BF3332E7FD362430A7EF3986B16">>}, + {<<"hackney">>, <<"9AFCDA620704D720DB8C6A3123E9848D09C87586DC1C10479C42627B905B5C5E">>}, {<<"idna">>, <<"92376EB7894412ED19AC475E4A86F7B413C1B9FBB5BD16DCCD57934157944CEA">>}, {<<"metrics">>, <<"69B09ADDDC4F74A40716AE54D140F93BEB0FB8978D8636EADED0C31B6F099F16">>}, {<<"mimerl">>, <<"F278585650AA581986264638EBF698F8BB19DF297F66AD91B18910DFC6E19323">>}, diff --git a/test/bouncer_client_SUITE.erl b/test/bouncer_client_SUITE.erl index 9eeaa40..6013ed4 100644 --- a/test/bouncer_client_SUITE.erl +++ b/test/bouncer_client_SUITE.erl @@ -31,7 +31,7 @@ %% tests descriptions --spec all() -> [test_case_name()]. +-spec all() -> [{atom(), test_case_name()} | test_case_name()]. all() -> [ {group, default} @@ -92,14 +92,14 @@ init_per_suite(Config) -> -spec end_per_suite(config()) -> _. end_per_suite(Config) -> - [application:stop(App) || App <- proplists:get_value(apps, Config)], + _ = [application:stop(App) || App <- proplists:get_value(apps, Config)], Config. -spec init_per_testcase(test_case_name(), config()) -> config(). init_per_testcase(_Name, C) -> [{test_sup, start_mocked_service_sup()} | C]. --spec end_per_testcase(test_case_name(), config()) -> config(). +-spec end_per_testcase(test_case_name(), config()) -> ok. end_per_testcase(_Name, C) -> stop_mocked_service_sup(?config(test_sup, C)), ok. @@ -108,7 +108,7 @@ end_per_testcase(_Name, C) -> -spec empty_judge(config()) -> _. empty_judge(C) -> - mock_services( + _ = mock_services( [ {bouncer, fun('Judge', _) -> {ok, #bdcs_Judgement{ @@ -135,7 +135,7 @@ follows_retries(_C) -> -spec follows_timeout(config()) -> _. follows_timeout(C) -> - mock_services( + _ = mock_services( [ {bouncer, fun('Judge', _) -> ok = timer:sleep(5000), @@ -162,7 +162,7 @@ validate_user_fragment(C) -> UserRealm = <<"once">>, OrgID = <<"told">>, PartyID = <<"me">>, - mock_services( + _ = mock_services( [ {bouncer, fun('Judge', {_RulesetID, Fragments}) -> Auth = get_fragment(<<"user">>, Fragments), @@ -207,7 +207,7 @@ validate_user_fragment(C) -> -spec validate_env_fragment(config()) -> _. validate_env_fragment(C) -> Time = genlib_rfc3339:format(genlib_time:unow(), second), - mock_services( + _ = mock_services( [ {bouncer, fun('Judge', {_RulesetID, Fragments}) -> case get_time(Fragments) of @@ -235,7 +235,7 @@ validate_env_fragment(C) -> validate_auth_fragment(C) -> Method = <<"someMethod">>, TokenID = <<"📟"/utf8>>, - mock_services( + _ = mock_services( [ {bouncer, fun('Judge', {_RulesetID, Fragments}) -> Auth = get_fragment(<<"auth">>, Fragments), @@ -275,7 +275,7 @@ validate_auth_fragment_scope(C) -> PartyID = <<"PARTY">>, CustomerID = <<"🎎"/utf8>>, InvoiceTemplateID = <<"🎷"/utf8>>, - mock_services( + _ = mock_services( [ {bouncer, fun('Judge', {_RulesetID, Fragments}) -> Auth = get_fragment(<<"auth">>, Fragments), @@ -324,7 +324,7 @@ validate_auth_fragment_scope(C) -> -spec validate_requester_fragment(config()) -> _. validate_requester_fragment(C) -> IP = "someIP", - mock_services( + _ = mock_services( [ {bouncer, fun('Judge', {_RulesetID, Fragments}) -> case get_ip(Fragments) of @@ -357,7 +357,7 @@ validate_requester_fragment(C) -> -spec validate_complex_fragment(config()) -> _. validate_complex_fragment(C) -> - mock_services( + _ = mock_services( [ {bouncer, fun('Judge', {_RulesetID, Fragments}) -> case Fragments of @@ -405,7 +405,7 @@ validate_complex_fragment(C) -> -spec validate_remote_user_fragment(config()) -> _. validate_remote_user_fragment(C) -> UserID = <<"someUser">>, - mock_services( + _ = mock_services( [ {org_management, fun('GetUserContext', _) -> Content = encode(#bctx_v1_ContextFragment{ diff --git a/test/bouncer_client_mock_service.erl b/test/bouncer_client_mock_service.erl index a540078..36bf0dd 100644 --- a/test/bouncer_client_mock_service.erl +++ b/test/bouncer_client_mock_service.erl @@ -4,6 +4,6 @@ -export([handle_function/4]). --spec handle_function(woody:func(), woody:args(), woody_context:ctx(), #{}) -> {ok, term()}. +-spec handle_function(woody:func(), woody:args(), woody_context:ctx(), woody:options()) -> {ok, term()}. handle_function(FunName, Args, _, #{function := Fun}) -> Fun(FunName, Args).