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

NoSuchMethodError io.kotest.core.descriptors.Descriptor$TestDescriptor.path(boolean) #3122

Closed
MrTomato opened this issue Jul 25, 2022 · 21 comments
Labels
bug 🐛 Issues that report a problem or error in the code. framework 🏗️ Pertains to the core structure and components of the Kotest framework.
Milestone

Comments

@MrTomato
Copy link

After upgrading from Kotest version 5.3.2 to 5.4.0 for dependencies io.kotest:kotest-runner-junit5-jvm and io.kotest:kotest-assertions-core-jvm (additionally using io.kotest.extensions:kotest-extensions-spring version 1.1.1 and spring-boot.starter.parent version 2.7.2)
I get the following error Exception:

'io.kotest.core.descriptors.TestPath io.kotest.core.descriptors.Descriptor$TestDescriptor.path(boolean)'
java.lang.NoSuchMethodError: 'io.kotest.core.descriptors.TestPath io.kotest.core.descriptors.Descriptor$TestDescriptor.path(boolean)'
	at io.kotest.extensions.spring.SpringTestExtension.methodName$kotest_extensions_spring(SpringTestExtension.kt:126)
	at io.kotest.extensions.spring.SpringTestExtension.method(SpringTestExtension.kt:100)
	at io.kotest.extensions.spring.SpringTestExtension.intercept(SpringTestExtension.kt:68)
	at io.kotest.engine.test.TestExtensions$intercept$execute$1$1.invokeSuspend(TestExtensions.kt:146)
	at io.kotest.engine.test.TestExtensions$intercept$execute$1$1.invoke(TestExtensions.kt)
	at io.kotest.engine.test.TestExtensions$intercept$execute$1$1.invoke(TestExtensions.kt)
	at io.kotest.engine.test.TestExtensions.intercept(TestExtensions.kt:154)
	at io.kotest.engine.test.interceptors.TestCaseExtensionInterceptor.intercept(TestCaseExtensionInterceptor.kt:24)
	at io.kotest.engine.test.TestCaseExecutor$execute$2$1.invokeSuspend(TestCaseExecutor.kt:90)
	at io.kotest.engine.test.TestCaseExecutor$execute$2$1.invoke(TestCaseExecutor.kt)
	at io.kotest.engine.test.TestCaseExecutor$execute$2$1.invoke(TestCaseExecutor.kt)
	at io.kotest.engine.test.interceptors.CoroutineErrorCollectorInterceptor$intercept$3.invokeSuspend(CoroutineErrorCollectorInterceptor.kt:28)
	at io.kotest.engine.test.interceptors.CoroutineErrorCollectorInterceptor$intercept$3.invoke(CoroutineErrorCollectorInterceptor.kt)
	at io.kotest.engine.test.interceptors.CoroutineErrorCollectorInterceptor$intercept$3.invoke(CoroutineErrorCollectorInterceptor.kt)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
	at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:169)
	at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
	at io.kotest.engine.test.interceptors.CoroutineErrorCollectorInterceptor.intercept(CoroutineErrorCollectorInterceptor.kt:27)
	at io.kotest.engine.test.TestCaseExecutor$execute$2$1.invokeSuspend(TestCaseExecutor.kt:90)
	at io.kotest.engine.test.TestCaseExecutor$execute$2$1.invoke(TestCaseExecutor.kt)
	at io.kotest.engine.test.TestCaseExecutor$execute$2$1.invoke(TestCaseExecutor.kt)
	at io.kotest.engine.test.interceptors.CoroutineDispatcherFactoryInterceptor$intercept$4.invokeSuspend(coroutineDispatcherFactoryInterceptor.kt:57)
	at io.kotest.engine.test.interceptors.CoroutineDispatcherFactoryInterceptor$intercept$4.invoke(coroutineDispatcherFactoryInterceptor.kt)
	at io.kotest.engine.test.interceptors.CoroutineDispatcherFactoryInterceptor$intercept$4.invoke(coroutineDispatcherFactoryInterceptor.kt)
	at io.kotest.engine.concurrency.FixedThreadCoroutineDispatcherFactory$withDispatcher$4.invokeSuspend(FixedThreadCoroutineDispatcherFactory.kt:53)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)

Minimal class to reproduce:

package com.acme.foo

import org.assertj.core.api.Assertions.assertThat
import org.springframework.boot.test.context.SpringBootTest

@SpringBootTest(
    webEnvironment = SpringBootTest.WebEnvironment.NONE,
)
class HealthCheckRemoteTest : SpringStringSpec() {

    init {
        "This is a fancy test" {
            assertThat(true).isEqualTo(true)
        }
    }
}

where SpringStringSpec is defined as

package com.acme.foo

import io.kotest.core.extensions.Extension
import io.kotest.core.spec.style.StringSpec
import io.kotest.extensions.spring.SpringExtension

