From e19f2b63482f6a8586218e802e953002df41b357 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Tue, 30 Aug 2016 13:55:44 -0700 Subject: [PATCH] Tests: Improve rest suite names and generated test names for docs tests Rest test suites are currently only the directory above the yaml test file. That is confusing when there are more than one directory level which contain yaml tests, as there are in generated docs tests. This change makes rest tests use the full relative path to the rest test root as the suite name, and also makes the test names for docs tests a little clearer (that they are testing an example from a specific line number, instead of just the line number as an opaque test name). --- .../elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy | 2 +- .../main/java/org/elasticsearch/test/rest/yaml/FileUtils.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy index 61a07f4fbd4..fc7604ad1fd 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy @@ -117,7 +117,7 @@ public class RestTestsFromSnippetsTask extends SnippetsTask { if (false == test.continued) { current.println('---') - current.println("\"$test.start\":") + current.println("\"line_$test.start\":") } if (test.skipTest) { current.println(" - skip:") diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/FileUtils.java b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/FileUtils.java index caaa8b2ec83..4519953819a 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/FileUtils.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/FileUtils.java @@ -155,7 +155,7 @@ public final class FileUtils { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (file.toString().endsWith(fileSuffix)) { - String groupName = file.toAbsolutePath().getParent().getFileName().toString(); + String groupName = dir.relativize(file.getParent()).toString(); Set filesSet = files.get(groupName); if (filesSet == null) { filesSet = new HashSet<>();