Skip to content

Commit 35fd1a1

Browse files
committed
Updated wipeCluster for YAML tests
1 parent f7b60de commit 35fd1a1

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

tests/Utility.php

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -331,28 +331,10 @@ private static function wipeSnapshots(Client $client): void
331331
]);
332332
foreach ($repos->asArray() as $repository => $value) {
333333
if ($value['type'] === 'fs') {
334-
$response = $client->snapshot()->get([
334+
$client->snapshot()->delete([
335335
'repository' => $repository,
336-
'snapshot' => '_all',
337-
'ignore_unavailable' => true
336+
'snapshot' => '*'
338337
]);
339-
if (isset($response['responses'])) {
340-
$response = $response['responses'][0];
341-
}
342-
if (isset($response['snapshots'])) {
343-
foreach ($response['snapshots'] as $snapshot) {
344-
try {
345-
$client->snapshot()->delete([
346-
'repository' => $repository,
347-
'snapshot' => $snapshot['snapshot']
348-
]);
349-
} catch (ClientResponseException $e) {
350-
if ($e->getCode() !== 404) {
351-
throw $e;
352-
}
353-
}
354-
}
355-
}
356338
}
357339
try {
358340
$client->snapshot()->deleteRepository([
@@ -684,11 +666,24 @@ private static function isXPackTemplate(string $name): bool
684666
if (strpos($name, '.deprecation-') !== false) {
685667
return true;
686668
}
669+
if (strpos($name, '.fleet-') !== false) {
670+
return true;
671+
}
672+
if (strpos($name, 'behavioral_analytics-') !== false) {
673+
return true;
674+
}
675+
if (strpos($name, 'profiling-') !== false) {
676+
return true;
677+
}
678+
if (strpos($name, 'elastic-connectors') !== false) {
679+
return true;
680+
}
687681
switch ($name) {
688682
case ".watches":
689683
case "security_audit_log":
690684
case ".slm-history":
691685
case ".async-search":
686+
case ".profiling-ilm-lock":
692687
case "saml-service-provider":
693688
case "logs":
694689
case "logs-settings":
@@ -704,6 +699,9 @@ private static function isXPackTemplate(string $name): bool
704699
case "logstash-index-template":
705700
case "security-index-template":
706701
case "data-streams-mappings":
702+
case "ecs@dynamic_templates":
703+
case "search-acl-filter":
704+
case ".kibana-reporting":
707705
return true;
708706
default:
709707
return false;
@@ -731,9 +729,16 @@ private static function preserveILMPolicyIds(): array
731729
"90-days-default",
732730
"180-days-default",
733731
"365-days-default",
732+
".fleet-files-ilm-policy",
733+
".fleet-file-data-ilm-policy",
734734
".fleet-actions-results-ilm-policy",
735+
".fleet-file-fromhost-data-ilm-policy",
736+
".fleet-file-fromhost-meta-ilm-policy",
737+
".fleet-file-tohost-data-ilm-policy",
738+
".fleet-file-tohost-meta-ilm-policy",
735739
".deprecation-indexing-ilm-policy",
736-
".monitoring-8-ilm-policy"
740+
".monitoring-8-ilm-policy",
741+
"behavioral_analytics-events-default_policy"
737742
];
738743
}
739744

0 commit comments

Comments
 (0)