You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "dweiss (via GitHub)" <gi...@apache.org> on 2023/04/04 05:59:01 UTC
[GitHub] [lucene] dweiss commented on a diff in pull request #12223: Ignore a test in TestDocumentsWriterDeleteQueue
dweiss commented on code in PR #12223:
URL: https://github.com/apache/lucene/pull/12223#discussion_r1156766765
##########
lucene/core/src/test/org/apache/lucene/index/TestDocumentsWriterDeleteQueue.java:
##########
@@ -30,10 +30,13 @@
import org.apache.lucene.tests.util.LuceneTestCase;
import org.apache.lucene.util.BytesRefBuilder;
import org.apache.lucene.util.ThreadInterruptedException;
+import org.junit.Ignore;
/** Unit test for {@link DocumentsWriterDeleteQueue} */
public class TestDocumentsWriterDeleteQueue extends LuceneTestCase {
+ /* Ignored because System.gc() is not reliable */
Review Comment:
System.gc() is reliable: its contract says it does not have to be synchronous (or may not invoke garbage collector at all). :)
Perhaps a better way than to ignore the test would be to write the test so that it's aware of the number of times the gc ran? There are JMX beans that may be helpful here - you could invoke gc and then check the number of objects pending finalization; once it's dropped, proceed to check the test's assumptions.
https://docs.oracle.com/javase/7/docs/api/java/lang/management/MemoryMXBean.html
This said, I don't think any test will be 100% reliable because of the very nature of weak references and the liberty the JVM has in wiping them out, so perhaps it's a good idea to remove the test altogether (rather than marking it ignored)?
--
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: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org