Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prior to this commit if dotnet or mvnw failed to fetch test dependencies, for example because dotnet isn't installed, the test setup crashed in an unexpected way: ``` amqp_system_SUITE > dotnet {'EXIT', {badarg, [{lists,keysearch, [rmq_nodes,1, {skip, "Failed to fetch .NET Core test project dependencies"}], [{error_info,#{module => erl_stdlib_errors}}]}, {test_server,lookup_config,2, [{file,"test_server.erl"},{line,1779}]}, {rabbit_ct_broker_helpers,get_node_configs,2, [{file,"rabbit_ct_broker_helpers.erl"},{line,1411}]}, {rabbit_ct_broker_helpers,enable_feature_flag,2, [{file,"rabbit_ct_broker_helpers.erl"},{line,1999}]}, {amqp_system_SUITE,init_per_group,2, [{file,"amqp_system_SUITE.erl"},{line,77}]}, {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1794}]}, {test_server,run_test_case_eval1,6, [{file,"test_server.erl"},{line,1391}]}, {test_server,run_test_case_eval,9, [{file,"test_server.erl"},{line,1235}]}]}} ``` This commit improves the error message instead of failing with `badarg`. This commit also decides to fail the test setup instead of skipping the suite because we always want CI to execute this test and be notified instead of silently skipping if the test can't be run.
- Loading branch information
ab8814a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of
{skip, _}
was correct. The error came from the fact that the return value ofrabbit_ct_helpers:run_setup_steps()
was not verified on line 72:The code should be something like:
The testsuite will break in the same way if another step than
build_dotnet_test_project/1
orbuild_maven_test_project/1
fails.There are dozens of misuses like this one everywhere in the testsuites, that’s not the only one.
Do you want me to fix this case?
ab8814a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By returning
{skip, _}
, CI will show the job as green/successful, correct?I do want the CI job to fail if for example
dotnet
couldn't be installed properly:ab8814a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably. Locally, skipped tests do not cause
ct_run
to exit with non-zero. I wonder if it has an option to consider skipped tests as errors.ab8814a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems returning
{fail, Reason}
is what we want. It works nicely.Unfortunately, this return value is undocumented in https://www.erlang.org/doc/apps/common_test/ct_suite.html#c:init_per_group/2
ab8814a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes also sense to return
{fail, Reason}
instead of{skipped, Reason}
in most places inrabbit_ct_broker_helpers
.ab8814a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I asked for clarification in erlang/otp#8952