Add Github Actions (#1)

This commit is contained in:
Alexey S 2022-04-06 12:05:26 +03:00 committed by GitHub
parent 8fc5595c4c
commit 602d4dc87b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 344 additions and 205 deletions

8
.editorconfig Normal file
View File

@ -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

6
.env Normal file
View File

@ -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

15
.github/workflows/basic-linters.yml vendored Normal file
View File

@ -0,0 +1,15 @@
name: Vality basic linters
on:
pull_request:
branches:
- master
- main
push:
branches:
- master
- main
jobs:
lint:
uses: valitydev/base-workflows/.github/workflows/basic-linters.yml@v1

39
.github/workflows/erlang-checks.yml vendored Normal file
View File

@ -0,0 +1,39 @@
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 }}
run-ct-with-compose: true

24
.gitignore vendored
View File

@ -1,16 +1,14 @@
# general
log
/.rebar3/
# Build artifacts
/_build/
/ebin/
*~
*.o
*.beam
*.plt
# Run artifacts
erl_crash.dump
.tags*
*.sublime-workspace
.DS_Store
rebar3.crashdump
log
# builtils
docker-compose.yml
src/dmt_client_*_thrift.erl
include/dmt_client_*_thrift.hrl
# make stuff
/.image.*
Makefile.env

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "build_utils"]
path = build_utils
url = git@github.com:rbkmoney/build_utils.git

17
Dockerfile.dev Normal file
View File

@ -0,0 +1,17 @@
ARG OTP_VERSION
FROM docker.io/library/erlang:${OTP_VERSION}
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# 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"]

38
Jenkinsfile vendored
View File

@ -1,38 +0,0 @@
#!groovy
// -*- mode: groovy -*-
//
// Copyright 2020 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('party_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(true,false)
}

125
Makefile
View File

@ -1,59 +1,114 @@
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 := party_client
# Development images
DEV_IMAGE_TAG = $(TEST_CONTAINER_NAME)-dev
DEV_IMAGE_ID = $(file < .image.dev)
# Build image tag to be used
BUILD_IMAGE_NAME := build-erlang
BUILD_IMAGE_TAG := 1aa346b3638e143b4c1fafd74b3f25041024ce35
CALL_ANYWHERE := all submodules compile xref lint dialyze clean distclean check_format format
CALL_W_CONTAINER := $(CALL_ANYWHERE) test get_test_deps
DOCKER ?= docker
DOCKERCOMPOSE ?= docker-compose
DOCKERCOMPOSE_W_ENV = DEV_IMAGE_TAG=$(DEV_IMAGE_TAG) $(DOCKERCOMPOSE)
REBAR ?= rebar3
TEST_CONTAINER_NAME ?= testrunner
all: compile
-include $(UTILS_PATH)/make_lib/utils_container.mk
.PHONY: dev-image clean-dev-image wc-shell test
.PHONY: $(CALL_W_CONTAINER)
dev-image: .image.dev
$(SUBTARGETS): %/.git: %
git submodule update --init $<
touch $@
.image.dev: Dockerfile.dev .env
env $(DOTENV) $(DOCKERCOMPOSE_W_ENV) build $(TEST_CONTAINER_NAME)
$(DOCKER) image ls -q -f "reference=$(DEV_IMAGE_ID)" | head -n1 > $@
submodules: $(SUBTARGETS)
clean-dev-image:
ifneq ($(DEV_IMAGE_ID),)
$(DOCKER) image rm -f $(DEV_IMAGE_TAG)
rm .image.dev
endif
compile: submodules
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)
DOCKERCOMPOSE_RUN = $(DOCKERCOMPOSE_W_ENV) run --rm $(DOCKER_WC_OPTIONS)
# Utility tasks
wc-shell: dev-image
$(DOCKER_RUN) --interactive --tty $(DEV_IMAGE_TAG)
wc-%: dev-image
$(DOCKER_RUN) $(DEV_IMAGE_TAG) make $*
# TODO docker compose down doesn't work yet
wdeps-shell: dev-image
$(DOCKERCOMPOSE_RUN) $(TEST_CONTAINER_NAME) su; \
$(DOCKERCOMPOSE_W_ENV) down
# Pass CT_CASE through to container env
wdeps-common-test.%: MAKE_ARGS=$(if $(CT_CASE),CT_CASE=$(CT_CASE))
wdeps-%: dev-image
$(DOCKERCOMPOSE_RUN) -T $(TEST_CONTAINER_NAME) make $(if $(MAKE_ARGS),$(MAKE_ARGS) $*,$*); \
res=$$?; \
$(DOCKERCOMPOSE_W_ENV) down; \
exit $$res
# Rebar tasks
rebar-shell:
$(REBAR) shell
compile:
$(REBAR) compile
xref: submodules
xref:
$(REBAR) xref
lint:
elvis rock -V
$(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
common-test.%: apps/hellgate/test/hg_%_tests_SUITE.erl
$(REBAR) ct --cover --suite=$^ $(if $(CT_CASE),--case=$(strip $(CT_CASE)))
cover:
$(REBAR) covertool generate
format:
$(REBAR) fmt -w
dialyze: submodules
$(REBAR) dialyzer
test: submodules
$(REBAR) ct
get_test_deps: submodules
$(REBAR) as test get-deps
clean:
$(REBAR) clean
distclean:
$(REBAR) clean -a
rm -rfv _build _builds _cache _steps _temp
distclean: clean-build-image
rm -rf _build
test: eunit common-test
cover-report:
$(REBAR) cover

@ -1 +0,0 @@
Subproject commit be44d69fc87b22a0bb82d98d6eae7658d1647f98

88
docker-compose.sh → compose.yaml Executable file → Normal file
View File

@ -1,44 +1,72 @@
#!/bin/bash
cat <<EOF
version: '2.1'
services:
${SERVICE_NAME}:
image: ${BUILD_IMAGE}
testrunner:
image: $DEV_IMAGE_TAG
build:
dockerfile: Dockerfile.dev
context: .
args:
OTP_VERSION: $OTP_VERSION
THRIFT_VERSION: $THRIFT_VERSION
volumes:
- .:$PWD
- $HOME/.cache:/home/$UNAME/.cache
working_dir: $PWD
command: /sbin/init
depends_on:
party-management:
condition: service_healthy
working_dir: $PWD
command: /sbin/init
dominant:
image: dr2.rbkmoney.com/rbkmoney/dominant:1dbb330957077d3fbd93bd93d78d138634b0a2a7
command: /opt/dominant/bin/dominant foreground
party-management:
image: ghcr.io/valitydev/party-management:sha-e456e24
command: /opt/party-management/bin/party-management foreground
depends_on:
machinegun:
condition: service_healthy
dominant:
condition: service_healthy
shumway:
condition: service_healthy
ports:
- "8022"
healthcheck:
test: "curl http://localhost:8022/"
test: "/opt/party-management/bin/party-management ping"
interval: 10s
timeout: 5s
retries: 10
dominant:
image: ghcr.io/valitydev/dominant:sha-eb1cccb
depends_on:
- machinegun
ports:
- "8022"
command: /opt/dominant/bin/dominant foreground
healthcheck:
test: "/opt/dominant/bin/dominant ping"
interval: 5s
timeout: 1s
retries: 12
retries: 20
machinegun:
image: dr2.rbkmoney.com/rbkmoney/machinegun:00aa3098226e103a1a3626b3edf63864b94c4036
image: ghcr.io/valitydev/machinegun:sha-7f0a21a
ports:
- "8022"
command: /opt/machinegun/bin/machinegun foreground
volumes:
- ./test/machinegun/config.yaml:/opt/machinegun/etc/config.yaml
- ./test/machinegun/cookie:/opt/machinegun/etc/cookie
healthcheck:
test: "curl http://localhost:8022/"
test: "/opt/machinegun/bin/machinegun ping"
interval: 5s
timeout: 1s
retries: 12
retries: 20
shumway:
image: dr2.rbkmoney.com/rbkmoney/shumway:058b2459317d1bff0922574e8e8240432c2444cd
restart: always
image: docker.io/rbkmoney/shumway:44eb989065b27be619acd16b12ebdb2288b46c36
restart: unless-stopped
depends_on:
- shumway-db
ports:
- "8022"
entrypoint:
- java
- -Xmx512m
@ -47,32 +75,18 @@ services:
- --spring.datasource.url=jdbc:postgresql://shumway-db:5432/shumway
- --spring.datasource.username=postgres
- --spring.datasource.password=postgres
depends_on:
- shumway-db
- --management.metrics.export.statsd.enabled=false
healthcheck:
test: "curl http://localhost:8022/"
test: curl http://localhost:8022/
interval: 5s
timeout: 1s
retries: 20
shumway-db:
image: dr2.rbkmoney.com/rbkmoney/postgres:9.6
image: docker.io/library/postgres:9.6
ports:
- "5432"
environment:
- POSTGRES_DB=shumway
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- SERVICE_NAME=shumway-db
party-management:
image: dr2.rbkmoney.com/rbkmoney/party-management:ac0feed5de13797941c3a576c04b0a5b7302c549
command: /opt/party-management/bin/party-management foreground
depends_on:
- machinegun
- dominant
- shumway
healthcheck:
test: "curl http://localhost:8022/"
interval: 5s
timeout: 1s
retries: 20
EOF

View File

@ -4,18 +4,21 @@
party_management => "http://party-management:8022/v1/processing/partymgmt"
}},
{woody, #{
cache_mode => safe, % disabled | safe | aggressive
% disabled | safe | aggressive
cache_mode => safe,
aggressive_caching_timeout => 30000,
options => #{
woody_client => #{
event_handler => {scoper_woody_event_handler, #{
event_handler_opts => #{
formatter_opts => #{
max_length => 1000
event_handler =>
{scoper_woody_event_handler, #{
event_handler_opts => #{
formatter_opts => #{
max_length => 1000
}
}
}
}}
}}
}
}
}}
]},
]}
].

