-
Notifications
You must be signed in to change notification settings - Fork 14
Test micronaut 2.x #232
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
Test micronaut 2.x #232
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ plugins { | |
val versions: Map<String, String> by extra | ||
|
||
val micronautVersion = "1.0.0" | ||
val micronaut2Version = "2.2.3" | ||
val micronautTestVersion = "1.0.0" | ||
|
||
dependencies { | ||
|
@@ -21,28 +20,32 @@ dependencies { | |
testAnnotationProcessor("io.micronaut:micronaut-inject-java:${micronautVersion}") | ||
} | ||
|
||
/** | ||
* Todo this does not run tests | ||
*/ | ||
for (version in listOf(micronautVersion, micronaut2Version)) { | ||
val micronaut2Version = "2.2.3" | ||
|
||
for (version in listOf(micronaut2Version)) { | ||
val versionedConfiguration = configurations.create("test_${version}") { | ||
extendsFrom(configurations.testRuntimeClasspath.get()) | ||
} | ||
dependencies { | ||
versionedConfiguration(project(":instrumentation:netty:netty-4.1")) | ||
versionedConfiguration("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-netty-4.1:${versions["opentelemetry_java_agent"]}") | ||
versionedConfiguration(project(":testing-common")) | ||
versionedConfiguration("io.micronaut:micronaut-inject-java:${version}") | ||
versionedConfiguration("io.micronaut.test:micronaut-test-junit5:${micronautTestVersion}") | ||
versionedConfiguration("io.micronaut:micronaut-inject-java:${version}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this needed? The standard test only uses this as an annotation processor, which means it's not present at runtime for those tests (and thus shouldn't be when switching versions) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it seems redundant, removing |
||
versionedConfiguration("io.micronaut:micronaut-http-server-netty:${version}") | ||
versionedConfiguration("io.micronaut:micronaut-http-client:${version}") | ||
versionedConfiguration("io.micronaut:micronaut-runtime:${version}") | ||
versionedConfiguration("io.micronaut:micronaut-inject:${version}") | ||
versionedConfiguration("org.junit.jupiter:junit-jupiter-api:5.7.0") | ||
versionedConfiguration("org.junit.jupiter:junit-jupiter-engine:5.7.0") | ||
} | ||
val versionedTest = task<Test>("test_${version}") { | ||
group = "verification" | ||
testClassesDirs = sourceSets["test"].output.classesDirs | ||
classpath = versionedConfiguration | ||
val testOuput = sourceSets.test.get().output | ||
testClassesDirs = testOuput.classesDirs | ||
classpath = versionedConfiguration + testOuput | ||
useJUnitPlatform() | ||
shouldRunAfter("test") | ||
} | ||
tasks.check { dependsOn(versionedTest) } | ||
tasks.test { dependsOn(versionedTest) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this contradicts the shouldRunAfter on line 48. It win's because this is a stronger constraint than There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I take it back on the last part - the declaration of dependencies for versionedTest isn't needed explicitly since using the test sourceset tells gradle that those sources must be compiled first. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. without this the tests do not run. I am running them as
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So that's specifying a specific task to run - the unit test task. If you're trying to run all verification tasks, that's the purpose of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It the additional tests are not run either with
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does that include the switch suggested above (
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changing to check
now it runs as part of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. described above - it's minimal, but it removes one more constraint on the task graph to allow better optimization of the task execution. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. got it thanks |
||
} |
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.
These aren't present in the
testImplementation
either - I'd expect the dependencies called out here to match those, except with different versions (and the added junit ones which are added externally from your root file fortestImplementation
and aren't visible in this file)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.
not needed removing