Problem/Motivation
Vimeo went down because of a major Google outage on 2 June 2019. See https://twitter.com/chad_fullerton/status/1135273938601295873
Proposed resolution
Don't connect to external services - we need to stub them.
Fix:
Drupal\Tests\media\FunctionalJavascript\MediaStandardProfileTestDrupal\Tests\media_library\FunctionalJavascript\MediaLibraryTest
See https://www.drupal.org/pift-ci-job/1309043 for example.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #25 | 3059022.17-24.diff.txt | 997 bytes | dww |
| #24 | 3059022-24.patch | 5.7 KB | bnjmnm |
| #17 | 3059022-17.patch | 5.73 KB | alexpott |
| #17 | 8-17-interdiff.txt | 893 bytes | alexpott |
| #8 | 3059022-8.patch | 5.33 KB | alexpott |
Comments
Comment #2
alexpottComment #3
seanbDidn't really dive into this too deep, but at a first glance we seem to be missing a call to
$this->hijackProviderEndpoints();defined inDrupal\Tests\media\Traits\OEmbedTestTraitfor those tests.Comment #4
alexpottThis removes the dependency on youtube and vimeo in our tests.
Comment #5
wim leersNice find 😁
I started to review this, but these are some pretty special tests, so I think it'd be better for those who helped create them in the first place to sign off on this.
Comment #6
phenaproximaI applied the patch locally and ran MediaStandardProfileTest with my wi-fi turned off. Unfortunately, I still got the same failure as https://www.drupal.org/pift-ci-job/1309043, so I'm not sure the patch is actually fixing the problem...?
Comment #7
alexpott@phenaproxima I've run the MediaStandardProfileTest with no internet connection and it passes for me. However the other test
Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestfails at a different point...Comment #8
alexpottWith the attached patch both tests pass for me with no connection.
Comment #9
phenaproximaRunning MediaStandardProfileTest with the patch in #4 applied against 8.8.x HEAD, and wi-fi turned off (I have no other connection to the Internet) gives me this:
EDIT: I get the same failure with the patch in #8.
Comment #10
phenaproximaI wonder if this is not an opportunity to kill two birds with one stone: this issue, and #2964636: Improve oEmbed tests.
The problem, really, is that the OEmbed tests are bizarrely written and extraordinarily fragile (I bear a lot of responsibility for this). They should be rearchitected, IMHO, so that all test data is contained in the media_test_oembed module, and simply by enabling that module, everything "just works" for oEmbed tests. The goals should be, in my opinion:
media_test_oembedto their $modules array.This would make me much happier as a Media maintainer. Thoughts?
Comment #11
phenaproximaComment #12
seanbI wrote both of the failing tests and apparently it is very easy to do it wrong. It would be great if we can make this a hell of a lot easier. Not sure how big of an effort that would be? I guess having a fix first would at least make sure we don't risk breaking the test bot again when YouTube or vimeo fail. Which should be our main priority now.
Comment #13
phenaproximaThe monumental shittiness of the oEmbed tests is mostly my fault. Sorry about that. :(
I'd like to refactor them in #2964636: Improve oEmbed tests as I described in #10, and I'm probably in the best position to do that work. In the meantime, though, if both you and @alexpott are getting passing tests on your local systems with this patch applied and the Internet disconnected, I figure that should be enough to stop the bleeding and would be okay RTBCing the current patch as a temporary fix until we can improve things in the other issue.
Comment #14
seanbRan the tests multiple times to be sure (with/without the patch in #8). Failed every time without the patch. Green with the patch applied. I think this is good to go.
Comment #15
alexpottThis looks like a bit like an API change. But we're still conforming to the interface because of the @return. And if this returns FALSE the only code that calls it does this:
so we throw a ResourceException just with a slightly different message which imo is okay.
Comment #16
krzysztof domański+1 RTBC I have one suggestion:
Comment #17
alexpott@Krzysztof Domański yeah that's not quite right either though. I think we can just be vaguer - this is only test code so not super important and @phenaproxima wants to refactor it all anyway.
Comment #18
phenaproximaNot to derail this issue, but I should mention that I have #2964636: Improve oEmbed tests passing tests, and it allows all oEmbed tests to pass even when the Internet is shut off. So that issue more or less supersedes this one, and greatly reduces the complexity of oEmbed testing. I defer this decision to the committers, but I'm not sure if it would be preferable to commit this patch as-is and stop the immediate bleeding, then reroll #2964636: Improve oEmbed tests...or if we should close this issue, transfer the credit, and finish the other one.
Just thought I'd throw that out there.
Comment #19
larowlanI agree with @phenaproxima, making it not rely on the internet in a more complete fashion feels like a better approach - given the likelihood of another vimeo outage is low, perhaps it would be better to focus on that patch instead?
Comment #20
alexpott@larowlan it's the same fashion - changing the http client configuration - with just a little less for the developer to think about. Imo we should get this in and then focus on that patch and test it for not connecting to the outside world too because it wouldn't be the first time we've got it wrong.
Comment #21
phenaproximaIt looks like #2964636: Improve oEmbed tests will be going through its paces now that there's something to iterate, and the priority is preventing core from testing the Internet. So +1 for landing this now.
Comment #23
alexpottRandom fail that we're seeing in HEAD -
Comment #24
bnjmnmReroll
Comment #25
dwwInterdiff between #17 and #24 is failing. So here's a raw diff of the 2 patch files. The only change of substance is that the
protected static $modulesincore/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTest.phpwas converted to a multi-line array in commit 6e594c26 for #3060603: Live preview is broken when editing the media_library view. Everything else is just context line numbers.Given that, +1 to leaving this RTBC (although I haven't closely reviewed everything myself).
Cheers,
-Derek
Comment #26
larowlanreview credits
Comment #29
larowlanCommitted 006e179 and pushed to 8.8.x. Thanks!
c/p to 8.7.x