Skip to content
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

AutoWired not work when use SpringExtension and IsolationMode.InstancePer(Test | Leaf) #2373

Closed
Tracked by #2226
HunJeong opened this issue Jul 21, 2021 · 3 comments
Closed
Tracked by #2226
Labels
bug 🐛 Issues that report a problem or error in the code. extensions 🔋 Related to the extensions mechanisms within the testing framework
Milestone

Comments

@HunJeong
Copy link

Which version of Kotest are you using
4.6.1

version of kotest-extension-spring
1.0.0

If I change IsolationMode to something that is not SingleInstance, the test will not work

But SpringListener works

ex) in kotest-extensions-spring test

...
@ContextConfiguration(classes = [(Components::class)])
class SpringExtensionTest : WordSpec() {
   override fun isolationMode() = IsolationMode.InstancePerTest // or InstancePerLeaf
   override fun extensions() = listOf(SpringExtension)
   @Autowired
   private var service: UserService? = null
   init {
      "SpringExtension" should {
         "have autowired the service" {
            service?.repository?.findUser()?.name shouldBe "system_user"
         }
...

‘have autowired the service’ test is broken

@stale
Copy link

stale bot commented Sep 19, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Sep 19, 2021
@sksamuel sksamuel added bug 🐛 Issues that report a problem or error in the code. extensions 🔋 Related to the extensions mechanisms within the testing framework and removed wontfix labels Sep 19, 2021
@sksamuel
Copy link
Member

This will require 5.0 to be released first, as we require a new extension mount to support this use case.

@sksamuel sksamuel added this to the 5.0 milestone Sep 23, 2021
@sksamuel
Copy link
Member

Now that 5.0.0.RC has been released, the latest snapshot of the spring extension has fixed this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Issues that report a problem or error in the code. extensions 🔋 Related to the extensions mechanisms within the testing framework
Projects
None yet
Development

No branches or pull requests

2 participants