Skip to content

Commit

Permalink
Mas ghafix (#1785)
Browse files Browse the repository at this point in the history
* Update erlang.yml

...

* max integer()/undefined -> undefined

As a safety check the definition of CSP checks it as at least 1 to avoid badarith when divided.  However, when called from eqc tests, this property will be undefined (should be OK when started via Riak), and max(undefined, 1) is undefined.  So this needs a default to work safely from tests

* Recommended fixes

Following review from Thomas

* Revert to develop-3.0 restriction

Not sure what the best setting is, but for now reverted to make consistent with other GHA settings in the riak environment
  • Loading branch information
martinsumner authored Mar 22, 2021
1 parent 3c56493 commit aeef159
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/erlang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
pull_request:
branches: [ develop-3.0 ]


jobs:

build:
Expand All @@ -16,8 +17,10 @@ jobs:
image: erlang:22.3.3

steps:
- uses: actions/checkout@v2
- name: Compile
run: rebar3 compile
- name: Run tests
run: rebar3 do xref, dialyzer, eunit
- uses: actions/checkout@v2
- name: Compile
run: ./rebar3 compile
- name: Run xref and dialyzer
run: ./rebar3 do xref, dialyzer
- name: Run eunit
run: ./rebar3 as gha do eunit
3 changes: 2 additions & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
{profiles, [
{test, [{deps, [meck,
{eunit_formatters, ".*", {git, "git://github.com/seancribbs/eunit_formatters", {tag, "v0.5.0"}}}]}]},
{eqc, [{deps, [meck]}]}
{eqc, [{deps, [meck]}]},
{gha, [{erl_opts, [{d, 'GITHUBEXCLUDE'}]}]}
]}.

{deps, [
Expand Down
2 changes: 1 addition & 1 deletion src/riak_kv_leveled_backend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ start(Partition, Config) ->
CMM = app_helper:get_prop_or_env(compression_method, Config, leveled),
CMP = app_helper:get_prop_or_env(compression_point, Config, leveled),
CRD = app_helper:get_prop_or_env(compaction_runs_perday, Config, leveled),
CSP = max(app_helper:get_prop_or_env(compaction_scores_perday, Config, leveled), 1),
CSP = max(app_helper:get_prop_or_env(compaction_scores_perday, Config, leveled, 1), 1),
CLH = app_helper:get_prop_or_env(compaction_low_hour, Config, leveled),
CTH = app_helper:get_prop_or_env(compaction_top_hour, Config, leveled),
MRL = app_helper:get_prop_or_env(max_run_length, Config, leveled),
Expand Down
22 changes: 14 additions & 8 deletions src/riak_kv_vnode_status_mgr.erl
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,8 @@ assign_vnodeid_restart_earlier_ts_test() ->
{Vid2, _Status3} = assign_vnodeid(Now2, NodeId, Status2),
?assertEqual(<<1, 2, 3, 4, 70,116,143,251>>, Vid2).

-ifndef(GITHUBEXCLUDE).

%% Test
vnode_status_test_() ->
{setup,
Expand All @@ -504,11 +506,13 @@ vnode_status_test_() ->
?cmd("chmod -w " ++ TestPath),
Index = 0,
File = vnode_status_filename(Index, TestPath),
try
write_vnode_status(orddict:new(), File, ?VNODE_STATUS_VERSION)
catch _Err:{badmatch, Reason} ->
?assertEqual({error, eacces}, Reason)
end
R =
try
write_vnode_status(orddict:new(), File, ?VNODE_STATUS_VERSION)
catch _Err:{badmatch, Reason} ->
Reason
end,
?assertEqual({error, eacces}, R)
end),
?_test(begin % create successfully
TestPath = riak_kv_test_util:get_test_dir("kv_vnode_status_test"),
Expand All @@ -526,15 +530,17 @@ vnode_status_test_() ->
end),
?_test(begin % update failure
TestPath = riak_kv_test_util:get_test_dir("kv_vnode_status_test"),
?cmd("chmod -w " ++ TestPath ++ "/0"),
?cmd("chmod -wrx " ++ TestPath),
?cmd("chmod -r " ++ TestPath ++ "/0"),
Index = 0,
File = vnode_status_filename(Index, TestPath),
?assertEqual({ok, []}, read_vnode_status(File))
end)
end
)

]}.

-endif.

-ifdef(EQC).


Expand Down

0 comments on commit aeef159

Please sign in to comment.