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

Strange exception when running tests in CI #19

Open
ptrzyna opened this issue Mar 18, 2015 · 3 comments
Open

Strange exception when running tests in CI #19

ptrzyna opened this issue Mar 18, 2015 · 3 comments
Labels

Comments

@ptrzyna
Copy link

ptrzyna commented Mar 18, 2015

Hi,

I'm getting a very strange exception when running tests that use flyway extension in the CI box (bamboo). Tests seem to work perfectly fine locally. It appears that configuration cannot be found.

This is how our tests are annotated. Application.class is the java spring config. We are using spring boot and all of our db settings come from application.properties.

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@TransactionConfiguration
@TestExecutionListeners({DependencyInjectionTestExecutionListener.class, FlywayTestExecutionListener.class })
@FlywayTest

This is the exception we are seeing in the CI box:

org.flywaydb.test.junit.FlywayTestExecutionListener@54997f67] to process 'before class' callback for test class [class com.test.service.FormActualServiceTest]
build   18-Mar-2015 14:05:52    
build   18-Mar-2015 14:05:52    java.lang.IllegalArgumentException: Annotation class com.sun.proxy.$Proxy10 was set, but no Flyway configuration was given.
build   18-Mar-2015 14:05:52        at org.flywaydb.test.junit.FlywayTestExecutionListener.dbResetWithAnotation(FlywayTestExecutionListener.java:280)
build   18-Mar-2015 14:05:52        at org.flywaydb.test.junit.FlywayTestExecutionListener.beforeTestClass(FlywayTestExecutionListener.java:152)
build   18-Mar-2015 14:05:52        at org.springframework.test.context.TestContextManager.beforeTestClass(TestContextManager.java:179)
build   18-Mar-2015 14:05:52        at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:60)
build   18-Mar-2015 14:05:52        at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68)
build   18-Mar-2015 14:05:52        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
build   18-Mar-2015 14:05:52        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163)
build   18-Mar-2015 14:05:52        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
build   18-Mar-2015 14:05:52        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
build   18-Mar-2015 14:05:52        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
build   18-Mar-2015 14:05:52        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
build   18-Mar-2015 14:05:52        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
build   18-Mar-2015 14:05:52        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

Any help would be greatly appreciated.

Thanks,
-Paul

@FlorianGWE
Copy link
Collaborator

Hi Paul,

first 2 questions:

  1. which flyway Version you usw
  2. can you also send me your code snipplet/Konfiguration where you setup your flyway imstande and database Konfiguration.

In hint for error detextion. The error occur if test extension not no flyway imstande injected.
This weekend I can take a look in this Problem.

Florian

Am 18. März 2015 23:10:18 MEZ, schrieb "Paul A. Trzyna" notifications@github.com:

Hi,

I'm getting a very strange exception when running tests that use flyway
extension in the CI box (bamboo). Tests seem to work perfectly fine
locally. It appears that configuration cannot be found.

This is how our tests are annotated. Application.class is the java
spring config. We are using spring boot and all of our db settings come
from application.properties.

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@TransactionConfiguration
@TestExecutionListeners({DependencyInjectionTestExecutionListener.class,
FlywayTestExecutionListener.class })
@FlywayTest

This is the exception we are seeing in the CI box:

