1
0
mirror of https://github.com/google/nomulus synced 2026-06-01 04:26:34 +00:00
Files
nomulus/integration/build.gradle
Ben McIlwain c5abd2a7c9 Uncap most remaining dependencies (#3073)
This commit relaxes the upper bounds on several dependencies that were previously hardcapped to specific versions:
- com.google.protobuf to [3.25.5,) and [3.17.3,)
- org.apache.beam to [2.72.0,)
- io.github.ss-bhatt to [1.0.0,)
- io.protostuff to [1.8.0,)
- redis.clients:jedis to [7.4.1,)
- org.junit.jupiter and org.junit.platform to [5.6.2,) and [1.6.2,)
- org.jcommander to [2.0,)
- org.jline to [3.0,)
- jakarta.servlet to [6.0,)

Upgrading to the modern versions of jline introduced a breaking change where DefaultParser().parse(line, line.length()) strips trailing spaces when using the default ParseContext.UNSPECIFIED. This caused the autocompletion to misbehave and tests to fail. This commit fixes ShellCommandTest.java by explicitly passing ParseContext.COMPLETE when parsing test strings to perfectly mimic the real-world JLine completion context.

Additionally, SqlIntegrationTestSuite was migrated to JUnit 5's @Suite annotation, fixing a NoClassDefFoundError introduced by uncapping the JUnit Platform dependencies, and the test suite was re-integrated into the standard :build lifecycle.

The following dependencies remain explicitly capped:
1. Hibernate & Jakarta Persistence (Blocked by -Werror):
   These are held back because newer Jakarta Persistence versions deprecate executeUpdate(), setMaxResults(), and getResultStream() on Query.
   - org.hibernate.orm:hibernate-core:7.3.4.Final
   - org.hibernate.orm:hibernate-hikaricp:7.3.4.Final
   - org.hibernate.orm:hibernate-ant:7.3.4.Final
   - jakarta.persistence:jakarta.persistence-api:[3.2.0,4.0.0)

2. Netty (Blocked by abandoned v5):
   Netty 5.0.0 was an experimental release abandoned in 2015. We explicitly cap beneath 5.0.0 so Gradle doesn't resolve dead-end alphas.
   - io.netty:netty-codec-http:[4.1.59.Final, 5.0.0)!!
   - io.netty:netty-codec:[4.1.59.Final, 5.0.0)!!
   - io.netty:netty-common:[4.1.59.Final, 5.0.0)!!
   - io.netty:netty-handler:[4.1.59.Final, 5.0.0)!!
   - io.netty:netty-transport:[4.1.59.Final, 5.0.0)!!
   - io.netty:netty-buffer:[4.1.59.Final, 5.0.0)!!

3. Google API Services:
   Capped beneath their respective unstable beta/v1b4 versions:
   - com.google.apis:google-api-services-dataflow:[v1b3-rev20240430-2.0.0, v1b4)!!
   - com.google.apis:google-api-services-dns:[v1-rev20240419-2.0.0, v2beta)

The lockfiles have been fully regenerated and all test suites ran successfully against the latest available transitive versions.
2026-05-30 02:33:02 +00:00

112 lines
4.0 KiB
Groovy

// Copyright 2019 The Nomulus Authors. All Rights Reserved.
//
// 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.
// This source-less project is used to run cross-release server/SQL integration
// tests. See the README.md file in this folder for more information.
import static com.google.common.base.Preconditions.checkArgument
import static com.google.common.base.Strings.isNullOrEmpty
if (schema_env == '' || nomulus_env == '') {
return
}
def USE_LOCAL = 'local'
if (schema_env != USE_LOCAL || nomulus_env != USE_LOCAL) {
checkArgument(
!isNullOrEmpty(schemaTestArtifactsDir),
'The schemaTestArtifactsDir is required when deployed jars are needed.')
}
def testUberJarName = ''
// Might need to add this back if we re-add nebula-lint
// gradleLint.ignore('unused-dependency') {
dependencies {
if (schema_env == USE_LOCAL) {
testRuntimeOnly project(path: ':db', configuration: 'schema')
} else {
testRuntimeOnly files("${project.schemaTestArtifactsDir}/schema.${schema_env}.jar")
}
if (nomulus_env == USE_LOCAL) {
testRuntimeOnly project(path: ':core', configuration: 'nomulus_test')
testUberJarName = 'nomulus-tests-alldeps.jar'
} else {
testRuntimeOnly files("${project.schemaTestArtifactsDir}/nomulus-public.${nomulus_env}.jar")
testRuntimeOnly files("${project.schemaTestArtifactsDir}/nomulus-tests-alldeps.${nomulus_env}.jar")
testUberJarName = "nomulus-tests-alldeps.${nomulus_env}.jar"
}
}
// }
configurations.testRuntimeOnly.transitive = false
def unpackedTestDir = "${projectDir}/build/unpackedTests/${nomulus_env}"
// Extracts SqlIntegrationTestSuite.class to a temp folder. Gradle's test
// runner only looks for runnable tests on a regular file system. However,
// it can load member classes of test suites from jars.
task extractSqlIntegrationTestSuite (type: Copy) {
doFirst {
file(unpackedTestDir).mkdirs()
}
outputs.dir unpackedTestDir
from zipTree(
configurations.testRuntimeClasspath
.filter { it.name == testUberJarName}
.singleFile).matching {
include 'google/registry/**/SqlIntegrationTestSuite.class'
}
into unpackedTestDir
includeEmptyDirs = false
if (nomulus_env == USE_LOCAL) {
dependsOn ':core:testUberJar'
}
}
// TODO(weiminyu): inherit from FilteringTest (defined in :core).
task sqlIntegrationTest(type: Test) {
// Use JUnit 5 Platform for local tests since the suite has been migrated to @Suite.
// However, Kokoro runs cross-version compatibility tests against older, deployed nomulus
// artifacts that were compiled using the legacy JUnit 4 @RunWith(JUnitPlatform.class) runner.
// We must fall back to the classic JUnit 4 runner for those remote environments to prevent
// NoClassDefFoundError and test discovery failures.
// TODO: Remove this fallback and use useJUnitPlatform() unconditionally once all deployed
// environments (sandbox and production) are running a Nomulus release built after the
// JUnit 5 @Suite migration.
if (nomulus_env == USE_LOCAL) {
useJUnitPlatform()
} else {
useJUnit()
}
testClassesDirs = files(unpackedTestDir)
classpath = configurations.testRuntimeClasspath
include 'google/registry/schema/integration/SqlIntegrationTestSuite.*'
dependsOn extractSqlIntegrationTestSuite
finalizedBy tasks.create('removeUnpackedTests') {
doLast {
delete file(unpackedTestDir)
}
}
// Disable incremental build/test since Gradle cannot detect changes
// in dependencies on its own. Will not fix since this test is typically
// run once (in presubmit or ci tests).
outputs.upToDateWhen { false }
}