You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ju...@apache.org on 2022/03/20 04:27:12 UTC

[lucene] branch branch_9_1 updated: LUCENE-9905: Fix check in TestPerFieldKnnVectorsFormat#testMergeUsesNewFormat

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

julietibs pushed a commit to branch branch_9_1
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/branch_9_1 by this push:
     new fcacd22  LUCENE-9905: Fix check in TestPerFieldKnnVectorsFormat#testMergeUsesNewFormat
fcacd22 is described below

commit fcacd22a80565758155a6cb6973a5ca92918d957
Author: Julie Tibshirani <ju...@apache.org>
AuthorDate: Fri Mar 18 15:38:30 2022 -0700

    LUCENE-9905: Fix check in TestPerFieldKnnVectorsFormat#testMergeUsesNewFormat
    
    Before the assertion checked if two sets were equal, which resulted in rare
    failures. Now we use 'contains' from hamcrest matchers.
---
 .../apache/lucene/codecs/perfield/TestPerFieldKnnVectorsFormat.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lucene/core/src/test/org/apache/lucene/codecs/perfield/TestPerFieldKnnVectorsFormat.java b/lucene/core/src/test/org/apache/lucene/codecs/perfield/TestPerFieldKnnVectorsFormat.java
index 6468be5..744ec52 100644
--- a/lucene/core/src/test/org/apache/lucene/codecs/perfield/TestPerFieldKnnVectorsFormat.java
+++ b/lucene/core/src/test/org/apache/lucene/codecs/perfield/TestPerFieldKnnVectorsFormat.java
@@ -16,6 +16,7 @@
  */
 package org.apache.lucene.codecs.perfield;
 
+import static org.hamcrest.Matchers.contains;
 import static org.hamcrest.Matchers.equalTo;
 
 import java.io.IOException;
@@ -154,8 +155,8 @@ public class TestPerFieldKnnVectorsFormat extends BaseKnnVectorsFormatTestCase {
       }
 
       // Check that the new format was used while merging
-      MatcherAssert.assertThat(format1.fieldsWritten, equalTo(Set.of("field1")));
-      MatcherAssert.assertThat(format2.fieldsWritten, equalTo(Set.of("field2")));
+      MatcherAssert.assertThat(format1.fieldsWritten, contains("field1"));
+      MatcherAssert.assertThat(format2.fieldsWritten, contains("field2"));
     }
   }