Skip to content

Commit

Permalink
Test on 27
Browse files Browse the repository at this point in the history
And make OTP 27 compatible
  • Loading branch information
kjnilsson committed Aug 14, 2024
1 parent e95ab7b commit 14496e9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/erlang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ on:
pull_request:
jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
otp:
- "26"
otp_version: [25, 26, 27]
steps:
- name: CHECKOUT
uses: actions/checkout@v2
- name: CONFIGURE ERLANG
uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
otp-version: ${{ matrix.otp_version }}
- name: XREF
run: make xref
- name: DEPS
run: make test-deps
- name: DIALYZE
if: ${{ matrix.otp_version == 27}}
run: make dialyze
- name: BUILD
run: make test-build
Expand All @@ -37,16 +37,14 @@ jobs:
uses: actions/upload-artifact@v2-preview
if: failure()
with:
name: ct-logs-${{matrix.otp}}
name: ct-logs-${{matrix.otp_version}}
path: logs/*
build-bazel:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
otp_major:
- "24"
- "25"
- "26"
steps:
- name: CHECKOUT
Expand Down
38 changes: 19 additions & 19 deletions src/ra_server_proc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
%% gen_statem callbacks
-export([
init/1,
format_status/2,
format_status/1,
handle_event/4,
terminate/3,
code_change/4,
Expand Down Expand Up @@ -1075,26 +1075,26 @@ terminate(Reason, StateName, State) ->
code_change(_OldVsn, StateName, State, _Extra) ->
{ok, StateName, State}.

format_status(Opt, [_PDict, StateName,
#state{server_state = NS,
leader_last_seen = LastSeen,
pending_commands = Pending,
low_priority_commands = Delayed,
pending_notifys = PendingNots,
election_timeout_set = ElectionSet
}]) ->
format_status(#{state := StateName,
data := #state{server_state = NS,
leader_last_seen = LastSeen,
pending_commands = Pending,
low_priority_commands = Delayed,
pending_notifys = PendingNots,
election_timeout_set = ElectionSet
}} = FormatStatus) ->
NumPendingNots = maps:fold(fun (_, Corrs, Acc) -> Acc + length(Corrs) end,
0, PendingNots),
[{id, ra_server:id(NS)},
{opt, Opt},
{raft_state, StateName},
{leader_last_seen, LastSeen},
{num_pending_commands, length(Pending)},
{num_low_priority_commands, ra_ets_queue:len(Delayed)},
{num_pending_applied_notifications, NumPendingNots},
{election_timeout_set, ElectionSet},
{ra_server_state, ra_server:overview(NS)}
].

FormatStatus#{data => [{id, ra_server:id(NS)},
{raft_state, StateName},
{leader_last_seen, LastSeen},
{num_pending_commands, length(Pending)},
{num_low_priority_commands, ra_ets_queue:len(Delayed)},
{num_pending_applied_notifications, NumPendingNots},
{election_timeout_set, ElectionSet},
{ra_server_state, ra_server:overview(NS)}
]}.

%%%===================================================================
%%% Internal functions
Expand Down
5 changes: 3 additions & 2 deletions test/ra_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1355,8 +1355,9 @@ unknown_local_call(Config) ->
end.

get_gen_statem_status(Ref) ->
{_, _, _, Items} = sys:get_status(Ref),
proplists:get_value(raft_state, lists:last(Items)).
{_, _, _, Misc} = sys:get_status(Ref),
[{_, State}] = [S || {data, [{"State", S}]} <- lists:last(Misc)],
proplists:get_value(raft_state, State).

wait_for_gen_statem_status(Ref, ExpectedStatus, Timeout)
when Timeout >= 0 ->
Expand Down

0 comments on commit 14496e9

Please sign in to comment.