Problem/Motivation
#2509898: Additional uncaught exception thrown while handling exception after service changes introduced some tests that relied on dumping an ErrorContainer to disk.
However #2497243: Replace Symfony container with a Drupal one, stored in cache ensures that only the container is used and such the dumped container does not matter.
Proposed resolution
- Use a 'container_base_class' setting to ensure that the test can just write that to settings.php, run its test with the container, then move back.
Remaining tasks
- Fix it
User interface changes
- None
API changes
API addition:
- Adds the possibility to specify the container (base) class via settings.php (incorporates the idea and parts of #2489060: Allow to trace the service Container).
Data model changes
- None
Beta phase evaluation
| Issue category | Bug because it relies on internals for testing, the unwanted behavior that a Container created by a different Kernel is cached to disk. |
|---|---|
| Issue priority | Major because it blocks a critical. |
| Unfrozen changes | Unfrozen because it only changes tests or the changes support testing. |
| Priorized changes | Follow-up to a critical to fix it properly, reduces fragility, unblocks a critical. |
| Disruption | Not disruptive. |
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | decouple_error_testing-2528292-7.patch | 5.36 KB | fabianx |
| #10 | interdiff.txt | 1.46 KB | fabianx |
Comments
Comment #1
fabianx commentedAnd here is the patch, I borrowed the approach from #2489060: Allow to trace the service Container.
This reduces fragility
and might help solve DrupalCI failures (not sure).It also would hugely profit from #2493665: Add centralized container invalidation method, so I will try to get that one in first.
Comment #2
fabianx commentedComment #3
dawehnerWell, it is critical under the assumption that the solution you have is the only working solution for the stampede issue.
I think its honestly fine / better to not document this, given how internal it really is.
Comment #4
fabianx commentedGot feedback from alexpott, he was okay to document (with some use cases), but wanted to remove the static:: as any code using that static would be wrong.
=> CNW
Comment #5
fabianx commented- Addressed the review
- Added documentation
( uhm, clone failure, this issue is major, not critical. )
Comment #6
fabianx commentedIt turns out I was wrong:
The invalidateContainer method cannot be used, because then we would test the container builder on next request. *sigh*
So just added new invalidate calls and docs as interdiff.
Needs reviews now.
Change record is here: https://www.drupal.org/node/2528396
Comment #7
fabianx commentedComment #8
fabianx commentedsettings.php are not persisted across test methods, I mis-read that.
Comment #9
dawehnerAs we figured out ... we don't need this, yeah!
Comment #10
fabianx commentedFixed #8 and updated IS, it still relies on a compiled container on disk (else it runs the container builder), but with the base class setting that is now a side effect and not the primary test method, e.g. other implementations are possible.
Comment #11
dawehnerThank you fabian!
Better safe than sorry, but also better correct than sorta correct
Comment #12
larowlanrtbc+1
Comment #13
alexpottCommitted 0f4319e and pushed to 8.0.x. Thanks!
Fixed up the comment on commit.
Comment #15
alexpottI forgot to add the improvements I said I did in #13. Oops