[Test] Don't override manually registered services during test configuration
There are two ways of test service registration: - manual call to `useAdditionalServices` in abstract test runner - using of `additionalServices` property in one of test entity (e.g. in handler) Services are registered in the same order (manual first, automatic second) This led to the situation that if there was registered more specific implementation of the service in the test configuration, it will be overridden with regular implementation from handler, which is fixed by this commit
This commit is contained in:
committed by
Nikolay Lunyak
parent
990da9fa1a
commit
cb3f41f669
+4
-2
@@ -58,7 +58,9 @@ class TestConfigurationImpl(
|
||||
testServices.register(KotlinTestInfo::class, testInfo)
|
||||
val runtimeClassPathProviders = runtimeClasspathProviders.map { it.invoke(testServices) }
|
||||
testServices.register(RuntimeClasspathProvidersContainer::class, RuntimeClasspathProvidersContainer(runtimeClassPathProviders))
|
||||
additionalServices.forEach { testServices.register(it) }
|
||||
additionalServices.forEach {
|
||||
testServices.register(it, skipAlreadyRegistered = false)
|
||||
}
|
||||
}
|
||||
|
||||
private val allDirectives = directives.toMutableSet()
|
||||
@@ -131,7 +133,7 @@ class TestConfigurationImpl(
|
||||
|
||||
private fun ServicesAndDirectivesContainer.registerDirectivesAndServices() {
|
||||
allDirectives += directiveContainers
|
||||
testServices.register(additionalServices)
|
||||
testServices.register(additionalServices, skipAlreadyRegistered = true)
|
||||
}
|
||||
|
||||
private fun List<ServicesAndDirectivesContainer>.registerDirectivesAndServices() {
|
||||
|
||||
Reference in New Issue
Block a user