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

BlockHound integration #1821

Merged
merged 15 commits into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve build configuration of integration tests
* publication-validator is renamed to integration-testing;
* Each test is now in a separate source set, which allows for more
  flexibility in their configuration; for example, failing to set
  `dryRun=true` doesn't prevent tests other than NPM to run, and
  it is possible to run the tests (and their dependencies)
  separately.
  • Loading branch information
dkhalanskyjb committed Mar 16, 2020
commit 3fc6abc38a8d80f0e7be10c4d8fe0045128ed888
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ apply from: rootProject.file("gradle/experimental.gradle")
def rootModule = "kotlinx.coroutines"
def coreModule = "kotlinx-coroutines-core"
// Not applicable for Kotlin plugin
def sourceless = ['kotlinx.coroutines', 'site', 'kotlinx-coroutines-bom', 'publication-validator']
def internal = ['kotlinx.coroutines', 'site', 'benchmarks', 'js-stub', 'stdlib-stubs', 'publication-validator']
def sourceless = ['kotlinx.coroutines', 'site', 'kotlinx-coroutines-bom', 'integration-testing']
def internal = ['kotlinx.coroutines', 'site', 'benchmarks', 'js-stub', 'stdlib-stubs', 'integration-testing']
// Not published
def unpublished = internal + ['example-frontend-js', 'android-unit-tests']

Expand Down
13 changes: 13 additions & 0 deletions integration-testing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Integration tests

This is a supplementary subproject of kotlinx.coroutines that provides
integration tests.

The tests are the following:
* `NpmPublicationValidator` tests that version of NPM artifact is correct and that it has neither source nor package dependencies on atomicfu
In order for the test to work, one needs to run gradle with `-PdryRun=true`.
`-PdryRun` affects `npmPublish` so that it only provides a packed publication
and does not in fact attempt to send the build for publication.
* `MavenPublicationValidator` depends on the published artifacts and tests artifacts binary content and absence of atomicfu in the classpath

All the available tests can be run with `integration-testing:test`.
62 changes: 62 additions & 0 deletions integration-testing/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

apply from: rootProject.file("gradle/compile-jvm.gradle")

repositories {
mavenLocal()
mavenCentral()
}

sourceSets {
npmTest {
kotlin
compileClasspath += sourceSets.test.runtimeClasspath
runtimeClasspath += sourceSets.test.runtimeClasspath
}
mavenTest {
kotlin
compileClasspath += sourceSets.test.runtimeClasspath
runtimeClasspath += sourceSets.test.runtimeClasspath
}
}

task npmTest(type: Test) {
def sourceSet = sourceSets.npmTest
environment "projectRoot", project.rootDir
environment "deployVersion", version
def dryRunNpm = project.properties['dryRun']
def doRun = dryRunNpm == "true" // so that we don't accidentally publish anything, especially before the test
onlyIf { doRun }
if (doRun) { // `onlyIf` only affects execution of the task, not the dependency subtree
dependsOn(project(':').getTasksByName("publishNpm", true))
}
testClassesDirs = sourceSet.output.classesDirs
classpath = sourceSet.runtimeClasspath
}

task mavenTest(type: Test) {
def sourceSet = sourceSets.mavenTest
dependsOn(project(':').getTasksByName("publishToMavenLocal", true))
dependsOn.remove(project(':').getTasksByName("dokka", true))
testClassesDirs = sourceSet.output.classesDirs
classpath = sourceSet.runtimeClasspath
}

dependencies {
testCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testCompile 'junit:junit:4.12'
npmTestCompile 'org.apache.commons:commons-compress:1.18'
npmTestCompile 'com.google.code.gson:gson:2.8.5'
mavenTestRuntimeOnly project(':kotlinx-coroutines-core')
mavenTestRuntimeOnly project(':kotlinx-coroutines-android')
}

compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}

test {
dependsOn([npmTest, mavenTest])
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package kotlinx.coroutines.validator

import org.junit.*
import org.junit.Assert.assertTrue
import java.io.*
import java.util.jar.*

class MavenPublicationValidator {
Expand Down
13 changes: 0 additions & 13 deletions publication-validator/README.md

This file was deleted.

37 changes: 0 additions & 37 deletions publication-validator/build.gradle

This file was deleted.

2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ if (!build_snapshot_train) {
include('site')
}

module('publication-validator')
module('integration-testing')