Skip to content

Commit

Permalink
Update to jimfs 1.2 (elastic#67120)
Browse files Browse the repository at this point in the history
A new version of this test dependency is finally available, enabling us
to remove a hack from production code we've long carried because of a
bug in that test dependency. This commit upgrades our tests to use
jimfs-1.2.
  • Loading branch information
jasontedor authored Jan 6, 2021
1 parent 8a001d1 commit e31f72e
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 27 deletions.
5 changes: 5 additions & 0 deletions buildSrc/version.properties
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,8 @@ mocksocket = 1.2

# benchmark dependencies
jmh = 1.19

# test dependencies
# when updating this version, also update :qa:evil-tests
jimfs = 1.2
jimfs_guava = 30.1-jre
4 changes: 2 additions & 2 deletions distribution/tools/keystore-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ dependencies {
compileOnly project(":server")
compileOnly project(":libs:elasticsearch-cli")
testImplementation project(":test:framework")
testImplementation 'com.google.jimfs:jimfs:1.1'
testRuntimeOnly 'com.google.guava:guava:18.0'
testImplementation "com.google.jimfs:jimfs:${versions.jimfs}"
testRuntimeOnly "com.google.guava:guava:${versions.jimfs_guava}"
}
6 changes: 3 additions & 3 deletions distribution/tools/plugin-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ dependencies {
api "org.bouncycastle:bcpg-fips:1.0.4"
api "org.bouncycastle:bc-fips:1.0.2"
testImplementation project(":test:framework")
testImplementation 'com.google.jimfs:jimfs:1.1'
testRuntimeOnly 'com.google.guava:guava:18.0'
testImplementation "com.google.jimfs:jimfs:${versions.jimfs}"
testRuntimeOnly "com.google.guava:guava:${versions.jimfs_guava}"
}

tasks.named("dependencyLicenses").configure {
Expand Down Expand Up @@ -67,4 +67,4 @@ tasks.named("thirdPartyAudit").configure {
'org.bouncycastle.jcajce.provider.ProvSunTLSKDF$TLSExtendedMasterSecretGenerator',
'org.bouncycastle.jcajce.provider.ProvSunTLSKDF$TLSExtendedMasterSecretGenerator$2'
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -746,19 +746,6 @@ private Path unzip(Path zip, Path pluginsDir) throws IOException, UserException
private Path stagingDirectory(Path pluginsDir) throws IOException {
try {
return Files.createTempDirectory(pluginsDir, ".installing-", PosixFilePermissions.asFileAttribute(PLUGIN_DIR_PERMS));
} catch (IllegalArgumentException e) {
// Jimfs throws an IAE where it should throw an UOE
// remove when google/jimfs#30 is integrated into Jimfs
// and the Jimfs test dependency is upgraded to include
// this pull request
final StackTraceElement[] elements = e.getStackTrace();
if (elements.length >= 1
&& elements[0].getClassName().equals("com.google.common.jimfs.AttributeService")
&& elements[0].getMethodName().equals("setAttributeInternal")) {
return stagingDirectoryWithoutPosixPermissions(pluginsDir);
} else {
throw e;
}
} catch (UnsupportedOperationException e) {
return stagingDirectoryWithoutPosixPermissions(pluginsDir);
}
Expand Down
13 changes: 11 additions & 2 deletions qa/evil-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'

dependencies {
testImplementation 'com.google.jimfs:jimfs:1.1'
testImplementation "com.google.jimfs:jimfs:1.2"
}

// TODO: give each evil test its own fresh JVM for more isolation.
Expand All @@ -46,7 +46,16 @@ tasks.named("thirdPartyAudit").configure {
'com.google.common.cache.Striped64',
'com.google.common.cache.Striped64$1',
'com.google.common.cache.Striped64$Cell',
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray',
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$1',
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$2',
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$3',
'com.google.common.hash.Striped64',
'com.google.common.hash.Striped64$1',
'com.google.common.hash.Striped64$Cell',
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator',
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator$1'
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator$1',
'com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper',
'com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper$1'
)
}
6 changes: 3 additions & 3 deletions x-pack/plugin/security/cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ dependencies {
compileOnly project(path: xpackModule('core'), configuration: 'default')
api "org.bouncycastle:bcpkix-jdk15on:${versions.bouncycastle}"
api "org.bouncycastle:bcprov-jdk15on:${versions.bouncycastle}"
testImplementation('com.google.jimfs:jimfs:1.1') {
testImplementation("com.google.jimfs:jimfs:${versions.jimfs}") {
// this is provided by the runtime classpath, from the security project
exclude group: 'com.google.guava', module: 'guava'
exclude group: "com.google.guava", module: "guava"
}
testRuntimeOnly 'com.google.guava:guava:19.0'
testRuntimeOnly "com.google.guava:guava:${versions.jimfs_guava}"
testImplementation project(":test:framework")
testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
}
Expand Down
13 changes: 11 additions & 2 deletions x-pack/qa/saml-idp-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ apply plugin: 'elasticsearch.test.fixtures'

dependencies {
testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
testImplementation 'com.google.jimfs:jimfs:1.1'
testImplementation "com.google.jimfs:jimfs:${versions.jimfs}"
}
testFixtures.useFixture ":x-pack:test:idp-fixture"

Expand Down Expand Up @@ -105,8 +105,17 @@ tasks.named("thirdPartyAudit").configure {
'com.google.common.cache.Striped64',
'com.google.common.cache.Striped64$1',
'com.google.common.cache.Striped64$Cell',
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray',
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$1',
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$2',
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$3',
'com.google.common.hash.Striped64',
'com.google.common.hash.Striped64$1',
'com.google.common.hash.Striped64$Cell',
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator',
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator$1'
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator$1',
'com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper',
'com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper$1'
)

ignoreMissingClasses(
Expand Down
4 changes: 2 additions & 2 deletions x-pack/qa/security-tools-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ apply plugin: 'elasticsearch.standalone-test'
dependencies {
testImplementation project(xpackModule('security'))
testImplementation project(path: xpackModule('security'), configuration: 'testArtifacts')
testImplementation 'com.google.jimfs:jimfs:1.1'
testRuntimeOnly 'com.google.guava:guava:16.0.1'
testImplementation "com.google.jimfs:jimfs:${versions.jimfs}"
testRuntimeOnly "com.google.guava:guava:${versions.jimfs_guava}"
}

// add test resources from security, so certificate tool tests can use example certs
Expand Down

0 comments on commit e31f72e

Please sign in to comment.