edgehog-device-manager / edgehog-device-runtime

Edgehog Device Runtime is a portable middleware written in Rust, that enables remote device management on Linux-based systems.
Apache License 2.0
11 stars 10 forks source link

tests: reduce the test time from >30s to <1s #252

Closed joshuachp closed 1 year ago

joshuachp commented 1 year ago

Remove the delays and sleep in the tests, optimize the channels into a stream. Fix flaky tests when run locally, use temp dir for ota.bin. Use tokio process and uitls to not block the main thread.

Advance time manually during tests.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 67.21% and project coverage change: +0.05% :tada:

Comparison is base (c8520ab) 75.20% compared to head (a61a72d) 75.26%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #252 +/- ## ========================================== + Coverage 75.20% 75.26% +0.05% ========================================== Files 26 26 Lines 1327 1334 +7 ========================================== + Hits 998 1004 +6 - Misses 329 330 +1 ``` | [Files Changed](https://app.codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/252?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager) | Coverage Δ | | |---|---|---| | [src/commands.rs](https://app.codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/252?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL2NvbW1hbmRzLnJz) | `0.00% <0.00%> (ø)` | | | [src/config.rs](https://app.codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/252?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL2NvbmZpZy5ycw==) | `0.00% <0.00%> (ø)` | | | [src/data/astarte\_message\_hub\_node.rs](https://app.codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/252?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL2RhdGEvYXN0YXJ0ZV9tZXNzYWdlX2h1Yl9ub2RlLnJz) | `63.73% <ø> (ø)` | | | [src/led\_behavior.rs](https://app.codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/252?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL2xlZF9iZWhhdmlvci5ycw==) | `100.00% <ø> (ø)` | | | [src/power\_management.rs](https://app.codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/252?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL3Bvd2VyX21hbmFnZW1lbnQucnM=) | `0.00% <0.00%> (ø)` | | | [src/telemetry/battery\_status.rs](https://app.codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/252?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL3RlbGVtZXRyeS9iYXR0ZXJ5X3N0YXR1cy5ycw==) | `62.85% <42.85%> (+6.44%)` | :arrow_up: | | [src/telemetry/mod.rs](https://app.codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/252?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL3RlbGVtZXRyeS9tb2QucnM=) | `82.96% <66.66%> (-1.13%)` | :arrow_down: | | [src/data/astarte\_device\_sdk\_lib.rs](https://app.codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/252?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL2RhdGEvYXN0YXJ0ZV9kZXZpY2Vfc2RrX2xpYi5ycw==) | `63.63% <80.00%> (-2.41%)` | :arrow_down: | | [src/repository/file\_state\_repository.rs](https://app.codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/252?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL3JlcG9zaXRvcnkvZmlsZV9zdGF0ZV9yZXBvc2l0b3J5LnJz) | `88.00% <81.25%> (-12.00%)` | :arrow_down: | | [src/ota/ota\_handle.rs](https://app.codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/252?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL290YS9vdGFfaGFuZGxlLnJz) | `83.78% <83.33%> (-0.05%)` | :arrow_down: | | ... and [3 more](https://app.codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/252?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager) | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.