Increase the unit test coverage for caliper-core
Opened this issue · 3 comments
davidkel commented
current report shows
--------------------------------------------------------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
--------------------------------------------------------------|----------|----------|----------|----------|----------------|
All files | 48.7 | 39.91 | 41.18 | 48.74 | |
caliper-core | 100 | 100 | 100 | 100 | |
index.js | 100 | 100 | 100 | 100 | |
caliper-core/lib/common/config | 80.7 | 65.52 | 100 | 80.7 | |
Config.js | 76.09 | 58.33 | 100 | 76.09 |... 267,268,290 |
config-util.js | 100 | 100 | 100 | 100 | |
caliper-core/lib/common/core | 82.81 | 90 | 71.88 | 81.77 | |
connector-base.js | 86.54 | 83.33 | 55.56 | 86.54 |... 3,64,66,166 |
connector-interface.js | 18.18 | 100 | 0 | 18.18 |... 8,86,96,105 |
transaction-statistics-collector.js | 96.15 | 93.75 | 98.21 | 95.7 |360,387,410,415 |
transaction-status.js | 48 | 100 | 40.91 | 48 |... 194,203,211 |
caliper-core/lib/common/messages | 55.63 | 9.62 | 22.45 | 55.63 | |
assignIdMessage.js | 60 | 0 | 0 | 60 | 33,41 |
assignedMessage.js | 75 | 0 | 0 | 75 | 32 |
connectedMessage.js | 75 | 0 | 0 | 75 | 32 |
exitMessage.js | 80 | 0 | 0 | 80 | 32 |
initializeMessage.js | 80 | 0 | 0 | 80 | 32 |
message.js | 42.11 | 12.5 | 11.11 | 42.11 |... 140,141,144 |
parse.js | 40.54 | 0 | 0 | 40.54 |... 72,74,76,78 |
prepareMessage.js | 21.43 | 0 | 0 | 21.43 |... ,98,106,114 |
preparedMessage.js | 75 | 0 | 0 | 75 | 32 |
readyMessage.js | 75 | 0 | 0 | 75 | 32 |
registerMessage.js | 80 | 0 | 0 | 80 | 32 |
testMessage.js | 68.42 | 100 | 60 | 68.42 |... 106,122,138 |
testResultMessage.js | 75 | 0 | 0 | 75 | 33 |
txResetMessage.js | 75 | 0 | 0 | 75 | 33 |
txUpdateMessage.js | 60 | 0 | 0 | 60 | 33,35 |
workerMetricsMessage.js | 100 | 100 | 100 | 100 | |
caliper-core/lib/common/messengers | 33.33 | 100 | 12.5 | 33.33 | |
messenger-interface.js | 33.33 | 100 | 12.5 | 33.33 |... 81,90,91,92 |
caliper-core/lib/common/messengers/mqtt | 0 | 0 | 0 | 0 | |
factory.js | 0 | 100 | 0 | 0 |... 28,37,40,41 |
mqtt-messenger.js | 0 | 0 | 0 | 0 |... 154,157,162 |
caliper-core/lib/common/messengers/process | 37.5 | 0 | 25 | 37.5 | |
factory.js | 100 | 100 | 100 | 100 | |
process-messenger.js | 25 | 0 | 14.29 | 25 |... 88,89,90,91 |
caliper-core/lib/common/prometheus | 55.36 | 68.63 | 35 | 54.55 | |
prometheus-query-client.js | 16.33 | 0 | 0 | 16.33 |... 156,159,169 |
prometheus-query-helper.js | 85.71 | 79.55 | 100 | 85.25 |... 163,169,170 |
caliper-core/lib/common/utils | 63.83 | 43.81 | 48.15 | 63.83 | |
benchmark-validator.js | 15 | 0 | 0 | 15 |... 63,72,81,90 |
constants.js | 100 | 100 | 100 | 100 | |
log-formats.js | 96.3 | 88.89 | 100 | 96.3 | 56 |
logging-util.js | 67.18 | 48.72 | 83.33 | 67.18 |... 395,396,397 |
version.js | 22.22 | 100 | 0 | 22.22 |... 55,64,73,81 |
caliper-core/lib/manager | 7.06 | 0 | 0 | 7.06 | |
caliper-engine.js | 7.06 | 0 | 0 | 7.06 |... 181,188,189 |
caliper-core/lib/manager/charts | 98.59 | 86.96 | 100 | 98.59 | |
chart-builder.js | 98.59 | 86.96 | 100 | 98.59 | 210 |
caliper-core/lib/manager/monitors | 53.79 | 35.25 | 39.29 | 53.96 | |
monitor-docker.js | 68.07 | 33.85 | 61.11 | 68.1 |... 411,412,415 |
monitor-interface.js | 50 | 100 | 20 | 50 | 38,45,52,60 |
monitor-process.js | 6.72 | 0 | 0 | 6.78 |... 305,315,326 |
monitor-prometheus.js | 91.78 | 65 | 100 | 91.78 |... 176,177,181 |
monitor-utilities.js | 62.5 | 42.86 | 40 | 63.64 |... ,65,114,134 |
caliper-core/lib/manager/orchestrators | 16.79 | 1.28 | 9.52 | 16.88 | |
monitor-orchestrator.js | 20.37 | 0 | 0 | 20.37 |... 142,143,155 |
round-orchestrator.js | 6.31 | 0 | 0 | 6.36 |... 251,252,254 |
worker-orchestrator.js | 20.94 | 2.86 | 14.29 | 21.03 |... 549,551,557 |
caliper-core/lib/manager/report | 31.41 | 18.42 | 22.73 | 31.41 | |
report-builder.js | 12.12 | 0 | 8.33 | 12.12 |... 372,373,376 |
report.js | 52.17 | 63.64 | 40 | 52.17 |... 226,227,237 |
caliper-core/lib/manager/test-observers | 4.55 | 0 | 0 | 4.65 | |
default-observer.js | 0 | 0 | 0 | 0 |... 252,269,272 |
null-observer.js | 0 | 100 | 0 | 0 |... 71,79,88,91 |
observer-interface.js | 0 | 100 | 0 | 0 |... 71,79,87,92 |
test-observer.js | 31.58 | 0 | 0 | 31.58 |... 69,77,85,93 |
caliper-core/lib/worker | 47.4 | 25.49 | 31.25 | 47.89 | |
caliper-worker.js | 82 | 46.43 | 66.67 | 83.67 |... 165,203,204 |
worker-message-handler.js | 9.78 | 0 | 0 | 9.78 |... 256,258,265 |
caliper-core/lib/worker/rate-control | 46.96 | 45.93 | 46.88 | 47.77 | |
compositeRate.js | 0 | 0 | 0 | 0 |... 251,264,267 |
fixedFeedbackRate.js | 63.16 | 58.33 | 75 | 63.16 |... 101,102,103 |
fixedLoad.js | 90 | 83.33 | 75 | 90 | 72,73,86 |
fixedRate.js | 100 | 83.33 | 75 | 100 | 41 |
linearRate.js | 100 | 100 | 83.33 | 100 | |
maxRate.js | 98.11 | 86.36 | 85.71 | 98.11 | 182 |
noRate.js | 100 | 100 | 75 | 100 | |
rateControl.js | 92.86 | 50 | 100 | 92.86 | 54 |
rateInterface.js | 81.82 | 100 | 33.33 | 81.82 | 44,52 |
recordRate.js | 44.62 | 31.25 | 37.5 | 45.31 |... 158,161,163 |
replayRate.js | 0 | 0 | 0 | 0 |... 143,163,166 |
caliper-core/lib/worker/tx-observers | 68.82 | 71.43 | 54.35 | 69.23 | |
internal-tx-observer.js | 26.09 | 0 | 0 | 27.27 |... 70,71,75,76 |
logging-tx-observer.js | 0 | 0 | 0 | 0 |... 62,65,78,81 |
prometheus-manager-tx-observer.js | 100 | 94.59 | 100 | 100 | 156,167 |
prometheus-push-tx-observer.js | 81.67 | 70.59 | 77.78 | 83.05 |... ,74,113,114 |
prometheus-tx-observer.js | 77.78 | 75 | 85.71 | 77.78 |... 107,109,110 |
tx-observer-dispatch.js | 19.23 | 0 | 0 | 19.23 |... 102,105,106 |
tx-observer-interface.js | 82.61 | 50 | 42.86 | 82.61 | 56,84,92,100 |
caliper-core/lib/worker/workload | 17.39 | 100 | 0 | 17.39 | |
workloadModuleBase.js | 15.79 | 100 | 0 | 15.79 |... 84,85,86,95 |
workloadModuleInterface.js | 25 | 100 | 0 | 25 | 32,40,48 |
caliper-core/lib/worker/workload/declarative | 33.33 | 0 | 18.18 | 33.33 | |
contract-function-parameter.js | 100 | 100 | 100 | 100 | |
contract-function.js | 22.22 | 100 | 0 | 22.22 |... 38,39,40,42 |
contract.js | 37.5 | 100 | 0 | 37.5 | 28,29,30,32,39 |
declarative-workload-module-base.js | 27.27 | 0 | 0 | 27.27 |... 65,74,82,91 |
caliper-core/lib/worker/workload/declarative/value-providers | 99.21 | 100 | 100 | 99.21 | |
formatted-string-value-provider.js | 100 | 100 | 100 | 100 | |
list-element-value-provider.js | 100 | 100 | 100 | 100 | |
parameter-reference-value-provider.js | 100 | 100 | 100 | 100 | |
uniform-random-list-item-value-provider.js | 100 | 100 | 100 | 100 | |
uniform-random-value-provider.js | 100 | 100 | 100 | 100 | |
value-provider-factory.js | 100 | 100 | 100 | 100 | |
value-provider-interface.js | 85.71 | 100 | 100 | 85.71 | 45 |
variable-reference-value-provider.js | 100 | 100 | 100 | 100 | |
--------------------------------------------------------------|----------|----------|----------|----------|----------------|
Which highlights areas to focus on. 100% may not be achievable but we should strive to get to between 90-100 % for each file
davidkel commented
New tests should not assume that the code is actually correct. It's expected that if the tests finds bugs or relevant situations where unexpected behaviour occurs then the code should also be fixed.
Sweetdevil144 commented
@davidkel I've been working on adding test suites for packages/caliper-core/lib/worker/rate-control/compositeRate.js
. However, I've been facing some technical difficulties related to testing. I'll open a PR for it soon and link the errors too in details.