/* * Copyright 2019 ConsenSys AG. * * Licensed 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. */ plugins { id 'org.web3j' version '4.11.1' id 'org.web3j.solidity' version '0.4.1' } web3j { generatedPackageName = 'org.hyperledger.besu.tests.web3j.generated' } sourceSets.main.solidity.srcDirs = ["$projectDir/contracts"] solidity { resolvePackages = false // TODO: remove the forced version, when DEV network is upgraded to support latest forks version '0.8.19' } dependencies { api 'org.slf4j:slf4j-api' implementation project(':crypto:algorithms') testImplementation project(':acceptance-tests:dsl') testImplementation project(':acceptance-tests:test-plugins') testImplementation project(':besu') testImplementation project(':config') testImplementation project(':consensus:clique') testImplementation project(':datatypes') testImplementation project(':enclave') testImplementation project(':ethereum:api') testImplementation project(':ethereum:core') testImplementation project(path: ':ethereum:core', configuration: 'testSupportArtifacts') testImplementation project(':ethereum:p2p') testImplementation project(':ethereum:permissioning') testImplementation project(':ethereum:rlp') testImplementation project(':metrics:core') testImplementation project(':plugin-api') testImplementation project(':privacy-contracts') testImplementation project(':testutil') testImplementation project(':util') testImplementation 'commons-io:commons-io' testImplementation 'io.grpc:grpc-all' testImplementation 'io.grpc:grpc-core' testImplementation 'io.grpc:grpc-netty' testImplementation 'io.grpc:grpc-stub' testImplementation 'io.opentelemetry:opentelemetry-extension-trace-propagators' testImplementation 'io.opentelemetry.instrumentation:opentelemetry-okhttp-3.0' testImplementation 'io.netty:netty-all' testImplementation 'io.opentelemetry:opentelemetry-api' testImplementation 'io.opentelemetry:opentelemetry-exporter-otlp' testImplementation 'io.opentelemetry.proto:opentelemetry-proto' testImplementation 'io.opentelemetry:opentelemetry-sdk' testImplementation 'io.opentelemetry:opentelemetry-sdk-trace' testImplementation 'io.opentracing.contrib:opentracing-okhttp3' testImplementation 'io.opentracing:opentracing-api' testImplementation 'io.opentracing:opentracing-util' testImplementation 'io.vertx:vertx-core' testImplementation 'junit:junit' testImplementation 'org.apache.commons:commons-compress' testImplementation 'org.apache.logging.log4j:log4j-core' testImplementation 'io.tmio:tuweni-crypto' testImplementation 'org.assertj:assertj-core' testImplementation 'org.awaitility:awaitility' testImplementation 'org.junit.jupiter:junit-jupiter' testImplementation 'org.testcontainers:testcontainers' testImplementation 'org.web3j:abi' testImplementation 'org.web3j:besu' testImplementation 'org.web3j:core' testImplementation 'org.wiremock:wiremock' testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' } test.enabled = false sourceSets { test { resources { srcDirs "${rootDir}/acceptance-tests/test-plugins/build/libs" } } } processTestResources.dependsOn(':acceptance-tests:test-plugins:testPluginsJar',':acceptance-tests:test-plugins:jar') task acceptanceTest(type: Test) { inputs.property "integration.date", LocalTime.now() // so it runs at every invocation useJUnitPlatform {} dependsOn(rootProject.installDist) setSystemProperties(test.getSystemProperties()) systemProperty 'acctests.runBesuAsProcess', 'true' systemProperty 'java.security.properties', "${buildDir}/resources/test/acceptanceTesting.security" mustRunAfter rootProject.subprojects*.test description = 'Runs ALL Besu acceptance tests (mainnet and non-mainnet).' group = 'verification' jvmArgs "-XX:ErrorFile=${buildDir}/jvmErrorLogs/java_err_pid%p.log" testLogging { exceptionFormat = 'full' showStackTraces = true showStandardStreams = Boolean.getBoolean('acctests.showStandardStreams') showExceptions = true showCauses = true } doFirst { mkdir "${buildDir}/jvmErrorLogs" } } task acceptanceTestMainnet(type: Test) { inputs.property "integration.date", LocalTime.now() // so it runs at every invocation exclude '**/bft/**' exclude '**/clique/**' exclude '**/permissioning/**' exclude '**/privacy/**' useJUnitPlatform {} dependsOn(rootProject.installDist) setSystemProperties(test.getSystemProperties()) systemProperty 'acctests.runBesuAsProcess', 'true' systemProperty 'java.security.properties', "${buildDir}/resources/test/acceptanceTesting.security" mustRunAfter rootProject.subprojects*.test description = 'Runs MAINNET Besu acceptance tests (excluding permissioning, privacy and some other stable features).' group = 'verification' jvmArgs "-XX:ErrorFile=${buildDir}/jvmErrorLogs/java_err_pid%p.log" testLogging { exceptionFormat = 'full' showStackTraces = true showStandardStreams = Boolean.getBoolean('acctests.showStandardStreams') showExceptions = true showCauses = true } doFirst { mkdir "${buildDir}/jvmErrorLogs" } } task acceptanceTestNotPrivacy(type: Test) { inputs.property "integration.date", LocalTime.now() // so it runs at every invocation exclude '**/privacy/**' useJUnitPlatform {} dependsOn(rootProject.installDist) setSystemProperties(test.getSystemProperties()) systemProperty 'acctests.runBesuAsProcess', 'true' systemProperty 'java.security.properties', "${buildDir}/resources/test/acceptanceTesting.security" mustRunAfter rootProject.subprojects*.test description = 'Runs MAINNET Besu acceptance tests (excluding privacy since they run nightly, and are being refactored).' group = 'verification' jvmArgs "-XX:ErrorFile=${buildDir}/jvmErrorLogs/java_err_pid%p.log" testLogging { exceptionFormat = 'full' showStackTraces = true showStandardStreams = Boolean.getBoolean('acctests.showStandardStreams') showExceptions = true showCauses = true } doFirst { mkdir "${buildDir}/jvmErrorLogs" } } task acceptanceTestCliqueBft(type: Test) { inputs.property "integration.date", LocalTime.now() // so it runs at every invocation include '**/bft/**' include '**/clique/**' useJUnitPlatform {} dependsOn(rootProject.installDist) setSystemProperties(test.getSystemProperties()) systemProperty 'acctests.runBesuAsProcess', 'true' systemProperty 'java.security.properties', "${buildDir}/resources/test/acceptanceTesting.security" mustRunAfter rootProject.subprojects*.test description = 'Runs Clique and BFT Besu acceptance tests.' group = 'verification' jvmArgs "-XX:ErrorFile=${buildDir}/jvmErrorLogs/java_err_pid%p.log" testLogging { exceptionFormat = 'full' showStackTraces = true showStandardStreams = Boolean.getBoolean('acctests.showStandardStreams') showExceptions = true showCauses = true } doFirst { mkdir "${buildDir}/jvmErrorLogs" } } task acceptanceTestPrivacy(type: Test) { inputs.property "integration.date", LocalTime.now() // so it runs at every invocation include '**/privacy/**' useJUnitPlatform {} dependsOn(rootProject.installDist) setSystemProperties(test.getSystemProperties()) systemProperty 'acctests.runBesuAsProcess', 'true' systemProperty 'java.security.properties', "${buildDir}/resources/test/acceptanceTesting.security" mustRunAfter rootProject.subprojects*.test description = 'Runs Privacy Besu acceptance tests.' group = 'verification' jvmArgs "-XX:ErrorFile=${buildDir}/jvmErrorLogs/java_err_pid%p.log" testLogging { exceptionFormat = 'full' showStackTraces = true showStandardStreams = Boolean.getBoolean('acctests.showStandardStreams') showExceptions = true showCauses = true } doFirst { mkdir "${buildDir}/jvmErrorLogs" } } task acceptanceTestPermissioning(type: Test) { inputs.property "integration.date", LocalTime.now() // so it runs at every invocation include '**/permissioning/**' useJUnitPlatform {} dependsOn(rootProject.installDist) setSystemProperties(test.getSystemProperties()) systemProperty 'acctests.runBesuAsProcess', 'true' systemProperty 'java.security.properties', "${buildDir}/resources/test/acceptanceTesting.security" mustRunAfter rootProject.subprojects*.test description = 'Runs Permissioning Besu acceptance tests.' group = 'verification' jvmArgs "-XX:ErrorFile=${buildDir}/jvmErrorLogs/java_err_pid%p.log" testLogging { exceptionFormat = 'full' showStackTraces = true showStandardStreams = Boolean.getBoolean('acctests.showStandardStreams') showExceptions = true showCauses = true } doFirst { mkdir "${buildDir}/jvmErrorLogs" } } // temporary solution to get a list of tests // Gradle >8.3 has a supported test dry-run option to achieve the same result task listAcceptanceTestNotPrivacy { doLast { def testExecutionSpec = tasks.getByName("acceptanceTestNotPrivacy") as Test def processor = new org.gradle.api.internal.tasks.testing.TestClassProcessor() { void startProcessing(org.gradle.api.internal.tasks.testing.TestResultProcessor processor) {} void stop() {} void stopNow() {} void processTestClass(org.gradle.api.internal.tasks.testing.TestClassRunInfo info) { def splitName = info.getTestClassName().split("\\."); def testClassName = splitName[splitName.length-1]; if(testClassName.endsWith("Test") && !testClassName.startsWith("Abstract")) { println(info.getTestClassName()) } } } def detector = new org.gradle.api.internal.tasks.testing.detection.DefaultTestClassScanner(testExecutionSpec.getCandidateClassFiles(), testExecutionSpec.getTestFramework().getDetector()?.tap { setTestClasses(testExecutionSpec.getTestClassesDirs().getFiles()) setTestClasspath(Collections.unmodifiableSet(testExecutionSpec.getClasspath().getFiles())) }, processor) detector.run() } }