Sort plugins in list x-pack extensions command
Fix tests that rely on deterministic order. Original commit: elastic/x-pack-elasticsearch@324b0db514
This commit is contained in:
parent
75362e70a3
commit
bd91603f6d
|
@ -16,6 +16,9 @@ import java.io.IOException;
|
|||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.elasticsearch.cli.Terminal.Verbosity.VERBOSE;
|
||||
|
@ -37,14 +40,19 @@ class ListXPackExtensionCommand extends SettingCommand {
|
|||
throw new IOException("Extensions directory missing: " + resolveXPackExtensionsFile(env));
|
||||
}
|
||||
terminal.println(VERBOSE, "XPack Extensions directory: " + resolveXPackExtensionsFile(env));
|
||||
try (DirectoryStream<Path> stream = Files.newDirectoryStream(resolveXPackExtensionsFile(env))) {
|
||||
for (Path extension : stream) {
|
||||
terminal.println(extension.getFileName().toString());
|
||||
XPackExtensionInfo info =
|
||||
XPackExtensionInfo.readFromProperties(extension);
|
||||
terminal.println(VERBOSE, info.toString());
|
||||
final List<Path> extensions = new ArrayList<>();
|
||||
try (DirectoryStream<Path> paths = Files.newDirectoryStream(resolveXPackExtensionsFile(env))) {
|
||||
for (Path extension : paths) {
|
||||
extensions.add(extension);
|
||||
}
|
||||
}
|
||||
Collections.sort(extensions);
|
||||
for (final Path extension : extensions) {
|
||||
terminal.println(extension.getFileName().toString());
|
||||
XPackExtensionInfo info =
|
||||
XPackExtensionInfo.readFromProperties(extension);
|
||||
terminal.println(VERBOSE, info.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue