Skip to content

Commit e46589c

Browse files
authored
Fix broken yaml test bootstrap (#5213)
Causing all the xpack tests to fail.
1 parent be56367 commit e46589c

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tests/Tests.YamlRunner/TestSuiteBootstrap.fs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,18 @@ let DefaultSetup : Operation list = [Actions("Setup", fun (client, suite) ->
2323
let deleteAll () =
2424
let dp = DeleteIndexRequestParameters()
2525
dp.SetQueryString("expand_wildcards", "open,closed,hidden")
26-
client.Indices.Delete<DynamicResponse>("*", dp)
26+
client.Indices.Delete<DynamicResponse>("*,-.ds-ilm-history-*", dp)
2727
let templates () =
28-
client.Cat.Templates<StringResponse>("*", CatTemplatesRequestParameters(Headers=["name"].ToArray()))
28+
client.Cat.Templates<StringResponse>("*", CatTemplatesRequestParameters(Headers=["name";"order"].ToArray()))
2929
.Body.Split("\n")
30-
|> Seq.filter(fun f -> not(String.IsNullOrWhiteSpace(f)) && not(f.StartsWith(".")) && f <> "security-audit-log")
30+
|> Seq.map(fun line -> line.Split(" ", StringSplitOptions.RemoveEmptyEntries))
31+
|> Seq.filter(fun line -> line.Length = 2)
32+
|> Seq.map(fun tokens -> tokens.[0], Int32.Parse(tokens.[1]))
33+
//assume templates with order 100 or higher are defaults
34+
|> Seq.filter(fun (_, order) -> order < 100)
35+
|> Seq.filter(fun (name, _) -> not(String.IsNullOrWhiteSpace(name)) && not(name.StartsWith(".")) && name <> "security-audit-log")
3136
//TODO template does not accept comma separated list but is documented as such
32-
|> Seq.map(fun template ->
37+
|> Seq.map(fun (template, _) ->
3338
let result = client.Indices.DeleteTemplateForAll<DynamicResponse>(template)
3439
match result.Success with
3540
| true -> result
@@ -155,7 +160,7 @@ let DefaultSetup : Operation list = [Actions("Setup", fun (client, suite) ->
155160
let indices =
156161
let dp = DeleteIndexRequestParameters()
157162
dp.SetQueryString("expand_wildcards", "open,closed,hidden")
158-
client.Indices.Delete<DynamicResponse>("*", dp)
163+
client.Indices.Delete<DynamicResponse>("*,-.ds-ilm-history-*", dp)
159164
yield indices
160165

161166
let data = PostData.String @"{""password"":""x-pack-test-password"", ""roles"":[""superuser""]}"

0 commit comments

Comments
 (0)