Conversation
Contributor
|
Are you sure about the erlang.mk changes? Because there's tests confirming the file does what it should, at least in vanilla Erlang.mk. In any case they should be sent upstream at https://github.com/ninenines/erlang.mk |
Previously it was not possible to see code coverage for the majority of
test cases: integration tests that create RabbitMQ nodes.
It was only possible to see code coverage for unit tests.
This commit allows to see code coverage for tests that create RabbitMQ
nodes.
The only thing you need to do is setting the `COVER` variable, for example
```
make -C deps/rabbitmq_mqtt ct COVER=1
```
will show you coverage across all tests in the MQTT plugin.
Whenever a RabbitMQ node is started `ct_cover:add_nodes/1` is called.
Contrary to the documentation which states
> To have effect, this function is to be called from init_per_suite/1 (see common_test) before any tests are performed.
I found that it also works in init_per_group/1 or even within the test cases themselves.
Whenever a RabbitMQ node is stopped or killed `ct_cover:remove_nodes/1`
is called to transfer results from the RabbitMQ node to the CT node.
Since the erlang.mk file writes a file called `test/ct.cover.spec`
including the line:
```
{export,".../rabbitmq-server/deps/rabbitmq_mqtt/cover/ct.coverdata"}.
```
results across all test suites will be accumulated in that file.
The accumulated result can be seen through the link `Coverage log` on the test suite result pages.
by running ``` make erlang-mk ``` to include ninenines/erlang.mk@6423c1c which provides test coverage for individual suites.
Member
Author
|
Thank you @lhoguin for fixing the erlang.mk part upstream via ninenines/erlang.mk@6423c1c |
lhoguin
approved these changes
Nov 10, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously it was not possible to see code coverage for the majority of test cases: integration tests that create RabbitMQ nodes. It was only possible to see code coverage for unit tests. This commit allows to see code coverage for tests that create RabbitMQ nodes.
The only thing you need to do is setting the
COVERvariable, for examplewill show you coverage across all tests in the MQTT plugin.
This commit fixes the erlang.mk file that did not append the
-cover <sepc_path>flag to thect_runcommand.Whenever a RabbitMQ node is started
ct_cover:add_nodes/1is called. Contrary to the documentation which statesI found that it also works in
init_per_group/1or even within the test cases themselves.Whenever a RabbitMQ node is stopped or killed
ct_cover:remove_nodes/1is called to transfer results from the RabbitMQ node to the CT node.Since the erlang.mk file writes a file called
test/ct.cover.specincluding the line:results across all test suites will be accumulated in that file.
The accumulated result can be seen through the link
Coverage logon the test suite result pages.