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
22 changes: 16 additions & 6 deletions plugins/repository-hdfs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,37 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import org.elasticsearch.gradle.internal.test.RestIntegTestTask

import org.elasticsearch.gradle.OS
import org.elasticsearch.gradle.internal.info.BuildParams
import org.elasticsearch.gradle.internal.test.RestIntegTestTask

apply plugin: 'elasticsearch.internal-java-rest-test'
apply plugin: 'elasticsearch.internal-yaml-rest-test'

esplugin {
description = 'The HDFS repository plugin adds support for Hadoop Distributed File-System (HDFS) repositories.'
classname ='org.elasticsearch.repositories.hdfs.HdfsPlugin'
classname = 'org.elasticsearch.repositories.hdfs.HdfsPlugin'
}

versions << [
'hadoop': '3.4.1'
]

def patched = Attribute.of('patched', Boolean)
def hdfsVersionAttr = Attribute.of('hdfs.major.version', Integer)

configurations {
hdfsFixture2
hdfsFixture3
hdfsFixture2 {
attributes {
attribute(hdfsVersionAttr, 2)
}
}
hdfsFixture3 {
attributes {
attribute(hdfsVersionAttr, 3)
}
}
compileClasspath {
attributes {
attribute(patched, true)
Expand Down Expand Up @@ -83,8 +93,8 @@ dependencies {
yamlRestTestRuntimeOnly "commons-cli:commons-cli:1.5.0"
yamlRestTestRuntimeOnly "org.apache.logging.log4j:log4j-1.2-api:${versions.log4j}"

hdfsFixture2 project(path: ':test:fixtures:hdfs-fixture', configuration: 'shadowedHdfs2')
hdfsFixture3 project(path: ':test:fixtures:hdfs-fixture', configuration: 'shadow')
hdfsFixture2 project(':test:fixtures:hdfs-fixture')
hdfsFixture3 project(':test:fixtures:hdfs-fixture')

attributesSchema {
attribute(patched)
Expand Down
23 changes: 22 additions & 1 deletion test/fixtures/hdfs-fixture/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ apply plugin: 'com.gradleup.shadow'
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

def patched = Attribute.of('patched', Boolean)
def hdfsVersionAttr = Attribute.of('hdfs.major.version', Integer)
configurations {
hdfs2 {
attributes {
Expand All @@ -25,7 +26,26 @@ configurations {
attribute(patched, true)
}
}
consumable("shadowedHdfs2")
consumable("shadowedHdfs2") {
attributes {
attribute(hdfsVersionAttr, 2)
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.LIBRARY))
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, Integer.parseInt(buildParams.minimumRuntimeVersion.getMajorVersion()))
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements, LibraryElements.JAR))
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling, Bundling.EXTERNAL))
}
}
consumable("shadowedHdfs3") {
attributes {
attribute(hdfsVersionAttr, 3)
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.LIBRARY))
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, Integer.parseInt(buildParams.minimumRuntimeVersion.getMajorVersion()))
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements, LibraryElements.JAR))
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling, Bundling.EXTERNAL))
}
}
}

dependencies {
Expand Down Expand Up @@ -154,4 +174,5 @@ tasks.withType(ShadowJar).configureEach {

artifacts {
shadowedHdfs2(hdfs2Jar)
shadowedHdfs3(tasks.named("shadowJar"))
}
8 changes: 0 additions & 8 deletions test/fixtures/krb5kdc-fixture/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ configurations {
all {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
krb5ConfHdfsFile {
canBeConsumed = true
canBeResolved = false
}
krb5KeytabsHdfsDir {
canBeConsumed = true
canBeResolved = false
}
}

dependencies {
Expand Down
10 changes: 9 additions & 1 deletion x-pack/plugin/searchable-snapshots/qa/hdfs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@ apply plugin: 'elasticsearch.internal-java-rest-test'
apply plugin: 'elasticsearch.rest-resources'
apply plugin: 'elasticsearch.internal-available-ports'

configurations {
javaRestTestRuntimeClasspath {
attributes {
attribute(Attribute.of('hdfs.major.version', Integer), 2)
}
}
}

dependencies {
clusterPlugins project(':plugins:repository-hdfs')
javaRestTestImplementation(testArtifact(project(xpackModule('searchable-snapshots'))))
javaRestTestImplementation project(path: ':test:fixtures:hdfs-fixture', configuration:"shadowedHdfs2")
javaRestTestImplementation project(path: ':test:fixtures:hdfs-fixture')
javaRestTestImplementation project(':test:fixtures:krb5kdc-fixture')
javaRestTestRuntimeOnly "com.google.guava:guava:16.0.1"
javaRestTestRuntimeOnly "commons-cli:commons-cli:1.2"
Expand Down
10 changes: 9 additions & 1 deletion x-pack/plugin/snapshot-repo-test-kit/qa/hdfs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,17 @@ import org.elasticsearch.gradle.internal.info.BuildParams
apply plugin: 'elasticsearch.internal-java-rest-test'
apply plugin: 'elasticsearch.rest-resources'

configurations {
javaRestTestRuntimeClasspath {
attributes {
attribute(Attribute.of('hdfs.major.version', Integer), 3)
}
}
}

dependencies {
javaRestTestImplementation testArtifact(project(xpackModule('snapshot-repo-test-kit')))
javaRestTestImplementation project(path: ':test:fixtures:hdfs-fixture', configuration:"shadow")
javaRestTestImplementation project(path: ':test:fixtures:hdfs-fixture')
javaRestTestImplementation project(':test:fixtures:krb5kdc-fixture')
javaRestTestImplementation "org.slf4j:slf4j-api:${versions.slf4j}"
javaRestTestImplementation "org.slf4j:slf4j-simple:${versions.slf4j}"
Expand Down