# ES test java.io.IOException: Could not remove the following files

**URL:** <https://discuss.elastic.co/t/es-test-java-io-ioexception-could-not-remove-the-following-files/197588>\
**Category:** Elasticsearch\
**Created:** [August 31, 2019, 10:11am UTC](https://discuss.elastic.co/t/es-test-java-io-ioexception-could-not-remove-the-following-files/197588 "2019-08-31T10:11:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![111201](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/111201/32/53403_2.png) [@111201](https://discuss.elastic.co/u/111201)\
**Post date:** [August 31, 2019, 10:11am UTC](https://discuss.elastic.co/t/es-test-java-io-ioexception-could-not-remove-the-following-files/197588/1 "2019-08-31T10:11:36Z")

</div>

when I test EncryptDirectoryWrapperTest which extends BaseDirectoryTestCase, it shows error:

**java.io.IOException: Could not remove the following files (in the order of attempts):**  
C:\Users\anthonypeng\AppData\Local\Temp\org.noop.essecure.store.encrypt.EncryptDirectoryWrapperTest\_4F7D51BC9DD97FD6-001\testCopy-001: java.nio.file.DirectoryNotEmptyException: C:\Users\anthonypeng\AppData\Local\Temp\org.noop.essecure.store.encrypt.EncryptDirectoryWrapperTest\_4F7D51BC9DD97FD6-001\testCopy-001  
C:\Users\anthonypeng\AppData\Local\Temp\org.noop.essecure.store.encrypt.EncryptDirectoryWrapperTest\_4F7D51BC9DD97FD6-001\testCopy-001\_1.tim: java.nio.file.AccessDeniedException: C:\Users\anthonypeng\AppData\Local\Temp\org.noop.essecure.store.encrypt.EncryptDirectoryWrapperTest\_4F7D51BC9DD97FD6-001\testCopy-001\_1.tim  
C:\Users\anthonypeng\AppData\Local\Temp\org.noop.essecure.store.encrypt.EncryptDirectoryWrapperTest\_4F7D51BC9DD97FD6-001: java.nio.file.DirectoryNotEmptyException: C:\Users\anthonypeng\AppData\Local\Temp\org.noop.essecure.store.encrypt.EncryptDirectoryWrapperTest\_4F7D51BC9DD97FD6-001

```auto
at __randomizedtesting.SeedInfo.seed([4F7D51BC9DD97FD6]:0)
at org.apache.lucene.util.IOUtils.rm(IOUtils.java:329)
at org.apache.lucene.util.TestRuleTemporaryFilesCleanup.afterAlways(TestRuleTemporaryFilesCleanup.java:216)
at com.carrotsearch.randomizedtesting.rules.TestRuleAdapter$1.afterAlways(TestRuleAdapter.java:31)
at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:43)
at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
at org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
at org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:54)
at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
at java.base/java.lang.Thread.run(Thread.java:844)

How to make this test pass ?
thanks!
```

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [September 2, 2019, 8:37am UTC](https://discuss.elastic.co/t/es-test-java-io-ioexception-could-not-remove-the-following-files/197588/2 "2019-09-02T08:37:15Z")

</div>

I'm sorry but `EncryptDirectoryWrapperTest` does not seem to be part of the Elasticsearch source tree, where is this class coming from? If it is from another product or plugin, you might want to to ask in that specific forum.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 30, 2019, 8:37am UTC](https://discuss.elastic.co/t/es-test-java-io-ioexception-could-not-remove-the-following-files/197588/3 "2019-09-30T08:37:18Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
