Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix intermittently failing unit test #1014

Closed
dsparacio opened this issue Jan 14, 2016 · 4 comments
Closed

Fix intermittently failing unit test #1014

dsparacio opened this issue Jan 14, 2016 · 4 comments
Milestone

Comments

@dsparacio
Copy link
Contributor

There are two test that stay pending and one that intermittently fails.

FragmentModel
- should not be postponed after creation
✓ should not have any loading, executed, canceled or failed requests
when a request has been added
✓ should fire streamCompleted event for a complete request
when a request has been passed for executing
✓[90m should fire loadingStarted event a request
- should remove the request from pending requests
✓ should add the request to loading requests
✓ should be able to abort loading requests
31 passing (1s)
2 pending
1 failing

  1. TimelineConverter when the live edge is found should calculate availability window for dynamic mpd:
    AssertionError: expected 0.0009999999999976694 to equal 0
    • expected - actual
      -0.0009999999999976694
      +0
@dsparacio dsparacio added this to the 2.0.0 milestone Jan 14, 2016
@boushley
Copy link
Member

That looks like a float issue, this could be a pain.

@dsparacio
Copy link
Contributor Author

Yeah i think so. Never happened before in 1.x code so need to investigate this one.

@yturtle98
Copy link

The unit test fails when the current time value of "new Date()" in
representation.adaptation.period.mpd.availabilityStartTime = new Date(new Date().getTime() - representation.adaptation.period.mpd.timeShiftBufferDepth * 1000);
of test/dash.TimeLineConverterSpec.js (line 95) is not same as
"new Date()" in
now = calcPresentationTimeFromWallTime(new Date(), representation.adaptation.period);
of src/dash/TimeLineConverter.js (line 156)

To make the value of the start time of the segmentAvailabilityRange be 0 as in dash.TimeLineConverterSpec.js, some time buffer needs to be added to set the availiabilityStartTime, like following:
// 1000ms time buffer is added
representation.adaptation.period.mpd.availabilityStartTime = new Date(new Date().getTime() + 1000 - representation.adaptation.period.mpd.timeShiftBufferDepth * 1000);

@davemevans
Copy link
Contributor

I think using sinon.useFakeTimers in the test setup is the right way to solve this as it stubs Date. This is already used in FragmentModelSpec tests.

The two pending tests are never run (the test specs have been changed to it.skip) since they are no longer meaningful in 2.0. They should be removed.

davemevans added a commit to davemevans/dash.js that referenced this issue Jan 27, 2016
dsparacio pushed a commit that referenced this issue Jan 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants