paulirwin commented on code in PR #948:
URL: https://github.com/apache/lucenenet/pull/948#discussion_r1828294249


##########
src/Lucene.Net.Tests/Index/TestIndexWriter.cs:
##########
@@ -2575,6 +2589,49 @@ public virtual void TestGetCommitData()
             dir.Dispose();
         }
 
+        // LUCENENET-specific: backport fix and test from Lucene 9.9.0 
(lucene#12626, lucene#12637)
+        [Test]
+        public void TestGetCommitDataFromOldSnapshot()
+        {
+            Directory dir = NewDirectory();
+            IndexWriter writer = new IndexWriter(dir, 
NewSnapshotIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random)));
+            // LUCENENET TODO: in a post-4.8 port, this should use 
SetLiveCommitData
+            writer.SetCommitData(new Dictionary<string, string>
+            {
+                { "key", "value" },
+            });
+            assertEquals("value", GetLiveCommitData(writer)["key"]);
+            writer.Commit();
+            // Snapshot this commit to open later
+            IndexCommit indexCommit =
+                
((SnapshotDeletionPolicy)writer.Config.IndexDeletionPolicy).Snapshot();
+            writer.Dispose();
+
+            // Modify the commit data and commit on close so the most recent 
commit data is different
+            writer = new IndexWriter(dir, 
NewSnapshotIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random)));

Review Comment:
   Tests pass with null, so made that change.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to