50
50
import static org .elasticsearch .packaging .util .Packages .installPackage ;
51
51
import static org .elasticsearch .packaging .util .Packages .remove ;
52
52
import static org .elasticsearch .packaging .util .Packages .restartElasticsearch ;
53
- import static org .elasticsearch .packaging .util .Packages .startElasticsearch ;
54
- import static org .elasticsearch .packaging .util .Packages .startElasticsearchIgnoringFailure ;
55
- import static org .elasticsearch .packaging .util .Packages .stopElasticsearch ;
56
53
import static org .elasticsearch .packaging .util .Packages .verifyPackageInstallation ;
57
54
import static org .elasticsearch .packaging .util .Platforms .getOsRelease ;
58
55
import static org .elasticsearch .packaging .util .Platforms .isSystemd ;
@@ -101,9 +98,9 @@ private void assertRunsWithJavaHome() throws Exception {
101
98
try {
102
99
Files .write (installation .envFile , ("JAVA_HOME=" + systemJavaHome + "\n " ).getBytes (StandardCharsets .UTF_8 ),
103
100
StandardOpenOption .APPEND );
104
- startElasticsearch (sh , installation );
101
+ startElasticsearch ();
105
102
runElasticsearchTests ();
106
- stopElasticsearch (sh );
103
+ stopElasticsearch ();
107
104
} finally {
108
105
Files .write (installation .envFile , originalEnvFile );
109
106
}
@@ -129,9 +126,9 @@ public void test33RunsIfJavaNotOnPath() throws Exception {
129
126
}
130
127
131
128
try {
132
- startElasticsearch (sh , installation );
129
+ startElasticsearch ();
133
130
runElasticsearchTests ();
134
- stopElasticsearch (sh );
131
+ stopElasticsearch ();
135
132
} finally {
136
133
if (Files .exists (Paths .get (backupPath ))) {
137
134
sh .run ("sudo mv " + backupPath + " /usr/bin/java" );
@@ -153,7 +150,7 @@ public void test42BundledJdkRemoved() throws Exception {
153
150
154
151
public void test40StartServer () throws Exception {
155
152
String start = sh .runIgnoreExitCode ("date " ).stdout .trim ();
156
- startElasticsearch (sh , installation );
153
+ startElasticsearch ();
157
154
158
155
String journalEntries = sh .runIgnoreExitCode ("journalctl _SYSTEMD_UNIT=elasticsearch.service " +
159
156
"--since \" " + start + "\" --output cat | wc -l" ).stdout .trim ();
@@ -218,7 +215,7 @@ public void test50Remove() throws Exception {
218
215
}
219
216
220
217
public void test60Reinstall () throws Exception {
221
- installation = installPackage ( distribution () );
218
+ install ( );
222
219
assertInstalled (distribution ());
223
220
verifyPackageInstallation (installation , distribution (), sh );
224
221
@@ -228,13 +225,13 @@ public void test60Reinstall() throws Exception {
228
225
229
226
public void test70RestartServer () throws Exception {
230
227
try {
231
- installation = installPackage ( distribution () );
228
+ install ( );
232
229
assertInstalled (distribution ());
233
230
234
- startElasticsearch (sh , installation );
231
+ startElasticsearch ();
235
232
restartElasticsearch (sh , installation );
236
233
runElasticsearchTests ();
237
- stopElasticsearch (sh );
234
+ stopElasticsearch ();
238
235
} finally {
239
236
cleanup ();
240
237
}
@@ -243,22 +240,22 @@ public void test70RestartServer() throws Exception {
243
240
244
241
public void test72TestRuntimeDirectory () throws Exception {
245
242
try {
246
- installation = installPackage ( distribution () );
243
+ install ( );
247
244
FileUtils .rm (installation .pidDir );
248
- startElasticsearch (sh , installation );
245
+ startElasticsearch ();
249
246
assertPathsExist (installation .pidDir );
250
- stopElasticsearch (sh );
247
+ stopElasticsearch ();
251
248
} finally {
252
249
cleanup ();
253
250
}
254
251
}
255
252
256
253
public void test73gcLogsExist () throws Exception {
257
- installation = installPackage ( distribution () );
258
- startElasticsearch (sh , installation );
254
+ install ( );
255
+ startElasticsearch ();
259
256
// it can be gc.log or gc.log.0.current
260
257
assertThat (installation .logs , fileWithGlobExist ("gc.log*" ));
261
- stopElasticsearch (sh );
258
+ stopElasticsearch ();
262
259
}
263
260
264
261
// TEST CASES FOR SYSTEMD ONLY
@@ -277,26 +274,26 @@ public void test80DeletePID_DIRandRestart() throws Exception {
277
274
278
275
sh .run ("systemd-tmpfiles --create" );
279
276
280
- startElasticsearch (sh , installation );
277
+ startElasticsearch ();
281
278
282
279
final Path pidFile = installation .pidDir .resolve ("elasticsearch.pid" );
283
280
284
281
assertTrue (Files .exists (pidFile ));
285
282
286
- stopElasticsearch (sh );
283
+ stopElasticsearch ();
287
284
}
288
285
289
286
public void test81CustomPathConfAndJvmOptions () throws Exception {
290
287
withCustomConfig (tempConf -> {
291
288
append (installation .envFile , "ES_JAVA_OPTS=-XX:-UseCompressedOops" );
292
289
293
- startElasticsearch (sh , installation );
290
+ startElasticsearch ();
294
291
295
292
final String nodesResponse = makeRequest (Request .Get ("http://localhost:9200/_nodes" ));
296
293
assertThat (nodesResponse , containsString ("\" heap_init_in_bytes\" :536870912" ));
297
294
assertThat (nodesResponse , containsString ("\" using_compressed_ordinary_object_pointers\" :\" false\" " ));
298
295
299
- stopElasticsearch (sh );
296
+ stopElasticsearch ();
300
297
});
301
298
}
302
299
@@ -306,7 +303,7 @@ public void test82SystemdMask() throws Exception {
306
303
307
304
sh .run ("systemctl mask systemd-sysctl.service" );
308
305
309
- installation = installPackage ( distribution () );
306
+ install ( );
310
307
311
308
sh .run ("systemctl unmask systemd-sysctl.service" );
312
309
} finally {
@@ -318,9 +315,9 @@ public void test83serviceFileSetsLimits() throws Exception {
318
315
// Limits are changed on systemd platforms only
319
316
assumeTrue (isSystemd ());
320
317
321
- installation = installPackage ( distribution () );
318
+ install ( );
322
319
323
- startElasticsearch (sh , installation );
320
+ startElasticsearch ();
324
321
325
322
final Path pidFile = installation .pidDir .resolve ("elasticsearch.pid" );
326
323
assertTrue (Files .exists (pidFile ));
@@ -337,7 +334,7 @@ public void test83serviceFileSetsLimits() throws Exception {
337
334
String maxAddressSpace = sh .run ("cat /proc/%s/limits | grep \" Max address space\" | awk '{ print $4 }'" , pid ).stdout .trim ();
338
335
assertThat (maxAddressSpace , equalTo ("unlimited" ));
339
336
340
- stopElasticsearch (sh );
337
+ stopElasticsearch ();
341
338
}
342
339
343
340
public void test90DoNotCloseStderrWhenQuiet () throws Exception {
@@ -347,7 +344,7 @@ public void test90DoNotCloseStderrWhenQuiet() throws Exception {
347
344
348
345
// Make sure we don't pick up the journal entries for previous ES instances.
349
346
clearJournal (sh );
350
- startElasticsearchIgnoringFailure ( sh );
347
+ runElasticsearchStartCommand ( );
351
348
352
349
final Result logs = sh .run ("journalctl -u elasticsearch.service" );
353
350
@@ -365,7 +362,7 @@ private void withCustomConfig(CustomConfigConsumer pathConsumer) throws Exceptio
365
362
366
363
assertPathsExist (installation .envFile );
367
364
368
- stopElasticsearch (sh );
365
+ stopElasticsearch ();
369
366
370
367
// The custom config directory is not under /tmp or /var/tmp because
371
368
// systemd's private temp directory functionally means different
0 commit comments