Skip to content

Pin locale to deal with flakyness in GCS testing library - #4869

Open
epugh wants to merge 2 commits into
apache:mainfrom
epugh:fix_locale_issue_in_gcs_testing
Open

Pin locale to deal with flakyness in GCS testing library#4869
epugh wants to merge 2 commits into
apache:mainfrom
epugh:fix_locale_issue_in_gcs_testing

Conversation

@epugh

@epugh epugh commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Description

Solr randomized-locale test picked dz (Dzongkha), and Google's FakeStorageRpc (the in-memory GCS test double behind LocalStorageHelper) formats its own internal "now" timestamp using the JVM default locale without forcing ASCII digits. Under dz that produces Tibetan numerals (༢༠༢༦-༠༩-༠༣T༡༢:༥༩:༤༣Z = "2026-09-03T12:59:43Z"), which its own strict RFC3339 parser then can't read back — NumberFormatException → StorageException. This is a bug in the third-party test double, not in Solr's GCS repository code

Solution

Pin the locale to root.

Tests

These tests were failing on main:

./gradlew :solr:modules:gcs-repository:test --tests "org.apache.solr.gcs.GCSBackupRepositoryTest.testCopyIndexFileToCopiesFile" "-Ptests.jvmargs=-XX:TieredStopAtLevel=1 -XX:+UseParallelGC -XX:ActiveProcessorCount=1 -XX:ReservedCodeCacheSize=120m" -Ptests.seed=A7CF46E0A0013828 -Ptests.timeoutSuite=600000! -Ptests.useSecurityManager=true -Ptests.file.encoding=ISO-8859-1

./gradlew :solr:modules:gcs-repository:test --tests "org.apache.solr.gcs.GCSBackupRepositoryTest.testCopyIndexFileToHandlesZeroByteReads" "-Ptests.jvmargs=-XX:TieredStopAtLevel=1 -XX:+UseParallelGC -XX:ActiveProcessorCount=1 -XX:ReservedCodeCacheSize=120m" -Ptests.seed=A7CF46E0A0013828 -Ptests.timeoutSuite=600000! -Ptests.useSecurityManager=true -Ptests.file.encoding=ISO-8859-1

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The implementation skips tests instead of pinning the locale as described and contains null-unsafe exception matching.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Mitigates locale-related failures in the in-memory GCS test library.

Changes:

  • Skips tests when the known date-parsing failure occurs.
  • Rethrows unrelated failures.
  • Adds guarded blob creation for two copy tests.
File summaries
File Description
LocalStorageGCSBackupRepository.java Handles failures during test repository initialization.
GCSBackupRepositoryTest.java Adds locale-failure handling when creating test blobs.
Review details

Suppressed comments (1)

solr/modules/gcs-repository/src/test/org/apache/solr/gcs/GCSBackupRepositoryTest.java:182

  • If a different StorageException has a NumberFormatException cause with no message, this predicate throws NullPointerException instead of rethrowing the genuine failure below. Guard the message before calling contains.
          cause != null
              && e instanceof StorageException
              && cause.getMessage().contains("Invalid date/time format")
              && cause instanceof NumberFormatException);
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +177 to +182
Assume.assumeFalse(
"This test uses a GCS mock library that is incompatible with the current default locale",
cause != null
&& e instanceof StorageException
&& cause.getMessage().contains("Invalid date/time format")
&& cause instanceof NumberFormatException);
Comment on lines +101 to +104
cause != null
&& e instanceof StorageException
&& cause.getMessage().contains("Invalid date/time format")
&& cause instanceof NumberFormatException);

@dsmiley dsmiley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants