Skip to content

Commit 3576f28

Browse files
committed
Fixed issue on wipeSnapshots + removed TEST_SUITE in getHost()
1 parent 9ba5bec commit 3576f28

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

tests/Elasticsearch/Tests/Utility.php

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,7 @@ public static function getHost(): ?string
3939
if (false !== $url) {
4040
return $url;
4141
}
42-
switch (getenv('TEST_SUITE')) {
43-
case 'free':
44-
return 'http://localhost:9200';
45-
case 'platinum':
46-
return 'https://elastic:changeme@localhost:9200';
47-
}
48-
return null;
42+
return 'https://elastic:changeme@localhost:9200';
4943
}
5044

5145
/**
@@ -62,9 +56,7 @@ public static function getClient(): Client
6256
]
6357
]
6458
]);
65-
if (getenv('TEST_SUITE') === 'platinum') {
66-
$clientBuilder->setSSLVerification(false);
67-
}
59+
$clientBuilder->setSSLVerification(false);
6860
return $clientBuilder->build();
6961
}
7062

@@ -207,17 +199,20 @@ private static function wipeSnapshots(Client $client): void
207199
$repos = $client->snapshot()->getRepository([
208200
'repository' => '_all'
209201
]);
210-
foreach ($repos as $name => $value) {
202+
foreach ($repos as $repository => $value) {
211203
if ($value['type'] === 'fs') {
212204
$response = $client->snapshot()->get([
213-
'repository' => $name,
205+
'repository' => $repository,
214206
'snapshot' => '_all',
215207
'ignore_unavailable' => true
216208
]);
209+
if (isset($response['responses'])) {
210+
$response = $response['responses'][0];
211+
}
217212
if (isset($response['snapshots'])) {
218213
foreach ($response['snapshots'] as $snapshot) {
219214
$client->snapshot()->delete([
220-
'repository' => $name,
215+
'repository' => $repository,
221216
'snapshot' => $snapshot['snapshot'],
222217
'client' => [
223218
'ignore' => 404
@@ -227,7 +222,7 @@ private static function wipeSnapshots(Client $client): void
227222
}
228223
}
229224
$client->snapshot()->deleteRepository([
230-
'repository' => $name,
225+
'repository' => $repository,
231226
'client' => [
232227
'ignore' => 404
233228
]

0 commit comments

Comments
 (0)