5050import static org .elasticsearch .packaging .util .Packages .installPackage ;
5151import static org .elasticsearch .packaging .util .Packages .remove ;
5252import 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 ;
5653import static org .elasticsearch .packaging .util .Packages .verifyPackageInstallation ;
5754import static org .elasticsearch .packaging .util .Platforms .getOsRelease ;
5855import static org .elasticsearch .packaging .util .Platforms .isSystemd ;
@@ -101,9 +98,9 @@ private void assertRunsWithJavaHome() throws Exception {
10198 try {
10299 Files .write (installation .envFile , ("JAVA_HOME=" + systemJavaHome + "\n " ).getBytes (StandardCharsets .UTF_8 ),
103100 StandardOpenOption .APPEND );
104- startElasticsearch (sh , installation );
101+ startElasticsearch ();
105102 runElasticsearchTests ();
106- stopElasticsearch (sh );
103+ stopElasticsearch ();
107104 } finally {
108105 Files .write (installation .envFile , originalEnvFile );
109106 }
@@ -129,9 +126,9 @@ public void test33RunsIfJavaNotOnPath() throws Exception {
129126 }
130127
131128 try {
132- startElasticsearch (sh , installation );
129+ startElasticsearch ();
133130 runElasticsearchTests ();
134- stopElasticsearch (sh );
131+ stopElasticsearch ();
135132 } finally {
136133 if (Files .exists (Paths .get (backupPath ))) {
137134 sh .run ("sudo mv " + backupPath + " /usr/bin/java" );
@@ -153,7 +150,7 @@ public void test42BundledJdkRemoved() throws Exception {
153150
154151 public void test40StartServer () throws Exception {
155152 String start = sh .runIgnoreExitCode ("date " ).stdout .trim ();
156- startElasticsearch (sh , installation );
153+ startElasticsearch ();
157154
158155 String journalEntries = sh .runIgnoreExitCode ("journalctl _SYSTEMD_UNIT=elasticsearch.service " +
159156 "--since \" " + start + "\" --output cat | wc -l" ).stdout .trim ();
@@ -218,7 +215,7 @@ public void test50Remove() throws Exception {
218215 }
219216
220217 public void test60Reinstall () throws Exception {
221- installation = installPackage ( distribution () );
218+ install ( );
222219 assertInstalled (distribution ());
223220 verifyPackageInstallation (installation , distribution (), sh );
224221
@@ -228,13 +225,13 @@ public void test60Reinstall() throws Exception {
228225
229226 public void test70RestartServer () throws Exception {
230227 try {
231- installation = installPackage ( distribution () );
228+ install ( );
232229 assertInstalled (distribution ());
233230
234- startElasticsearch (sh , installation );
231+ startElasticsearch ();
235232 restartElasticsearch (sh , installation );
236233 runElasticsearchTests ();
237- stopElasticsearch (sh );
234+ stopElasticsearch ();
238235 } finally {
239236 cleanup ();
240237 }
@@ -243,22 +240,22 @@ public void test70RestartServer() throws Exception {
243240
244241 public void test72TestRuntimeDirectory () throws Exception {
245242 try {
246- installation = installPackage ( distribution () );
243+ install ( );
247244 FileUtils .rm (installation .pidDir );
248- startElasticsearch (sh , installation );
245+ startElasticsearch ();
249246 assertPathsExist (installation .pidDir );
250- stopElasticsearch (sh );
247+ stopElasticsearch ();
251248 } finally {
252249 cleanup ();
253250 }
254251 }
255252
256253 public void test73gcLogsExist () throws Exception {
257- installation = installPackage ( distribution () );
258- startElasticsearch (sh , installation );
254+ install ( );
255+ startElasticsearch ();
259256 // it can be gc.log or gc.log.0.current
260257 assertThat (installation .logs , fileWithGlobExist ("gc.log*" ));
261- stopElasticsearch (sh );
258+ stopElasticsearch ();
262259 }
263260
264261 // TEST CASES FOR SYSTEMD ONLY
@@ -277,26 +274,26 @@ public void test80DeletePID_DIRandRestart() throws Exception {
277274
278275 sh .run ("systemd-tmpfiles --create" );
279276
280- startElasticsearch (sh , installation );
277+ startElasticsearch ();
281278
282279 final Path pidFile = installation .pidDir .resolve ("elasticsearch.pid" );
283280
284281 assertTrue (Files .exists (pidFile ));
285282
286- stopElasticsearch (sh );
283+ stopElasticsearch ();
287284 }
288285
289286 public void test81CustomPathConfAndJvmOptions () throws Exception {
290287 withCustomConfig (tempConf -> {
291288 append (installation .envFile , "ES_JAVA_OPTS=-XX:-UseCompressedOops" );
292289
293- startElasticsearch (sh , installation );
290+ startElasticsearch ();
294291
295292 final String nodesResponse = makeRequest (Request .Get ("http://localhost:9200/_nodes" ));
296293 assertThat (nodesResponse , containsString ("\" heap_init_in_bytes\" :536870912" ));
297294 assertThat (nodesResponse , containsString ("\" using_compressed_ordinary_object_pointers\" :\" false\" " ));
298295
299- stopElasticsearch (sh );
296+ stopElasticsearch ();
300297 });
301298 }
302299
@@ -306,7 +303,7 @@ public void test82SystemdMask() throws Exception {
306303
307304 sh .run ("systemctl mask systemd-sysctl.service" );
308305
309- installation = installPackage ( distribution () );
306+ install ( );
310307
311308 sh .run ("systemctl unmask systemd-sysctl.service" );
312309 } finally {
@@ -318,9 +315,9 @@ public void test83serviceFileSetsLimits() throws Exception {
318315 // Limits are changed on systemd platforms only
319316 assumeTrue (isSystemd ());
320317
321- installation = installPackage ( distribution () );
318+ install ( );
322319
323- startElasticsearch (sh , installation );
320+ startElasticsearch ();
324321
325322 final Path pidFile = installation .pidDir .resolve ("elasticsearch.pid" );
326323 assertTrue (Files .exists (pidFile ));
@@ -337,7 +334,7 @@ public void test83serviceFileSetsLimits() throws Exception {
337334 String maxAddressSpace = sh .run ("cat /proc/%s/limits | grep \" Max address space\" | awk '{ print $4 }'" , pid ).stdout .trim ();
338335 assertThat (maxAddressSpace , equalTo ("unlimited" ));
339336
340- stopElasticsearch (sh );
337+ stopElasticsearch ();
341338 }
342339
343340 public void test90DoNotCloseStderrWhenQuiet () throws Exception {
@@ -347,7 +344,7 @@ public void test90DoNotCloseStderrWhenQuiet() throws Exception {
347344
348345 // Make sure we don't pick up the journal entries for previous ES instances.
349346 clearJournal (sh );
350- startElasticsearchIgnoringFailure ( sh );
347+ runElasticsearchStartCommand ( );
351348
352349 final Result logs = sh .run ("journalctl -u elasticsearch.service" );
353350
@@ -365,7 +362,7 @@ private void withCustomConfig(CustomConfigConsumer pathConsumer) throws Exceptio
365362
366363 assertPathsExist (installation .envFile );
367364
368- stopElasticsearch (sh );
365+ stopElasticsearch ();
369366
370367 // The custom config directory is not under /tmp or /var/tmp because
371368 // systemd's private temp directory functionally means different
0 commit comments