org.flywaydb.test.junit.FlywayTestExecutionListener@54997f67] to
process 'before class' callback for test class [class
com.test.service.FormActualServiceTest]
build  18-Mar-2015 14:05:52    
build  18-Mar-2015 14:05:52    java.lang.IllegalArgumentException:
Annotation class com.sun.proxy.$Proxy10 was set, but no Flyway
configuration was given.
build  18-Mar-2015 14:05:52        at
org.flywaydb.test.junit.FlywayTestExecutionListener.dbResetWithAnotation(FlywayTestExecutionListener.java:280)
build  18-Mar-2015 14:05:52        at
org.flywaydb.test.junit.FlywayTestExecutionListener.beforeTestClass(FlywayTestExecutionListener.java:152)
build  18-Mar-2015 14:05:52        at
org.springframework.test.context.TestContextManager.beforeTestClass(TestContextManager.java:179)
build  18-Mar-2015 14:05:52        at
org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:60)
build  18-Mar-2015 14:05:52        at
org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68)
build  18-Mar-2015 14:05:52        at
org.junit.runners.ParentRunner.run(ParentRunner.java:363)
build  18-Mar-2015 14:05:52        at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163)
build  18-Mar-2015 14:05:52        at
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
build  18-Mar-2015 14:05:52        at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
build  18-Mar-2015 14:05:52        at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
build  18-Mar-2015 14:05:52        at
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
build  18-Mar-2015 14:05:52        at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
build  18-Mar-2015 14:05:52        at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

Any help would be greatly appreciated.

Thanks,
-Paul


Reply to this email directly or view it on GitHub:
#19

@FlorianGWE
Copy link
Collaborator

Hi Paul,

my first email contains a error. FlywayTestExecutionListener works not with
a inject/autowire of Flyway instance.

final ApplicationContext appContext = testContext.getApplicationContext();
... // following line try to get a Bean of type Flyway from the application
context. Flyway flyway = getBean(appContext, Flyway.class);

Hope this helps.

One other information for you. Today I have not try to use
flyway-test-extensions inside a spring-boot application.

Florian

On Wed, Mar 18, 2015 at 11:10 PM, Paul A. Trzyna notifications@github.com
wrote:

Hi,

I'm getting a very strange exception when running tests that use flyway
extension in the CI box (bamboo). Tests seem to work perfectly fine
locally. It appears that configuration cannot be found.

This is how our tests are annotated. Application.class is the java spring
config. We are using spring boot and all of our db settings come from
application.properties.

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@TransactionConfiguration
@TestExecutionListeners({DependencyInjectionTestExecutionListener.class, FlywayTestExecutionListener.class })
@flywaytest

This is the exception we are seeing in the CI box:

org.flywaydb.test.junit.FlywayTestExecutionListener@54997f67] to process 'before class' callback for test class [class com.test.service.FormActualServiceTest]
build 18-Mar-2015 14:05:52
build 18-Mar-2015 14:05:52 java.lang.IllegalArgumentException: Annotation class com.sun.proxy.$Proxy10 was set, but no Flyway configuration was given.
build 18-Mar-2015 14:05:52 at org.flywaydb.test.junit.FlywayTestExecutionListener.dbResetWithAnotation(FlywayTestExecutionListener.java:280)
build 18-Mar-2015 14:05:52 at org.flywaydb.test.junit.FlywayTestExecutionListener.beforeTestClass(FlywayTestExecutionListener.java:152)
build 18-Mar-2015 14:05:52 at org.springframework.test.context.TestContextManager.beforeTestClass(TestContextManager.java:179)
build 18-Mar-2015 14:05:52 at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:60)
build 18-Mar-2015 14:05:52 at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68)
build 18-Mar-2015 14:05:52 at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
build 18-Mar-2015 14:05:52 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163)
build 18-Mar-2015 14:05:52 at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
build 18-Mar-2015 14:05:52 at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
build 18-Mar-2015 14:05:52 at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
build 18-Mar-2015 14:05:52 at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
build 18-Mar-2015 14:05:52 at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
build 18-Mar-2015 14:05:52 at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

Any help would be greatly appreciated.

Thanks,
-Paul


Reply to this email directly or view it on GitHub
#19.

@FlorianGWE
Copy link
Collaborator

With the current implementation I can not reproduce this exception.

I add a sample Spring Boot application with a normal Spring Boot and a FlywayTest Spring Boot Test.
see https://github.com/flyway/flyway-test-extensions/tree/master/flyway-test-extensions/flyway-test-samples/flyway-test-spring-samples/spring-boot-sample-flyway

Florian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants