-
Notifications
You must be signed in to change notification settings - Fork 6
Add Kotlin app with Spring Boot 3 and coroutines #264
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
Conversation
mfvanek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно взять более новую версию detekt
buildSrc/src/main/kotlin/sb-ot-demo.kotlin-conventions.gradle.kts
Outdated
Show resolved
Hide resolved
buildSrc/src/main/kotlin/sb-ot-demo.kotlin-conventions.gradle.kts
Outdated
Show resolved
Hide resolved
buildSrc/src/main/kotlin/sb-ot-demo.kotlin-conventions.gradle.kts
Outdated
Show resolved
Hide resolved
|
Не поправила пока только вынесение версии java в константу, т.к. сейчас там используются енамы, надо посмотреть, как их обобщить везде |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #264 +/- ##
============================================
+ Coverage 90.81% 93.46% +2.65%
- Complexity 59 102 +43
============================================
Files 25 39 +14
Lines 185 306 +121
Branches 6 10 +4
============================================
+ Hits 168 286 +118
Misses 14 14
- Partials 3 6 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mfvanek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
detekt был подключен некорректно. Я это исправил.
Теперь нужно поправить все предупреждения от detekt
Closes #231
Привет! Я исправила проблему с нахождением логов в тестах, соответствующих регулярному выражению для Котлин-модуля.
Осталась такая проблема: если я добавляю зависимость implementation("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6"), то в тестах не используется нужный логгер, появляется ошибка
java.lang.IllegalStateException: Failed to load ApplicationContext for [WebMergedContextConfiguration@752ffce3 testClass = io.github.mfvanek.spring.boot3.kotlin.test.ActuatorEndpointTest, locations = [], classes = [io.github.mfvanek.spring.boot3.kotlin.test.Application], contextInitializerClasses = [io.github.mfvanek.spring.boot3.kotlin.test.support.KafkaInitializer, io.github.mfvanek.spring.boot3.kotlin.test.support.JaegerInitializer, io.github.mfvanek.spring.boot3.kotlin.test.support.PostgresInitializer], activeProfiles = ["test"], propertySourceDescriptors = [], propertySourceProperties = ["org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true", "server.port=0"], contextCustomizers = [org.springframework.boot.test.autoconfigure.OnFailureConditionReportContextCustomizerFactory$OnFailureConditionReportContextCustomizer@38cedb7d, org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@b36f3982, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@9fdfac6d, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizer@611640f0, [ImportsContextCustomizer@5b86f4cb key = [org.springframework.cloud.contract.wiremock.WireMockRestTemplateConfiguration, org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration, org.springframework.cloud.contract.wiremock.WireMockConfiguration, org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration, org.springframework.boot.actuate.autoconfigure.tracing.MicrometerTracingAutoConfiguration, org.springframework.boot.actuate.autoconfigure.tracing.NoopTracerAutoConfiguration, org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration, org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration]], org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@73aeef7d, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@4d9754a8, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@4d84049a, org.springframework.boot.test.web.reactive.server.WebTestClientContextCustomizer@4cb702ce, org.springframework.boot.test.web.reactor.netty.DisableReactorResourceFactoryGlobalResourcesContextCustomizerFactory$DisableReactorResourceFactoryGlobalResourcesContextCustomizerCustomizer@4f654cee, org.springframework.test.context.support.DynamicPropertiesContextCustomizer@0, org.springframework.boot.test.context.SpringBootTestAnnotation@c9233230], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null] at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:180) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:130) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:155) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:111) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:260) at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:160) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) at java.base/java.util.Optional.orElseGet(Optional.java:364) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.helpers.NOPLoggerFactory loaded from file:/C:/Users/m.zharinova/.gradle/caches/modules-2/files-2.1/io.gitlab.arturbosch.detekt/detekt-formatting/1.23.6/48c928585b597774c77a23291f5fd34f24fb99a1/detekt-formatting-1.23.6.jar). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.helpers.NOPLoggerFactory at org.springframework.util.Assert.instanceCheckFailed(Assert.java:618) at org.springframework.util.Assert.isInstanceOf(Assert.java:533) ...Я исключала модуль slf4j и другие зависимости внутри io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6, но не помогло.
Также есть проблема с jacoco. Хотя тестов не меньше, чем в java-модуле, не проходит верификация, я так понимаю от того. что логгеры вне класса. Я сами логгеры и fun main исключила из проверок jacoco, но методы, где используются эти логгеры, помечены, как недостаточно покрытые тестами, хотя в java-модуле этого нет. Пока не придумала, как это поправить.

Вот так в Котлин-классе
Вот так в аналогичном java-классе

Сначала я начала добавлять еще тесты, но подумала, может, есть другой способ, не тесты ради покрытия.