abstract class SpringStringSpec : StringSpec() {

    override fun extensions(): List<Extension> = listOf(SpringExtension)
}

I am using my workaround from Kotlin/kotlinx.coroutines#3345 (comment) but even if I remove it, I encounter the same error.

Any hints?

Cheers,
Maestro

@sksamuel
Copy link
Member

sksamuel commented Jul 25, 2022 via email

@MrTomato
Copy link
Author

MrTomato commented Jul 25, 2022

Hi Samuel,

unfortunately that doesn't fix my issue.

All other dependencies are on their latest version (renovate bot makes sure of that).

That's why I encountered the error trying to update Kotest to the latest version 🥲

@CXwudi
Copy link

CXwudi commented Jul 26, 2022

Same issue with Spring Boot 1.7.2 (which uses coroutine 1.6.4 AFAIK) and Kotlin 1.7.10 CXwudi/vocadb-video-downloader-new#25

@jesperancinha
Copy link

I just encountered the same issue on the same upgrade @sksamuel

@sksamuel
Copy link
Member

sksamuel commented Jul 27, 2022 via email

@sksamuel sksamuel added bug 🐛 Issues that report a problem or error in the code. framework 🏗️ Pertains to the core structure and components of the Kotest framework. labels Jul 28, 2022
@Kantis Kantis added this to the 5.4.1 milestone Jul 28, 2022
@sksamuel
Copy link
Member

Fixed in 5.4.1

@timorantalaiho
Copy link

Hmm... I still get the same error with kotest 5.4.1 and kotest-extensions-spring 1.1.1 🤔

@sksamuel
Copy link
Member

Are you sure you're on 5.4.1 for all the right dependencies?
Here is the spring project itself, which you can clone, change to 5.4.0 see it fail, and then see it pass on 5.4.1
https://github.com/kotest/kotest-extensions-spring

@otbe
Copy link

otbe commented Jul 28, 2022

Renovate updated to 5.4.1 but error is the same for us :/

@sksamuel
Copy link
Member

Can you try adding kotest-common to your build, 5.4.1

@otbe
Copy link

otbe commented Jul 28, 2022

Stays the same unfortunately :/

testImplementation("io.kotest:kotest-common:5.4.1")

@sksamuel
Copy link
Member

sksamuel commented Jul 28, 2022 via email

@timorantalaiho
Copy link

timorantalaiho commented Jul 28, 2022

Thankyou @sksamuel ! I investigated this a bit, and noticed that if I build kotest-extensions-spring from latest commit in version control and use that version as a dependency (testImplementation("io.kotest.extensions:kotest-extensions-spring:1.1.0-LOCAL")) for our own application (with kotest 5.4.1), then everything works.

But from the latest publicly available kotest-extensions-spring version 1.1.1, it fails like this, even with kotest 5.4.1

        java.lang.NoSuchMethodError: 'io.kotest.core.descriptors.TestPath io.kotest.core.descriptors.Descriptor$TestDescriptor.path(boolean)'
            at io.kotest.extensions.spring.SpringTestExtension.methodName$kotest_extensions_spring(SpringTestExtension.kt:126)

So my guess would be that there is something unreleased in the main branch of kotest-extensions-spring that is needed to fix this issue.

@sksamuel
Copy link
Member

@timorantalaiho thanks for trying that. I think we can make this work for all versions - can you try the latest master build for the spring extension, and if you confirm that works, I will release 1.1.2 of the spring extension.

@timorantalaiho
Copy link

timorantalaiho commented Jul 28, 2022

@sksamuel Hmm is there a readily available build of latest https://github.com/kotest/kotest-extensions-spring somewhere?

I used latest master from there (39c0d0dd1751bf23a102c14fd2039abaf709fead), but built it locally for testing (with ./gradlew publishToMavenLocal), and this is what worked for us.

@sksamuel
Copy link
Member

yeah you can do that, or take the latest snapshot.

@sksamuel
Copy link
Member

Eg https://oss.sonatype.org/content/repositories/snapshots/io/kotest/extensions/kotest-extensions-spring/
But you need to add that maven repo to your build.

@timorantalaiho
Copy link

Oh yes: using io.kotest.extensions:kotest-extensions-spring:1.1.0.50-SNAPSHOT from the Sonatype snapshots repo works too 👍

@sksamuel
Copy link
Member

sksamuel commented Jul 28, 2022 via email

@timorantalaiho
Copy link

Yes, it does the trick.

Thankyou very much!

@MrTomato
Copy link
Author

yup, mine work now too - thanks @sksamuel!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Issues that report a problem or error in the code. framework 🏗️ Pertains to the core structure and components of the Kotest framework.
Projects
None yet
Development

No branches or pull requests

7 participants