<@U035683KFAM> Opening another :thread: about `Spr...
# kotest
g
@Chris Lee Opening another đź§µ about
SpringAutowireConstructorExtension
Vs.
SpringExtension
btw, that extension should likely be this:
Copy code
override fun extensions(): List<Extension> {
    return listOf(SpringAutowireConstructorExtension)
}
…unless you intend to apply
SpringExtension
to all test specs (above matches what kotest auto-configures).
Could you please elaborate?
c
When I disabled auto-scan for configurations and extensions several Spring-based tests broke. I added
SpringExtension
into the Kotest config class - that broke many other non-Spring tests. From looking at the kotest config dump (w/ autoscan enabled) aligned on using
SpringAutowireConstructorExtension
to match what kotest had previously provided.
s
We might want a better way for extensions to auto register themselves, either using the ServiceLoader framework in Java, or by using a well defined class name.
👍 1
I might remove the warning about auto scan in 5.7.2, it seems premature to add it given the noise that's coming up around it
c
@Giorgio Vespucci you will need to add in the
SpringAutowireConstructorExtension
to match what kotest had auto-discovered; see if that fixes your test-detection issue.
@sam yes, an alternate way of registration would be good, atm we have to re-create what was previously assumed to always be present (when disabling autoscan).
g
Sorry for the delay @Chris Lee, you know, timezones... Should I try to add
SpringAutowireConstructorExtension
or as a replacement for
SpringExtension
? Thanks
c
Add them both, to match what auto scan picked up
👍 1
g
Tried with both, but nothing special happened, the configuration looks the same.
Copy code
~~~ Kotest Configuration ~~~
-> Parallelization factor: 10
-> Concurrent specs: null
-> Global concurrent tests: 1
-> Dispatcher affinity: true
-> Coroutine debug probe: false
-> Spec execution order: Lexicographic
-> Default test execution order: Sequential
-> Default test timeout: nullms
-> Default test invocation timeout: nullms
-> Default isolation mode: SingleInstance
-> Global soft assertions: false
-> Write spec failure file: false
-> Fail on ignored tests: false
-> Fail on empty test suite: false
-> Duplicate test name mode: Warn
-> Remove test name whitespace: false
-> Append tags to test names: false
-> Extensions
  - io.kotest.engine.extensions.SystemPropertyTagExtension
  - io.kotest.extensions.spring.SpringAutowireConstructorExtension
  - class io.kotest.engine.config.ApplyConfigFromAbstractProjectConfigKt$applyConfigFromProjectConfig$projectListener$1
  - io.kotest.extensions.spring.SpringTestExtension
  - io.kotest.extensions.spring.SpringAutowireConstructorExtension
  - io.kotest.runner.junit.platform.gradle.GradleClassMethodRegexTestFilter
-> Tags:
Did you expect to see something in particular?
To be noted that
Copy code
io.kotest.extensions.spring.SpringAutowireConstructorExtension
appears 2 times. Maybe one of the Spring extension is redundant now
c
Try tests with auto scan disabled.
g
It just doesn't write any warning, and it's equally slow. The build time is always at least the triple of Kotest < 5.7.0
With Kotest 5.6.2
c
Ok. Seems like it at least got us past the “no tests found” issue. Not sure where to go w/o more specifics on the setup etc - is it possible to create a minimal reproducer of the issue that can be shared?
g
I should do it, yes. Even to understand if it reproduces with a minimal configuration. It could be also some "conflict" with other libraries we still don't know.
I will ping you here as soon as I have something shareable in public GitHub. Thanks for your support so far 👏
👍 1
Seems like it at least got us past the “no tests found”
This happened when I switched off the
Copy code
kotest.framework.classpath.scanning.config
and forced the configuration class with
Copy code
kotest.framework.config.fqn
During the latest run I only switched off
Copy code
kotest.framework.classpath.scanning.autoscan
c
ah. try with the config scanning turned off as well, forcing the configuration.
g
Trying then with 5.7.1 and
Copy code
kotest.framework.dump.config=true
kotest.framework.classpath.scanning.config.disable=true
kotest.framework.classpath.scanning.autoscan.disable=true
kotest.framework.config.fqn=***.KotestProjectConfig
👍 1
Copy code
[INFO] Results:
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:48 min
[INFO] Finished at: 2023-09-06T15:13:16+02:00
[INFO] ------------------------------------------------------------------------
Copy code
[ERROR] There was an error in the forked process
[ERROR] TestEngine with ID 'kotest' failed to discover tests
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
[ERROR] TestEngine with ID 'kotest' failed to discover tests
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:656)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:282)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
c
Yea. Need to see if a reproducer can catch this scenario.
g
🫡
s
I would turn on the debug logging
and upload the full log file
can you set an ENV var with
Copy code
KOTEST_DEBUG=true
and then run the build, that should spam the logs with loads of kotest debugging
g
Yeah, will do it, thanks @sam
@sam I’ve just tried my POC at https://github.com/gvespucci/kotest-poc with
KOTEST_DEBUG=true
and it stopped with
Copy code
[ERROR] TestEngine with ID 'kotest' failed to discover tests
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
🤔
@Chris Lee
Yea. Need to see if a reproducer can catch this scenario.
There is my public POC on GitHub. It's failing as mentioned with the pushed
kotest.properties
. It's failing as well with
-DKOTEST_DEBUG=true
Thank You