This is an automated email from the ASF dual-hosted git repository.

dsmiley pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/solr.git

commit 8695e6db42368fb25d910d9a43a34757f35324b9
Author: Eric Pugh <[email protected]>
AuthorDate: Fri Sep 4 07:16:13 2026 -0400

    Pin locale to deal with flakyness in GCS testing library (#4869)
    
    (cherry picked from commit 4da778a7259e103284ee02d60a9e243efe7ee3ce)
---
 .../apache/solr/gcs/GCSBackupRepositoryTest.java   | 26 ++++++++++++++++++++--
 .../solr/gcs/LocalStorageGCSBackupRepository.java  | 15 +++++++------
 2 files changed, 32 insertions(+), 9 deletions(-)

diff --git 
a/solr/modules/gcs-repository/src/test/org/apache/solr/gcs/GCSBackupRepositoryTest.java
 
b/solr/modules/gcs-repository/src/test/org/apache/solr/gcs/GCSBackupRepositoryTest.java
index e4a2e084445..68c825777ae 100644
--- 
a/solr/modules/gcs-repository/src/test/org/apache/solr/gcs/GCSBackupRepositoryTest.java
+++ 
b/solr/modules/gcs-repository/src/test/org/apache/solr/gcs/GCSBackupRepositoryTest.java
@@ -45,6 +45,7 @@ import 
org.apache.solr.cloud.api.collections.AbstractBackupRepositoryTest;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.backup.repository.BackupRepository;
 import org.junit.AfterClass;
+import org.junit.Assume;
 import org.junit.Test;
 
 /** Unit tests for {@link GCSBackupRepository} that use an in-memory Storage 
object */
@@ -123,7 +124,7 @@ public class GCSBackupRepositoryTest extends 
AbstractBackupRepositoryTest {
     GCSBackupRepository repo = createRepositoryWithStorage(realStorage);
     URI sourceDir = repo.resolve(getBaseUri(), "backup");
     BlobId blobId = BlobId.of(bucketName, sourceDir + "/source.dat");
-    realStorage.create(BlobInfo.newBuilder(blobId).build(), data);
+    createBlob(realStorage, blobId, data);
 
     Storage zeroReturningStorage = createZeroReturningStorage(realStorage);
     GCSBackupRepository proxyRepo = 
createRepositoryWithStorage(zeroReturningStorage);
@@ -150,7 +151,7 @@ public class GCSBackupRepositoryTest extends 
AbstractBackupRepositoryTest {
     GCSBackupRepository repo = createRepositoryWithStorage(realStorage);
     URI sourceDir = repo.resolve(getBaseUri(), "backup");
     BlobId blobId = BlobId.of(bucketName, sourceDir + "/source.dat");
-    realStorage.create(BlobInfo.newBuilder(blobId).build(), data);
+    createBlob(realStorage, blobId, data);
 
     try (Directory dest = new ByteBuffersDirectory()) {
       repo.copyIndexFileTo(sourceDir, "source.dat", dest, "dest.dat");
@@ -163,6 +164,27 @@ public class GCSBackupRepositoryTest extends 
AbstractBackupRepositoryTest {
     }
   }
 
+  /**
+   * Creates a blob, skipping (rather than failing) the test if the current 
default locale trips the
+   * known FakeStorageRpc/RFC3339 date-parsing bug - see {@link
+   * LocalStorageGCSBackupRepository#initializeBackupLocation()} for the same 
pattern.
+   */
+  private static void createBlob(Storage storage, BlobId blobId, byte[] data) {
+    try {
+      storage.create(BlobInfo.newBuilder(blobId).build(), data);
+    } catch (Exception e) {
+      final Throwable cause = e.getCause();
+      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);
+      // Not the known locale incompatibility - a genuine failure, so don't 
swallow it.
+      throw new RuntimeException(e);
+    }
+  }
+
   /** Storage proxy that fails on {@code reader} so we can assert copy errors 
are propagated. */
   private static Storage createFailingStorage() {
     Storage delegate = LocalStorageHelper.customOptions(false).getService();
diff --git 
a/solr/modules/gcs-repository/src/test/org/apache/solr/gcs/LocalStorageGCSBackupRepository.java
 
b/solr/modules/gcs-repository/src/test/org/apache/solr/gcs/LocalStorageGCSBackupRepository.java
index fc26a188f87..da54e135de4 100644
--- 
a/solr/modules/gcs-repository/src/test/org/apache/solr/gcs/LocalStorageGCSBackupRepository.java
+++ 
b/solr/modules/gcs-repository/src/test/org/apache/solr/gcs/LocalStorageGCSBackupRepository.java
@@ -96,13 +96,14 @@ public class LocalStorageGCSBackupRepository extends 
GCSBackupRepository {
       createDirectory(baseLocationUri);
     } catch (Exception e) {
       final Throwable cause = e.getCause();
-      if (cause != null) {
-        assumeFalse(
-            "This test uses a GCS mock library that is incompatible with the 
current default locale",
-            e instanceof StorageException
-                && cause.getMessage().contains("Invalid date/time format")
-                && cause instanceof NumberFormatException);
-      }
+      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);
+      // Not the known locale incompatibility - a genuine failure, so don't 
swallow it.
+      throw new RuntimeException(e);
     }
   }
 }

Reply via email to