diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d98df5f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,67 @@ +# install: +# - sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 + +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + test: + name: OTP-${{matrix.otp}}, OS-${{matrix.os}} + runs-on: ${{matrix.os}} + strategy: + fail-fast: false + matrix: + os: + - "ubuntu-20.04" + rebar3: ["3.18.0"] + otp: + - "25.1" + - "24.3" + - "23.3" + - "22.3" + include: + - otp: "21.3" + rebar3: "3.15.2" + os: "ubuntu-20.04" + env: + SHELL: /bin/sh # needed for erlexec + steps: + - uses: actions/checkout@v2 + + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{matrix.otp}} + rebar3-version: ${{matrix.rebar3}} + + - name: compile + run: rebar3 compile + + - name: xref + run: rebar3 xref + + - name: eunit + run: rebar3 eunit + + - name: ct + run: rebar3 ct + + - name: dialyzer + run: rebar3 dialyzer + + - name: proper + run: rebar3 proper + + - name: Upload test logs artifact + uses: actions/upload-artifact@v2 + if: failure() + with: + name: test_logs_otp-${{matrix.otp}} + path: | + _build/test/logs/* + !_build/test/logs/ct_run*/datadir diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7ce6915..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -sudo: required -language: erlang -otp_release: - - 23.3.1 - - 22.3 - - 21.3 - #- 20.3 not supported (erlang:get_stacktrace/0) - #- 19.3 not supported (string:lexemes/2) - #- 18.3 not supported (string:lexemes/2, tricky binary comprehension, map typespec with `:=`, ?assertEqual/3) -install: - - sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 -script: - - ./rebar3 compile - - ./rebar3 xref - - ./rebar3 eunit - - ./rebar3 ct - - ./rebar3 dialyzer - - ./rebar3 proper diff --git a/rebar3 b/rebar3 index 69fb786..a83d554 100755 Binary files a/rebar3 and b/rebar3 differ diff --git a/test/mtp_test_metric.erl b/test/mtp_test_metric.erl index 9c6cb8e..c9a7c9d 100644 --- a/test/mtp_test_metric.erl +++ b/test/mtp_test_metric.erl @@ -33,6 +33,7 @@ notify(Type, Name, Value, Extra) -> get(Type, Name) -> get(Type, Name, #{}). +-spec get(count | gauge | histogram, [atom()], [atom()]) -> integer() | not_found. get(Type, Name, Extra) -> gen_server:call(?MODULE, {get, Type, Name, Extra}). diff --git a/test/single_dc_SUITE.erl b/test/single_dc_SUITE.erl index a164e6d..e07cfde 100644 --- a/test/single_dc_SUITE.erl +++ b/test/single_dc_SUITE.erl @@ -436,9 +436,13 @@ policy_max_conns_case(Cfg) when is_list(Cfg) -> Secret = ?config(mtp_secret, Cfg), SureClose = fun(Cli) -> + timer:sleep(500), %FIXME: sometimes metric returns not_found PreClosed = - mtp_test_metric:get_tags( - count, [?APP, in_connection_closed, total], [?FUNCTION_NAME]), + case mtp_test_metric:get_tags( + count, [?APP, in_connection_closed, total], [?FUNCTION_NAME]) of + not_found -> 0; + N -> N + end, ok = mtp_test_client:close(Cli), ok = mtp_test_metric:wait_for_value( count, [?APP, in_connection_closed, total], [?FUNCTION_NAME], PreClosed + 1, 5000)