diff --git a/core/src/test/java/org/elasticsearch/test/rest/ESRestTestCase.java b/core/src/test/java/org/elasticsearch/test/rest/ESRestTestCase.java index f3e18d75124..33ddea019ae 100644 --- a/core/src/test/java/org/elasticsearch/test/rest/ESRestTestCase.java +++ b/core/src/test/java/org/elasticsearch/test/rest/ESRestTestCase.java @@ -155,6 +155,7 @@ public abstract class ESRestTestCase extends ESIntegTestCase { return Settings.builder() .putArray(URLRepository.ALLOWED_URLS_SETTING, "http://snapshot.test*") .put(Node.HTTP_ENABLED, true) + .put("node.testattr", "test") .put(super.nodeSettings(nodeOrdinal)).build(); } diff --git a/dev-tools/Elasticsearch.launch b/dev-tools/Elasticsearch.launch index 2016518cd23..5995612c80b 100644 --- a/dev-tools/Elasticsearch.launch +++ b/dev-tools/Elasticsearch.launch @@ -14,5 +14,5 @@ - + diff --git a/dev-tools/src/main/resources/ant/integration-tests.xml b/dev-tools/src/main/resources/ant/integration-tests.xml index 23df37338de..f64f4403157 100644 --- a/dev-tools/src/main/resources/ant/integration-tests.xml +++ b/dev-tools/src/main/resources/ant/integration-tests.xml @@ -157,7 +157,7 @@ Starting up external cluster... - @@ -172,6 +172,8 @@ + + diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.nodeattrs/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.nodeattrs/10_basic.yaml index f076a3b1859..5f6e3e9ae09 100755 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.nodeattrs/10_basic.yaml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.nodeattrs/10_basic.yaml @@ -1,30 +1,64 @@ --- -"Test cat nodes attrs output": - - - skip: - version: "all" - reason: "Waiting for #12558" - +"Help": - do: - cat.nodeattrs: {} + cat.nodeattrs: + help: true - match: $body: | - /((\S+)\s+(\S+)\s+(\d{1,3}\.){3}\d{1,3}\s+(\S+)\s+(\S+)\s*)+/ + /^ node .+ \n + id .+ \n + pid .+ \n + host .+ \n + ip .+ \n + port .+ \n + attr .+ \n + value .+ \n + $/ + +--- +"Test cat nodes attrs output": + - do: + cat.nodeattrs: {} + - match: # All attributes look good + $body: | + /^# node\s+ host\s+ ip\s+ attr\s+ value\s* \n + (((\S+\s?){1,10})\s+(\S+)\s+(\d{1,3}\.){3}\d{1,3}\s+(\S+)\s+ (\S+)\s* \n)+ + $/ + - match: # A specific planted attribute is present and looks good + $body: | + /# node\s+ host\s+ ip\s+ attr\s+ value\s* \n + ((\S+\s?){1,10})\s+ (\S+)\s+(\d{1,3}\.){3}\d{1,3}\s+testattr\s+ test \s* \n + / + # Note for future editors: its quite possible to construct a regex with an + # intense amount of backtracking if you use something like (\S\s?)+ to match + # node name. - do: cat.nodeattrs: v: true - - - match: + - match: # All attributes look good including the heading $body: | - /((\S+)\s+(\S+)\s+(\d{1,3}\.){3}\d{1,3}\s+(\S+)\s+(\S+)\s*)+/ + /^ node\s+ host\s+ ip\s+ attr\s+ value\s* \n + (((\S+\s?){1,10})\s+(\S+)\s+(\d{1,3}\.){3}\d{1,3}\s+(\S+)\s+ (\S+)\s* \n)+ + $/ + - match: # A specific planted attribute is present and looks good + $body: | + /# node\s+ host\s+ ip\s+ attr\s+ value\s* \n + ((\S+\s?){1,10})\s+ (\S+)\s+(\d{1,3}\.){3}\d{1,3}\s+testattr\s+ test \s* \n + / - do: cat.nodeattrs: h: attr,value v: true - - - match: + - match: # All attributes look good $body: | - /((\S+)\s+(\S+)\s*)+/ + /^ attr\s+ value\s*\n + ((\S+)\s+ (\S+)\s*)+ + $/ + - match: # A specific planted attribute is present and looks good + $body: | + /# attr\s+ value\s*\n + testattr\s+ test\s*\n + /