|
1 | 1 | /*******************************************************************************
|
2 |
| - * Copyright (c) 2022, 2024 IBM Corporation and others. |
| 2 | + * Copyright (c) 2022, 2025 IBM Corporation and others. |
3 | 3 | * All rights reserved. This program and the accompanying materials
|
4 | 4 | * are made available under the terms of the Eclipse Public License 2.0
|
5 | 5 | * which accompanies this distribution, and is available at
|
@@ -376,25 +376,34 @@ private static boolean isTestAutoFeature(File featureFile) throws IOException {
|
376 | 376 | return isAutoFeature && isTestFeature;
|
377 | 377 | }
|
378 | 378 |
|
| 379 | + /** |
| 380 | + * Removes any test auto features left around from earlier test runs. |
| 381 | + * Mostly this removing test auto features from when com.ibm.ws.ui_rest_fat times out. |
| 382 | + * |
| 383 | + * @param installRoot |
| 384 | + */ |
379 | 385 | public static void removeTestAutoFeatures(File installRoot) {
|
380 | 386 |
|
381 |
| - // If there was a problem building projects before this test runs, |
382 |
| - // "lib/features" may not exist. |
383 |
| - |
384 |
| - File featureDir = new File(installRoot, "lib/features"); |
385 |
| - if (!featureDir.exists()) { |
386 |
| - return; |
387 |
| - } |
| 387 | + // Include Liberty install location and product extension locations |
| 388 | + File installParent = installRoot.getParentFile(); |
| 389 | + File[] productDirs = installParent.listFiles((file) -> file.isDirectory()); |
| 390 | + for (File productDir : productDirs) { |
| 391 | + // If there was a problem building projects before this test runs |
| 392 | + // or if a product extension doesn't have features, "lib/features" may not exist. |
| 393 | + File featureDir = new File(productDir, "lib/features"); |
| 394 | + if (!featureDir.exists()) { |
| 395 | + continue; |
| 396 | + } |
388 | 397 |
|
389 |
| - try { |
390 |
| - for (File featureFile : featureDir.listFiles()) { |
391 |
| - if (isTestAutoFeature(featureFile)) { |
392 |
| - featureFile.delete(); |
393 |
| - continue; |
| 398 | + try { |
| 399 | + for (File featureFile : featureDir.listFiles()) { |
| 400 | + if (isTestAutoFeature(featureFile)) { |
| 401 | + featureFile.delete(); |
| 402 | + } |
394 | 403 | }
|
| 404 | + } catch (Exception e) { |
| 405 | + throw new RuntimeException(e); |
395 | 406 | }
|
396 |
| - } catch (Exception e) { |
397 |
| - throw new RuntimeException(e); |
398 | 407 | }
|
399 | 408 | }
|
400 | 409 | }
|
0 commit comments