use of org.elasticsearch.test.rest.yaml.section.ClientYamlTestSection in project elasticsearch by elastic.
the class ESClientYamlSuiteTestCase method collectTestCandidates.
private static List<ClientYamlTestCandidate> collectTestCandidates() throws IOException {
List<ClientYamlTestCandidate> testCandidates = new ArrayList<>();
FileSystem fileSystem = getFileSystem();
// ... and you can't close() the default filesystem
try {
String[] paths = resolvePathsProperty(REST_TESTS_SUITE, DEFAULT_TESTS_PATH);
Map<String, Set<Path>> yamlSuites = FileUtils.findYamlSuites(fileSystem, DEFAULT_TESTS_PATH, paths);
//yaml suites are grouped by directory (effectively by api)
for (String api : yamlSuites.keySet()) {
List<Path> yamlFiles = new ArrayList<>(yamlSuites.get(api));
for (Path yamlFile : yamlFiles) {
ClientYamlTestSuite restTestSuite = ClientYamlTestSuite.parse(api, yamlFile);
for (ClientYamlTestSection testSection : restTestSuite.getTestSections()) {
testCandidates.add(new ClientYamlTestCandidate(restTestSuite, testSection));
}
}
}
} finally {
IOUtils.close(fileSystem);
}
//sort the candidates so they will always be in the same order before being shuffled, for repeatability
Collections.sort(testCandidates, (o1, o2) -> o1.getTestPath().compareTo(o2.getTestPath()));
return testCandidates;
}
Aggregations