Skip to content

Commit b72199b

Browse files
committed
fix slow lookup and randomly use underscore docset.yml in tests
1 parent 1d8fa5e commit b72199b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Elastic.Markdown/BuildContext.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ public BuildContext(IFileSystem readFileSystem, IFileSystem writeFileSystem, str
7575
return (rootPath, configurationPath);
7676

7777
configurationPath = rootPath
78-
.EnumerateFiles("docset.yml", SearchOption.AllDirectories)
79-
.OrderByDescending(f => f.Name switch { "docset.yml" => 2, "_docset.yml" => 1, _ => 0 })
78+
.EnumerateFiles("*docset.yml", SearchOption.AllDirectories)
8079
.FirstOrDefault()
8180
?? throw new Exception($"Can not locate docset.yml file in '{rootPath}'");
8281

tests/authoring/Framework/Setup.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace authoring
66

77

8+
open System
89
open System.Collections.Generic
910
open System.IO
1011
open System.IO.Abstractions.TestingHelpers
@@ -53,7 +54,8 @@ type Setup =
5354
)
5455
| _ -> ()
5556

56-
fileSystem.AddFile(Path.Combine(root.FullName, "docset.yml"), MockFileData(yaml.ToString()));
57+
let name = if Random().Next(0, 10) % 2 = 0 then "_docset.yml" else "docset.yml"
58+
fileSystem.AddFile(Path.Combine(root.FullName, name), MockFileData(yaml.ToString()));
5759

5860
static member Generator (files: TestFile seq) : Task<GeneratorResults> =
5961

0 commit comments

Comments
 (0)