logstash/qa/integration/build.gradle
Andrea Selva 7395641a43
Fixes to build and run Logstah on JDK 17 (#13306)
This commit applies all the changes needed to run Logstash on JDK 17:
- opens access to module java.base for packages sun.nio.ch and java.io to run the application and to execute the tests
- removes SecurityManager classes used during Logstash startup
- fix exception type catched in JavaKeyStore tampering test

Related to meta issue #13306
2021-10-18 11:13:26 +02:00

84 lines
2.8 KiB
Groovy

/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
description = """Logstash Integration Tests"""
repositories {
mavenCentral()
}
buildscript {
repositories {
mavenCentral()
}
}
dependencies {
testImplementation project(':logstash-core')
testImplementation 'org.assertj:assertj-core:3.8.0'
testImplementation 'junit:junit:4.12'
}
test {
exclude '/**'
}
tasks.register("copyProductionLog4jConfiguration", Copy) {
description "Copy the production log4j config to be tested in QA (qa/integration/fixtures/logs_rollover)"
from "${projectDir}/../../config/log4j2.properties"
into "${projectDir}/fixtures/logs_rollover/"
filter {
// modify rollover policy to make it happen in integration test without need to generate tons of log lines
line -> line
.replace('appender.rolling.policies.size.size = 100MB',
'appender.rolling.policies.size.size = 1KB')
.replace('appender.rolling.filePattern = ${sys:ls.logs}/logstash-plain-%d{yyyy-MM-dd}-%i.log.gz',
'appender.rolling.filePattern = ${sys:ls.logs}/logstash-plain-%d{yyyy-MM-dd}.log')
.replace('appender.routing.pipeline.policy.size = 100MB',
'appender.routing.pipeline.policy.size = 1KB')
}
}
clean {
delete "${projectDir}/fixtures/logs_rollover/log4j2.properties"
}
tasks.register("integrationTests", Test) {
if ((JavaVersion.current().getMajorVersion() as int) >= 17) {
jvmArgs = ['--add-opens', 'java.base/sun.nio.ch=ALL-UNNAMED', '--add-opens', 'java.base/java.io=ALL-UNNAMED']
}
dependsOn copyProductionLog4jConfiguration
inputs.files fileTree("${projectDir}/services")
inputs.files fileTree("${projectDir}/framework")
inputs.files fileTree("${projectDir}/fixtures")
inputs.files fileTree("${projectDir}/specs")
systemProperty 'logstash.core.root.dir', projectDir.absolutePath
include '/org/logstash/integration/RSpecTests.class'
outputs.upToDateWhen {
if (project.hasProperty('integrationTests.rerun')) {
println "Rerunning Integration Tests"
return false
} else {
return true
}
}
}