-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Acceptance tests and YouTube #3446
Comments
@Lyla-Fischer @singingwolfboy @cpennington @sarina @cahrens @jzoldak @polesye @auraz @olmar Please provide your feedback! |
I think we should mock out the Youtube API -- it's the only way to have stable tests, and to make sure that all of our tests run on every build. We'll have to keep our mock API in sync with the real API, but hopefully that won't be too difficult. |
@singingwolfboy Please remember - we will have to also mock the other 2 parts - serving video server, and metadata server. |
@valera-rozuvan Do you have an estimate for how much work that will entail? |
@singingwolfboy Unfortunately, YouTube is closed source. Their player, and their protocol - is closed source. We will have to reverse engineer A LOT of stuff. Unless Google will want to help out... |
Unless we can abstract the stuff that's youtube out from the stuff that's our video player. And just test our own code. still leaves us with having the abstraction layer being untested. |
Basically, we don't get much value from the parts of tests that actually hit youtube. The places the tests add value are when they are verifying code that we've written. So, @singingwolfboy's suggestion of mocking the parts of the youtube api that we use makes sense to me. In particular, if we know the places that we're using the youtube api, then we can simply mock out those pieces of the api, and return the values that we expect. |
We wouldn't have to reverse engineer the youtube player, we'd just need to know about the places where we already hook into it. |
@cpennington For JavaScript unit tests - we have completely mocked out YouTube API. Please see https://github.com/edx/edx-platform/blob/master/common/lib/xmodule/xmodule/js/spec/helper.js#L4 . What we need to fix is the acceptance tests. |
@cpennington Currently - there is no open-source JavaScript player that can play a YouTube video without using the official YouTube JavaScript Player API. |
Ah, my apologies. I didn't read closely enough. |
@valera-rozuvan - Sorry, I'm having trouble understanding which pieces are called when. Maybe a concrete example will help me. We had a bok-choy video test failure on the test execution that gets triggered by merges to master. Looks like after 200 seconds the test still could not find the element with class is-initialized. |
More data points from test execution results on jenkins. It seems that when it happens the slowness is not a general degradation but instead it will affect one test but not another in the same suite. See (if those results still exist on Jenkins) this example. Here the timeout was 200 sec, and the failing test in the YouTubeVideoTest testcase class took 3 min 27 sec, but the duration of the other 12 tests was anywhere from 8.2 to 16 seconds. Obviously nowhere near the 200 sec timeout. New idea: when a video test is going to fail due to timing out on the initialization of the YouTube player, mark it as Skip instead. |
@jzoldak It seems a good start. We should be able to see number of skipped tests, and ability to run them by hand. What about to re-run it for 5 times if it fails? Also, from your review it looks like we have different types of youtube failures What you think if suggest before every test we will check for youtube availability? If it unavailable then we can safely skip test. By that we will distinguish failures in youtube and in our code. |
@muhammad-ammar had another good suggestion which was to look into the flaky nose plug-in. That would allow for re-running (rather than skipping) video tests that fail intermittently. (Condition A above). For Condition B - I like that idea also. We can add to the setup method for the video tests that need the youtube services (not stubbed): check that the services are running and if they are not, then skip them. |
I like that for A! |
I'd love to see a decorator to mark the tests that depend on youtube, that either checks once and caches the result, or checks before every test. |
(Or it could be even more sophisticated, and check before each test, but if it fails n times in a row, skip all the rest of the tests, or something like that). |
Decorator seems fine for me. |
We have now merged in a number of PRs to implement the above-discussed features.
As it is now, I have seen a failure in master where the youtube availability check before each bok-choy test came back good, but still flaky kicked in and the test failed twice (once marked skipped and then marked FAILED).
|
Thanks for the Update. |
Blades team will have a meeting tomorrow about this and we will discuss it. |
We think this is ok for now. Let's see what happens along the way. |
@auraz unfo this continues to be a problem and a drain on the testeng team (answering questions about failed builds) and other teams (rerunning builds trying to get a "clean" build). |
Thanks for the information. We really need to investigate such a problem on slow networks. For now, I've created a ticket (BLD-1192) and put it into Blades backlog. If you want to speed up these things, please contact with @explorerleslie |
@auraz @polesye I believe I might have captured enough info on https://openedx.atlassian.net/browse/BLD-1194 to have someone work on a potential fix. We should prioritize this, as the video test failures are especially bad right now. |
Introduction
As everyone is aware, currently we have a very bad situation with flaky Video player acceptance tests. One of the main reasons why the tests are flaky - they rely on an external resource - YouTube. From a developer's point of view, YouTube consists of three parts:
What can be done?
Several things have been discussed:
Discussion
I think this issue is affecting all of the developers at edX. Because of the flaky tests it sometimes takes a couple of Jenkins runs to get a passing build. This wastes time. Please contribute to this discussion! I believe that this technical issue can be solved. It is just a matter of choosing the most efficient strategy.
The text was updated successfully, but these errors were encountered: