[TEST] more robust regex for tests missing subdomains

Original commit: elastic/x-pack-elasticsearch@28e5d14c22
This commit is contained in:
polyfractal 2017-02-01 11:04:55 -05:00
parent a11ddd1e04
commit 3504608a1e
1 changed files with 6 additions and 1 deletions

View File

@ -283,7 +283,12 @@ public class PainlessDomainSplitIT extends ESRestTestCase {
// Index some data // Index some data
DateTime baseTime = new DateTime().minusYears(1); DateTime baseTime = new DateTime().minusYears(1);
TestConfiguration test = tests.get(randomInt(tests.size()-1)); TestConfiguration test = tests.get(randomInt(tests.size()-1));
Pattern pattern = Pattern.compile("by_field_value\":\"(" + test.subDomainExpected + "),(" + test.domainExpected +")\",");
// domainSplit() tests had subdomain, testHighestRegisteredDomainCases() did not, so we need a special case for sub
String expectedSub = test.subDomainExpected == null ? ".*" : test.subDomainExpected.replace(".", "\\.");
String expectedHRD = test.domainExpected.replace(".", "\\.");
Pattern pattern = Pattern.compile("domain_split\":\\[\"(" + expectedSub + "),(" + expectedHRD +")\"[,\\]]");
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
DateTime time = baseTime.plusHours(i); DateTime time = baseTime.plusHours(i);