Repository: lucenenet Updated Branches: refs/heads/master 6a95ad434 -> 34ef2ce56
BUG: Lucene.Net.TestFramework: Having sequential folder names creates situations where multiple threads are doing operations on the same folder at the same time. Changed implementation to use GetRandomFileName() to append a random string instead of an incremental number. Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/4fdf6723 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/4fdf6723 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/4fdf6723 Branch: refs/heads/master Commit: 4fdf672310ddbc7414956a3f156307184ef342a2 Parents: 6a95ad4 Author: Shad Storhaug <[email protected]> Authored: Fri Sep 15 07:24:01 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Fri Sep 15 07:24:01 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4fdf6723/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs index 1c746ce..b23d0a1 100644 --- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs +++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs @@ -2751,7 +2751,10 @@ namespace Lucene.Net.Util { throw new Exception("Failed to get a temporary name too many times, check your temp directory and consider manually cleaning it: " + System.IO.Path.GetTempPath()); } - f = new DirectoryInfo(Path.Combine(System.IO.Path.GetTempPath(), "LuceneTemp", prefix + "-" + attempt)); + // LUCENENET specific - need to use a random file name instead of a sequential one or two threads may attempt to do + // two operations on a file at the same time. + //f = new DirectoryInfo(Path.Combine(System.IO.Path.GetTempPath(), "LuceneTemp", prefix + "-" + attempt)); + f = new DirectoryInfo(Path.Combine(System.IO.Path.GetTempPath(), "LuceneTemp", prefix + "-" + Path.GetFileNameWithoutExtension(Path.GetRandomFileName()))); try {
