Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[FrameworkBundle] ensureKernelShutdown in tearDownAfterClass#60564

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
cquintana92 wants to merge2 commits intosymfony:7.4
base:7.4
Choose a base branch
Loading
fromcquintana92:chore/ensure-kernel-shutdown-teardownafterclass

Conversation

cquintana92
Copy link

@cquintana92cquintana92 commentedMay 27, 2025
edited by nicolas-grekas
Loading

QA
Branch?6.4
Bug fix?yes (?)
New feature?no
Deprecations?no
IssuesNone
LicenseMIT

This PR performs the following change: InKernelTestCase, the kernel is shut down after every test, as per thestatic::ensureKernelShutdown() call in thetearDown function. However, if one was to perform any extra code in theirtearDownAfterClass and callgetContainer, it would boot up a new kernel, which would then be left dangling. The main issue with that is that when the next Test class is executed, there would already be a booted kernel, so it could happen that it was pointing to dangling resources.

By adding this call tostatic::ensureKernelShutdown in thetearDownAfterClass, we can ensure that no dangling kernels are left even after the test class has finished.

BafS reacted with thumbs up emoji
@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.4 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@cquintana92cquintana92force-pushed thechore/ensure-kernel-shutdown-teardownafterclass branch fromea858f6 tofeeac45CompareMay 27, 2025 13:09
@OskarStarkOskarStark changed the titlechore: ensureKernelShutdown in tearDownAfterClassensureKernelShutdown in tearDownAfterClassMay 27, 2025
@carsonbotcarsonbot changed the titleensureKernelShutdown in tearDownAfterClass[FrameworkBundle] ensureKernelShutdown in tearDownAfterClassMay 27, 2025
@nicolas-grekas
Copy link
Member

This relies on the child class calling the parent class.
I'd suggest using the@afterClass annotation instead (and making the method public).
This will provide better ordering also because this methods with annotation are called after tearDownAfterClass

@cquintana92
Copy link
Author

@nicolas-grekas I've added it in a new public method annotated with@afterClass. If you prefer I can just annotate theensureKernelShutdown method with@afterClass, but I found cleaner to split the actual logic from the test lifecycle event.

@nicolas-grekasnicolas-grekas modified the milestones:7.4,6.4May 30, 2025
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think it'd make more sense to me to add the annotation on the existing method.
My concern is about increasing the public API. People will start using the new method instead of the existing one in their test cases / IDEs will propose both, and people will wonder about that.

Also: I'm fine merging this as a bugfix, so 6.4 works for me.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

Assignees
No one assigned
Projects
None yet
Milestone
6.4
Development

Successfully merging this pull request may close these issues.

4 participants
@cquintana92@carsonbot@nicolas-grekas@OskarStark

[8]ページ先頭

©2009-2025 Movatter.jp