You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Alex Arana (Jira)" <ji...@apache.org> on 2020/10/25 12:39:00 UTC

[jira] [Updated] (CAMEL-15755) Spring Boot tests broken when using TestInstance.Lifecycle.PER_CLASS

     [ https://issues.apache.org/jira/browse/CAMEL-15755?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Arana updated CAMEL-15755:
-------------------------------
    Description: 
After upgrading to {{3.6.0}} existing Spring Boot tests in my codebase started to fail. After some investigation I discovered that this is due to my unit tests having a single instance per class as configured using JUnit's 

@TestInstance(TestInstance.Lifecycle.PER_CLASS)

Some changes were introduced in a recent commit that affected the existing behaviour in CamelSpringBootExecutionListener: [efc34ab2b98|[https://github.com/apache/camel/commit/efc34ab2b98f3697ebb482cf1645fda6f0794797]]

I have remediated my tests by running the following code in a JUnit BeforeEach method within a base test class:
{code:java}
// Kotlin
@BeforeEach
fun init() {
    SpringCamelContext.setNoStart(false)
    camelContext.start()
}
{code}
I am currently looking for a more permanent solution to this issue that properly supports single instance JUnit5 Test classes.

  was:
After upgrading to {{3.6.0}} existing Spring Boot tests in my codebase started to fail. After some investigation I discovered that this is due to my unit tests having a single instance per class as configured using JUnit's 

@TestInstance(TestInstance.Lifecycle.PER_CLASS)

Some changes were introduced in a recent commit that affected the existing behaviour in CamelSpringBootExecutionListener: [efc34ab2b98|[https://github.com/apache/camel/commit/efc34ab2b98f3697ebb482cf1645fda6f0794797].]

I have remediated my tests by running the following code in a JUnit BeforeEach method within a base test class:
{code:java}
// Kotlin
@BeforeEach
fun init() {
    SpringCamelContext.setNoStart(false)
    camelContext.start()
}
{code}
I am currently looking for a more permanent solution to this issue that properly supports single instance JUnit5 Test classes.


> Spring Boot tests broken when using TestInstance.Lifecycle.PER_CLASS
> --------------------------------------------------------------------
>
>                 Key: CAMEL-15755
>                 URL: https://issues.apache.org/jira/browse/CAMEL-15755
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-spring, camel-test, tests
>    Affects Versions: 3.6.0
>            Reporter: Alex Arana
>            Priority: Minor
>
> After upgrading to {{3.6.0}} existing Spring Boot tests in my codebase started to fail. After some investigation I discovered that this is due to my unit tests having a single instance per class as configured using JUnit's 
> @TestInstance(TestInstance.Lifecycle.PER_CLASS)
> Some changes were introduced in a recent commit that affected the existing behaviour in CamelSpringBootExecutionListener: [efc34ab2b98|[https://github.com/apache/camel/commit/efc34ab2b98f3697ebb482cf1645fda6f0794797]]
> I have remediated my tests by running the following code in a JUnit BeforeEach method within a base test class:
> {code:java}
> // Kotlin
> @BeforeEach
> fun init() {
>     SpringCamelContext.setNoStart(false)
>     camelContext.start()
> }
> {code}
> I am currently looking for a more permanent solution to this issue that properly supports single instance JUnit5 Test classes.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)