-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Increase test coverage for stream worker #44161
Conversation
72e2e74
to
7cb9829
Compare
Based on discussion in home-assistant/architecture#482 it seems like these tests will still be useful. However, I think it might be a mistake to test these in terms of the Stream class directly rather than in terms of the "public" interfaces of the component. This will also help if we need to do any refactoring when introducing new abstractions. |
12a21f3
to
67c9e20
Compare
Thinking about it more, I think this approach may still have some value as (1) testing via the Stream class is close enough to the top level interface, and matches other tests and (2) I considered trying to exercise these corner cases using a similar strategy as |
Swapping reviewers based on conversation in #45431 @uvjustin i'd like your take on if this is helpful. I worry about these subtle corner cases not being fully tested, and i'm pretty bad at manually testing things. My only worry about this is it gets deep into the |
@allenporter I think this is very good - the tests capture/codify most of the problem workarounds we put in the worker (did you dig through the old issues to get these or were you able to deduce them from the code?) Even if we need to change these workarounds at least this harness will make clear that we are only changing what we intend to change. |
Ok thank you for taking a look. I got these from the test coverage gaps / code, looking at the PRs and reading the previous issues, yes. |
Maybe add one more test where we leave the dts in order but scramble up the pts to ensure that we are only enforcing proper ordering on the dts side? |
@uvjustin don't forget to hit that approve button if you think it's ok 👍 |
afccee1
to
cda12c3
Compare
Looking good, I have a few more ideas to simplify further building one why you've done. |
Ok, I'll wait for those. |
OK, this is ready for another look. |
Just made a minor change to use some more realistic values for time_base. Does that look ok to you? |
Yeah, that looks good to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
I had to add back PACKETS_PER_SEGMENT to fix the modulo checks as 1ddb138 ended up changing those inadvertently. I renamed PACKETS_TO_SEGMENTS just for consistency. |
OK, looks good. Want to also approve? |
Co-authored-by: Justin Wong <46082645+uvjustin@users.noreply.github.com>
Co-authored-by: Justin Wong <46082645+uvjustin@users.noreply.github.com>
Proposed change
Increase test coverage of
stream
worker from ~80% to 92% in preparation for adding support for expiring nest urls.Exercise the stream worker functionality by mocking av.open calls to return a
fake media container as well a fake decoded stream in the form of a series of
packets. Each test creates a packet sequence, with a mocked output buffer to capture the segments
pushed to the output streams. The packet sequence can be used to exercise
failure modes or corner cases like how out of order packets are handled.
This is in preparation for changing the stream behavior to support expiring urls, and
there is not a lot of existing test coverage. This test adds additional coverage for corner cases that is not possible to achieve from
test_hls.py
because this can create invalid streams that pyav cannot encode.Type of change
Example entry for
configuration.yaml
:# Example configuration.yaml
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: