Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mute the minor version warning https://github.com/protocolbuffers/pro… #18923

Merged
merged 1 commit into from
Oct 21, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,6 @@ private static void validateProtobufGencodeVersionImpl(
"Detected incompatible Protobuf Gencode/Runtime versions when loading %s: gencode %s,"
+ " runtime %s. Runtime version cannot be older than the linked gencode version.",
location, gencodeVersionString, VERSION_STRING));
} else if (MINOR > minor || PATCH > patch) {
logger.warning(
String.format(
" Protobuf gencode version %s is older than the runtime version %s at %s. Please"
+ " avoid checked-in Protobuf gencode that can be obsolete.",
gencodeVersionString, VERSION_STRING, location));
}

// Check that runtime version suffix is the same as the gencode version suffix.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,23 +146,6 @@ public void versionValidation_differentVesionSuffixDisallowed() {
+ " testing.Foo");
}

@Test
public void versionValidation_warnOlderGencodeVersion() {
TestUtil.TestLogHandler logHandler = new TestUtil.TestLogHandler();
Logger logger = Logger.getLogger(RuntimeVersion.class.getName());
logger.addHandler(logHandler);
RuntimeVersion.validateProtobufGencodeVersion(
RuntimeVersion.DOMAIN,
RuntimeVersion.MAJOR,
RuntimeVersion.MINOR - 1,
RuntimeVersion.PATCH,
RuntimeVersion.SUFFIX,
"dummy");
assertThat(logHandler.getStoredLogRecords()).hasSize(1);
assertThat(logHandler.getStoredLogRecords().get(0).getMessage())
.contains("Please avoid checked-in Protobuf gencode that can be obsolete.");
}

@Test
public void versionValidation_gencodeOneMajorVersionOlderWarning() {
TestUtil.TestLogHandler logHandler = new TestUtil.TestLogHandler();
Expand Down
16 changes: 0 additions & 16 deletions python/google/protobuf/internal/runtime_version_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,22 +118,6 @@ def test_different_suffix_disallowed(self):
'foo.proto',
)

def test_gencode_older_than_runtime_version_warning(self):
with self.assertWarnsRegex(
Warning,
expected_regex=(
'Please avoid checked-in Protobuf gencode that can be obsolete.'
),
):
runtime_version.ValidateProtobufRuntimeVersion(
runtime_version.DOMAIN,
runtime_version.MAJOR,
runtime_version.MINOR - 1,
runtime_version.PATCH,
runtime_version.SUFFIX,
'foo.proto',
)

def test_gencode_one_major_version_older_warning(self):
with self.assertWarnsRegex(
Warning, expected_regex='is exactly one major version older'
Expand Down
6 changes: 0 additions & 6 deletions python/google/protobuf/runtime_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,6 @@ def ValidateProtobufRuntimeVersion(
f' {location}: gencode {gen_version} runtime {version}. Runtime version'
f' cannot be older than the linked gencode version. {error_prompt}'
)
elif MINOR > gen_minor or PATCH > gen_patch:
warnings.warn(
'Protobuf gencode version %s is older than the runtime version %s at'
' %s. Please avoid checked-in Protobuf gencode that can be obsolete.'
% (gen_version, version, location)
)

if gen_suffix != SUFFIX:
_ReportVersionError(
Expand Down
Loading