This commit is contained in:
Phillip Webb
2014-05-26 21:48:19 +01:00
parent 96adb87bbd
commit 6381fdcb49
12 changed files with 77 additions and 29 deletions

View File

@@ -1210,8 +1210,8 @@ that can be used to disable the migrations, or switch off the location checking.
By default Flyway will autowire the (`@Primary`) `DataSource` in your context and
use that for migrations. If you like to use a different `DataSource` you can create
one and mark its `@Bean` as `@FlywayDataSource` - if you do that remember to create
another one and mark it as `@Primary` if you want 2 data sources.
Or you can use Flyway's native `DataSource` by setting `flyway.[url,user,password]`
another one and mark it as `@Primary` if you want 2 data sources.
Or you can use Flyway's native `DataSource` by setting `flyway.[url,user,password]`
in external properties.
There is a {github-code}/spring-boot-samples/spring-boot-sample-flyway[Flyway sample] so

View File

@@ -1646,14 +1646,15 @@ interaction. For Example:
}
----
NOTE: Spring's test framework will cache application contexts between tests. Therefore,
as long as your tests share the same configuration, the time consuming process of starting
and stopping the server will only happen once, regardless of the number of tests that
actually run.
To change the port you can add environment properties to `@IntegrationTest` as colon- or
equals-separated name-value pairs, e.g. `@IntegrationTest("server.port:9000")`.
As long as you use the same configuration, the context will be cached amongst different
tests by default. You can therefore use this feature to run a battery of integration tests
where the server would actually start prior to the tests. In that case, it would be better
to make sure that your integration tests use a random port for the main server and the
management one, something like:
Additionally you can set the `server.port` and `management.port` properties to `0`
in order to run your integration tests using random ports. For example:
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
@@ -1661,13 +1662,18 @@ management one, something like:
@SpringApplicationConfiguration(classes = MyApplication.class)
@WebAppConfiguration
@IntegrationTest({"server.port=0", "management.port=0"})
public class SomeIntegrationTests { ... }
public class SomeIntegrationTests {
// ...
}
----
See <<howto-discover-the-http-port-at-runtime>> for a description of how you can discover
the actual port that was allocated for the duration of the tests.
[[boot-features-test-utilities]]
=== Test utilities
A few test utility classes are packaged as part of `spring-boot` that are generally