Skip to content

Conversation

@peaBerberian
Copy link
Collaborator

@peaBerberian peaBerberian commented Feb 22, 2024

This is an implementation of an idea we had in the past to speed up asynchronous tests.

Those often depend on some timeout, with a timeout set very high (hundreds of milliseconds, sometimes seconds) to ensure a test pass even on the slowest machine running our tests.

This results in our integration tests taking a lot of time to finish (more than 30 minutes), even more considering that those are not parallelized, unlike our unit tests (and doing so is not straightforward because we rely on a dependency, mocha, as a test runner and on another, karma, as a browser launcher).

To make it less long, we wondered if we could not rely on another strategy:

  1. Perform the check almost immediately, on fast computers it has a chance of very quickly passing
  2. If the check fails, wait some amount of time and re-perform the check.
  3. If the check fails multiple times, it surely means that the current device is slow, so we'll wait a longer and longer delay before re-performing the check.
  4. If the check still fails after some set time (or 4 seconds by default), fail the test.

This is basically another implementation of an "exponential backoff" algorithm in the player (we already use this type of algorithm at several places in the player, like for media requests for example).

This commit does not yet transition everything to that new way, because I didn't have the time yet.

TODO:

  • tests/integration/scenarios/dash_live.js
  • tests/integration/scenarios/dash_live_utc_timings.js
  • tests/integration/scenarios/dash_multi_periods.js
  • tests/integration/scenarios/dash_multi-track.js
  • tests/integration/scenarios/dash_static.js
  • tests/integration/scenarios/dash_stream-events.js
  • tests/integration/scenarios/directfile.js
  • tests/integration/scenarios/discontinuities.js
  • tests/integration/scenarios/fast-switching.js
  • tests/integration/scenarios/initial_playback.js
  • tests/integration/scenarios/manifest_error.js
  • tests/integration/scenarios/end_number.js
  • tests/integration/scenarios/dash_live_SegmentTemplate.js
  • tests/integration/scenarios/loadVideo_options.js
  • tests/integration/scenarios/video_thumbnail_loader.js
  • tests/integration/utils/launch_tests_for_content.js

@peaBerberian peaBerberian added tests Relative to the RxPlayer's tests Priority: 3 (Low) This issue or PR has a low priority. labels Feb 22, 2024
@peaBerberian peaBerberian force-pushed the misc/test-integration-backoff branch 12 times, most recently from 8be330f to 34ff493 Compare February 23, 2024 15:47
@peaBerberian peaBerberian force-pushed the misc/test-integration-backoff branch 5 times, most recently from 6e7e291 to 335631a Compare February 23, 2024 17:36
This is an implementation of an idea we had in the past to speed up
asynchronous tests.

Those often depend on some timeout, with a timeout set very high
(hundreds of milliseconds, sometimes seconds) to ensure a test pass even
on the slowest machine running up our tests.

This results in our integration tests taking a lot of time to finish
(more than 30 minutes), even more considering that those are not
parallelized, unlike our unit tests (and doing so is not straightforward
because we rely on a dependency, mocha, as a test runner and on another,
karma, as a browser launcher).

To make it less long, we wondered if we could not rely on another
strategy:
  1. Perform the check almost immediately, on fast computers it has a
     chance of very quickly passing
  2. If the check fails, wait some amount of time and re-perform the
     check.
  3. If the check fails multiple times, it surely means that the current
     device is slow, so we'll wait a longer and longer delay before
     re-performing the check.
  4. If the check still fails after some set time (or 4 seconds by
     default), fail the test.

This is basically another implementation of an "exponential backoff"
algorithm in the player (we already use this type of algorithm at
several places in the player, like for media requests for example).
@peaBerberian peaBerberian force-pushed the misc/test-integration-backoff branch from 335631a to 3a0ae47 Compare February 23, 2024 17:46
@peaBerberian peaBerberian merged commit 60f1651 into dev Feb 23, 2024
@peaBerberian peaBerberian added this to the 4.1.0 milestone Feb 23, 2024
@peaBerberian peaBerberian mentioned this pull request Jun 13, 2024
@peaBerberian peaBerberian deleted the misc/test-integration-backoff branch July 26, 2024 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: 3 (Low) This issue or PR has a low priority. tests Relative to the RxPlayer's tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants