You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by kr...@apache.org on 2022/10/18 14:31:29 UTC

[solr] branch branch_9x updated: SOLR-16467: Add check for working locale in TestSolrVersion (#1083)

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

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


The following commit(s) were added to refs/heads/branch_9x by this push:
     new 8dff462430b SOLR-16467: Add check for working locale in TestSolrVersion (#1083)
8dff462430b is described below

commit 8dff462430b7dcc8fc443f7a03a590136e5f70d2
Author: Kevin Risden <ri...@users.noreply.github.com>
AuthorDate: Mon Oct 17 13:31:37 2022 -0400

    SOLR-16467: Add check for working locale in TestSolrVersion (#1083)
---
 .../src/test/org/apache/solr/util/TestSolrVersion.java   | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/solr/core/src/test/org/apache/solr/util/TestSolrVersion.java b/solr/core/src/test/org/apache/solr/util/TestSolrVersion.java
index 1a43e7cab71..93822e83846 100644
--- a/solr/core/src/test/org/apache/solr/util/TestSolrVersion.java
+++ b/solr/core/src/test/org/apache/solr/util/TestSolrVersion.java
@@ -16,12 +16,28 @@
  */
 package org.apache.solr.util;
 
+import java.util.Locale;
 import org.apache.solr.SolrTestCase;
+import org.apache.solr.SolrTestCaseJ4;
+import org.junit.BeforeClass;
 import org.semver4j.SemverException;
 
 public class TestSolrVersion extends SolrTestCase {
   private static final SolrVersion SOLR_9_0_1 = SolrVersion.valueOf("9.0.1");
 
+  @SuppressWarnings("AssertionFailureIgnored")
+  @BeforeClass
+  public static void beforeClass() {
+    // Checks that semver4j works with configured locale */
+    try {
+      assertTrue(SOLR_9_0_1.satisfies("~9.0"));
+    } catch (AssertionError e) {
+      SolrTestCaseJ4.assumeNoException(
+          "See SOLR-16467 - semver4j doesn't work with " + Locale.getDefault().toLanguageTag(),
+          new Exception(e));
+    }
+  }
+
   public void testToString() {
     assertEquals("9.0.0", SolrVersion.forIntegers(9, 0, 0).toString());
   }