View File

@ -2,26 +2,34 @@
{elvis, [
{config, [
#{
dirs => ["src", "test"],
dirs => ["src", "include"],
filter => "*.erl",
ruleset => erl_files,
rules => [
{elvis_text_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_text_style, no_tabs},
{elvis_text_style, no_trailing_whitespace},
{elvis_style, macro_module_names},
{elvis_style, operator_spaces, #{rules => [{right, ","}, {right, "++"}, {left, "++"}]}},
{elvis_text_style, line_length, #{limit => 120}},
{elvis_text_style, no_trailing_whitespace, #{ignore_empty_lines => true}},
{elvis_style, nesting_level, #{level => 3}},
{elvis_style, god_modules, #{limit => 35, ignore => [party_client_thrift]}},
{elvis_style, no_if_expression},
{elvis_style, invalid_dynamic_call, #{ignore => [elvis]}},
{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, state_record_and_type, #{ignore => []}},
{elvis_style, no_spec_with_records},
{elvis_style, dont_repeat_yourself, #{min_complexity => 15, ignore => [party_client_base_hg_tests_SUITE]}},
{elvis_style, no_debug_call, #{ignore => [elvis, elvis_utils]}}
{elvis_style, function_naming_convention, #{regex => "^([a-z][a-z0-9]*_?)*$"}},
{elvis_style, no_if_expression, disable},
{elvis_style, atom_naming_convention, disable},
%% Meh
{elvis_style, god_modules, #{ignore => [party_client_thrift]}},
%% ??
{elvis_style, dont_repeat_yourself, #{min_complexity => 15}}
]
},
#{
dirs => ["test"],
filter => "*.erl",
ruleset => erl_files,
rules => [
{elvis_text_style, line_length, #{limit => 120}},
{elvis_text_style, no_trailing_whitespace, #{ignore_empty_lines => true}},
{elvis_style, nesting_level, #{level => 3}},
{elvis_style, function_naming_convention, #{regex => "^([a-z][a-z0-9]*_?)*$"}},
{elvis_style, no_if_expression, disable},
{elvis_style, atom_naming_convention, disable},
{elvis_style, dont_repeat_yourself, #{min_complexity => 30}}
]
},
#{
@ -37,10 +45,14 @@
#{
dirs => ["."],
filter => "rebar.config",
ruleset => rebar_config,
rules => [
{elvis_text_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_text_style, no_tabs},
{elvis_text_style, no_trailing_whitespace}
{elvis_text_style, no_trailing_whitespace},
% Only use this rule for first-party dependencies
% Replace it when it's possible to filter by regex
{elvis_project, no_deps_master_rebar, disable}
]
},
#{

View File

@ -1,6 +1,5 @@
%% Common project erlang options.
{erl_opts, [
% mandatory
debug_info,
warnings_as_errors,
@ -27,10 +26,10 @@
%% Common project dependencies.
{deps, [
{genlib, {git, "https://github.com/rbkmoney/genlib.git", {branch, "master"}}},
{damsel, {git, "https://github.com/rbkmoney/damsel.git", {branch, "release/erlang/master"}}},
{woody, {git, "https://github.com/rbkmoney/woody_erlang.git", {branch, "master"}}},
{woody_user_identity, {git, "https://github.com/rbkmoney/woody_erlang_user_identity.git", {branch, "master"}}}
{genlib, {git, "https://github.com/valitydev/genlib.git", {branch, "master"}}},
{damsel, {git, "https://github.com/valitydev/damsel.git", {branch, "master"}}},
{woody, {git, "https://github.com/valitydev/woody_erlang.git", {branch, "master"}}},
{woody_user_identity, {git, "https://github.com/valitydev/woody_erlang_user_identity.git", {branch, "master"}}}
]}.
%% XRef checks
@ -65,17 +64,32 @@
{profiles, [
{test, [
{cover_enabled, true},
{deps, [
{dmt_client, {git, "https://github.com/rbkmoney/dmt_client.git", {branch, "master"}}}
{dmt_client, {git, "https://github.com/valitydev/dmt_client.git", {branch, "master"}}}
]},
{dialyzer, [
{plt_extra_apps, [eunit, common_test, runtime_tools, damsel, dmt_client]}
]}
]}
]}.
{plugins, [
{erlfmt, "1.0.0"}
{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,test}/*.{hrl,erl,app.src}", "rebar.config", "elvis.config", "config/sys.config"]}
]}.
{covertool, [
{coverdata_files, [
"eunit.coverdata",
"ct.coverdata"
]}
]}.

View File

@ -1,49 +1,49 @@
{"1.2.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},
{<<"damsel">>,
{git,"https://github.com/rbkmoney/damsel.git",
{ref,"a7c69ff2f576aae91ea68420f54a37cd6258af8e"}},
{git,"https://github.com/valitydev/damsel.git",
{ref,"3efe7dffaae0f40a77dead166a52f8c9108f2d8d"}},
0},
{<<"genlib">>,
{git,"https://github.com/rbkmoney/genlib.git",
{ref,"3e1776536802739d8819351b15d54ec70568aba7"}},
{git,"https://github.com/valitydev/genlib.git",
{ref,"82c5ff3866e3019eb347c7f1d8f1f847bed28c10"}},
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},
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.1">>},2},
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},2},
{<<"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.git",
{ref,"330bdcf71e99c2ea7aed424cd718939cb360ec1c"}},
{git,"https://github.com/valitydev/woody_erlang.git",
{ref,"3ddacb9296691aa8ddad05498d1fd34b078eda75"}},
0},
{<<"woody_user_identity">>,
{git,"https://github.com/rbkmoney/woody_erlang_user_identity.git",
{git,"https://github.com/valitydev/woody_erlang_user_identity.git",
{ref,"a480762fea8d7c08f105fb39ca809482b6cb042e"}},
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">>},
@ -53,11 +53,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">>},

View File

@ -1,12 +0,0 @@
[
{party_client, [
% {services, #{
% party_management => "http://party-management:8022/v1/processing/partymgmt"
% }},
% {woody, #{
% cache_mode => safe, % disabled | safe | aggressive
% aggressive_caching_timeout => 30000,
% options => #{}, % see woody_caching_client:options/0
% }}
]}
].

View File

@ -1,4 +1,6 @@
service_name: machinegun
erlang:
secret_cookie_file: "/opt/machinegun/etc/cookie"
namespaces:
party:
event_sinks:
@ -12,3 +14,6 @@ namespaces:
url: http://dominant:8022/v1/stateproc
storage:
type: memory
woody_server:
max_concurrent_connections: 8000
http_keep_alive_timeout: 15S

1
test/machinegun/cookie Normal file
View File

@ -0,0 +1 @@
test

View File

@ -105,7 +105,7 @@ init_per_suite(Config) ->
true = erlang:unlink(ClientPid),
[{apps, Apps}, {client, Client}, {client_pid, ClientPid}, {test_id, genlib:to_binary(Revision)} | Config].
-spec end_per_suite(config()) -> config().
-spec end_per_suite(config()) -> ok.
end_per_suite(C) ->
true = erlang:exit(conf(client_pid, C), shutdown),
genlib_app:stop_unload_applications(proplists:get_value(apps, C)).
@ -114,7 +114,7 @@ end_per_suite(C) ->
init_per_group(Group, Config) ->
[{test_id, genlib:to_binary(Group)} | Config].
-spec end_per_group(atom(), config()) -> config().
-spec end_per_group(atom(), config()) -> ok.
end_per_group(_Group, _Config) ->
ok.
@ -122,7 +122,7 @@ end_per_group(_Group, _Config) ->
init_per_testcase(Name, Config) ->
[{test_id, genlib:to_binary(Name)} | Config].
-spec end_per_testcase(atom(), config()) -> config().
-spec end_per_testcase(atom(), config()) -> ok.
end_per_testcase(_Name, _Config) ->
ok.
@ -552,7 +552,7 @@ test_init_info(C) ->
Context = create_context(),
{ok, PartyId, Client, Context}.
-spec make_battle_ready_contractor() -> dmsl_payment_processing_thrift:'Contractor'().
-spec make_battle_ready_contractor() -> dmsl_domain_thrift:'Contractor'().
make_battle_ready_contractor() ->
BankAccount = #domain_RussianBankAccount{
account = <<"4276300010908312893">>,

View File

@ -24,12 +24,16 @@ all() ->
-spec init_per_suite(config()) -> config().
init_per_suite(Config) ->
AppConfig = [
{party_client, [{woody, #{options => #{a => b, woody_client => #{c => d}}}}]}
{party_client, [
{woody, #{
options => #{cache => #{local_name => blah}, woody_client => #{protocol_handler_override => my_handler}}
}}
]}
],
Apps = lists:flatten([genlib_app:start_application_with(A, C) || {A, C} <- AppConfig]),
[{apps, Apps} | Config].
-spec end_per_suite(config()) -> config().
-spec end_per_suite(config()) -> ok.
end_per_suite(C) ->
genlib_app:stop_unload_applications(proplists:get_value(apps, C)).
@ -37,16 +41,19 @@ end_per_suite(C) ->
-spec config_merge_test(config()) -> any().
config_merge_test(_C) ->
Client = party_client:create_client(#{woody_options => #{a => c, woody_client => #{e => f}}}),
Client = party_client:create_client(#{
woody_options => #{
cache => #{local_name => party_client_default_cache}, woody_client => #{deadline => undefined}
}
}),
WoodyOptions = party_client_config:get_woody_options(Client),
#{
a := c,
cache := #{
local_name := party_client_default_cache
},
woody_client := #{
e := f,
c := d,
protocol_handler_override := my_handler,
deadline := undefined,
event_handler := woody_event_handler_default,
transport_opts := #{},
url := _Urls

View File

@ -486,8 +486,6 @@ construct_category(Ref, Name, Type) ->
-spec construct_payment_method(dmsl_domain_thrift:'PaymentMethodRef'()) ->
{payment_method, dmsl_domain_thrift:'PaymentMethodObject'()}.
construct_payment_method(?pmt(_Type, ?tkz_bank_card(Name, _)) = Ref) when is_atom(Name) ->
construct_payment_method(Name, Ref);
construct_payment_method(?pmt(_Type, Name) = Ref) when is_atom(Name) ->
construct_payment_method(Name, Ref).
@ -588,12 +586,12 @@ construct_system_account_set(Ref, Name, ?cur(CurrencyCode)) ->
}}.
-spec construct_external_account_set(external_account_set()) ->
{system_account_set, dmsl_domain_thrift:'ExternalAccountSetObject'()}.
{external_account_set, dmsl_domain_thrift:'ExternalAccountSetObject'()}.
construct_external_account_set(Ref) ->
construct_external_account_set(Ref, <<"Primaries">>, ?cur(<<"RUB">>)).
-spec construct_external_account_set(external_account_set(), name(), currency()) ->
{system_account_set, dmsl_domain_thrift:'ExternalAccountSetObject'()}.
{external_account_set, dmsl_domain_thrift:'ExternalAccountSetObject'()}.
construct_external_account_set(Ref, Name, ?cur(CurrencyCode)) ->
AccountID1 = 1,
AccountID2 = 2,
@ -630,7 +628,8 @@ construct_business_schedule(Ref) ->
}
}}.
-spec construct_routing_ruleset(routing_ruleset_ref(), name(), _) -> dmsl_domain_thrift:'RoutingRulesetObject'().
-spec construct_routing_ruleset(routing_ruleset_ref(), name(), _) ->
{routing_rules, dmsl_domain_thrift:'RoutingRulesObject'()}.
construct_routing_ruleset(Ref, Name, Decisions) ->
{routing_rules, #domain_RoutingRulesObject{
ref = Ref,