Skip to content

Commit 772b831

Browse files
committed
Fixed issue on wipeSnapshots + removed TEST_SUITE in getHost()
1 parent 3493a7c commit 772b831

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

@@ -208,17 +200,20 @@ private static function wipeSnapshots(Client $client): void
208200
$repos = $client->snapshot()->getRepository([
209201
'repository' => '_all'
210202
]);
211-
foreach ($repos as $name => $value) {
203+
foreach ($repos as $repository => $value) {
212204
if ($value['type'] === 'fs') {
213205
$response = $client->snapshot()->get([
214-
'repository' => $name,
206+
'repository' => $repository,
215207
'snapshot' => '_all',
216208
'ignore_unavailable' => true
217209
]);
210+
if (isset($response['responses'])) {
211+
$response = $response['responses'][0];
212+
}
218213
if (isset($response['snapshots'])) {
219214
foreach ($response['snapshots'] as $snapshot) {
220215
$client->snapshot()->delete([
221-
'repository' => $name,
216+
'repository' => $repository,
222217
'snapshot' => $snapshot['snapshot'],
223218
'client' => [
224219
'ignore' => 404
@@ -228,7 +223,7 @@ private static function wipeSnapshots(Client $client): void
228223
}
229224
}
230225
$client->snapshot()->deleteRepository([
231-
'repository' => $name,
226+
'repository' => $repository,
232227
'client' => [
233228
'ignore' => 404
234229
]

0 commit comments

Comments
 (0)