Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 9 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ dependencies {
integTestImplementation('org.spockframework:spock-core:2.4-M6-groovy-4.0') {
exclude module: "groovy"
}
// Integration with JUnit 4 features for Spock 2+ (which internally uses JUnit Platform -
// part of JUnit 5) - https://spockframework.org/spock/docs/2.4-M6/modules.html
integTestImplementation('org.spockframework:spock-junit4:2.4-M6-groovy-4.0') {
exclude module: "groovy"
}
integTestImplementation(platform("org.junit:junit-bom:${props.getProperty('junit5')}"))
integTestRuntimeOnly("org.junit.platform:junit-platform-launcher")
integTestRuntimeOnly("org.junit.vintage:junit-vintage-engine")
}

configurations.all {
Expand Down Expand Up @@ -253,6 +261,7 @@ if (project != rootProject) {
}

tasks.register("integTest", Test) {
useJUnitPlatform()
inputs.dir(file("src/testKit")).withPropertyName("testkit dir").withPathSensitivity(PathSensitivity.RELATIVE)
systemProperty 'test.version_under_test', version
onlyIf { org.opensearch.gradle.info.BuildParams.inFipsJvm == false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class DistributionDownloadPluginFuncTest extends AbstractGradleFuncTest {
where:
version | platform | distType
VersionProperties.getOpenSearch() | OpenSearchDistribution.Platform.LINUX | "current"
"8.1.0-SNAPSHOT" | OpenSearchDistribution.Platform.LINUX | "bwc"
"7.0.0" | OpenSearchDistribution.Platform.WINDOWS | "released"
"2.19.0-SNAPSHOT" | OpenSearchDistribution.Platform.LINUX | "bwc"
"3.3.0" | OpenSearchDistribution.Platform.WINDOWS | "released"
}


Expand All @@ -72,7 +72,8 @@ class DistributionDownloadPluginFuncTest extends AbstractGradleFuncTest {
"""

when:
def runner = gradleRunner('clean', 'setupDistro', '-i')
def customGradleUserHome = testProjectDir.newFolder().absolutePath;
def runner = gradleRunner('clean', 'setupDistro', '-i', '-g', customGradleUserHome)
def result = withMockedDistributionDownload(version, platform, runner) {
// initial run
build()
Expand All @@ -82,7 +83,8 @@ class DistributionDownloadPluginFuncTest extends AbstractGradleFuncTest {

then:
result.task(":setupDistro").outcome == TaskOutcome.SUCCESS
assertOutputContains(result.output, "Skipping ${SymbolicLinkPreservingUntarTransform.class.simpleName}")
result.output.count("Unpacking opensearch-${version}-linux-x64.tar.gz " +
"using SymbolicLinkPreservingUntarTransform.") == 0
}

def "transforms are reused across projects"() {
Expand All @@ -91,6 +93,7 @@ class DistributionDownloadPluginFuncTest extends AbstractGradleFuncTest {
def platform = OpenSearchDistribution.Platform.LINUX

3.times {
testProjectDir.newFolder("sub-$it")
settingsFile << """
include ':sub-$it'
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class JdkDownloadPluginFuncTest extends AbstractGradleFuncTest {
def mockRepoUrl = urlPath(jdkVendor, jdkVersion, platform)
def mockedContent = filebytes(jdkVendor, platform)
3.times {
testProjectDir.newFolder("sub-$it")
settingsFile << """
include ':sub-$it'
"""
Expand Down Expand Up @@ -193,7 +194,7 @@ class JdkDownloadPluginFuncTest extends AbstractGradleFuncTest {
}

then:
assertOutputContains(result.output, "Skipping $transformType")
result.output.count("Unpacking ${platform}-12.0.2-x64.tar.gz using ${transformType}.") == 0

where:
platform | transformType
Expand Down Expand Up @@ -246,6 +247,7 @@ class JdkDownloadPluginFuncTest extends AbstractGradleFuncTest {
p.repositories.all { repo ->
if(repo.name == "jdk_repo_${jdkVendor}_${jdkVersion}") {
repo.setUrl('${server.baseUrl()}')
repo.setAllowInsecureProtocol(true)
}
}
}"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ class InternalDistributionArchiveSetupPluginFuncTest extends AbstractGradleFuncT
given:
file('someFile.txt') << "some content"

testProjectDir.newFolder("consumer")
testProjectDir.newFolder("producer-tar")

settingsFile << """
include ':consumer'
include ':producer-tar'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest
internalBuild()
bwcMinorProjectSetup()
buildFile << """
import org.opensearch.gradle.JavaPackageType

apply plugin: 'opensearch.internal-distribution-download'

opensearch_distributions {
Expand All @@ -130,7 +132,7 @@ class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest
type = "archive"
platform = "linux"
architecture = Architecture.current();
bundledJdk = false
bundledJdk = JavaPackageType.NONE
}
}
tasks.register("createExtractedTestDistro") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ subprojects {
apply plugin:'base'

tasks.register('tar', Tar) {
from('.')
from('build.gradle')
destinationDirectory.set(file('build/distributions'))
archiveBaseName.set("opensearch")
archiveVersion.set("8.0.1-SNAPSHOT")
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/testKit/testingConventions/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ allprojects {
mavenCentral()
}
dependencies {
testImplementation "junit:junit:4.13.2"
testImplementation "junit:junit:${versions.junit}"
}

ext.licenseFile = file("$buildDir/dummy/license")
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ password4j = "1.8.3"
# test dependencies
randomizedrunner = "2.7.1"
junit = "4.13.2"
junit5 = "6.0.0"
hamcrest = "2.1"
mockito = "5.16.1"
objenesis = "3.3"
Expand Down
2 changes: 1 addition & 1 deletion plugins/identity-shiro/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies {
testImplementation project(path: ':modules:transport-netty4') // for http
testImplementation "org.mockito:mockito-core:${versions.mockito}"
testImplementation project(path: ':client:rest-high-level')
testImplementation 'junit:junit:4.13.2'
testImplementation "junit:junit:${versions.junit}"
}

/*
Expand Down
Loading