Skip to content

Commit 7b7d52a

Browse files
committed
REST Spec tests
1 parent 54d5730 commit 7b7d52a

File tree

5 files changed

+94
-2
lines changed

5 files changed

+94
-2
lines changed

modules/streams/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ restResources {
1616
}
1717
}
1818

19+
configurations {
20+
basicRestSpecs {
21+
attributes {
22+
attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, ArtifactTypeDefinition.DIRECTORY_TYPE)
23+
}
24+
}
25+
}
26+
27+
artifacts {
28+
basicRestSpecs(new File(projectDir, "src/yamlRestTest/resources/rest-api-spec/test"))
29+
}
30+
1931
dependencies {
2032
testImplementation project(path: ':test:test-clusters')
2133
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.streams;
11+
12+
import com.carrotsearch.randomizedtesting.annotations.Name;
13+
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
14+
15+
import org.elasticsearch.test.cluster.ElasticsearchCluster;
16+
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
17+
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
18+
import org.junit.ClassRule;
19+
20+
public class StreamsYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
21+
public StreamsYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
22+
super(testCandidate);
23+
}
24+
25+
@ParametersFactory
26+
public static Iterable<Object[]> parameters() throws Exception {
27+
return ESClientYamlSuiteTestCase.createParameters();
28+
}
29+
30+
@ClassRule
31+
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().module("streams").build();
32+
33+
@Override
34+
protected String getTestRestCluster() {
35+
return cluster.getHttpAddresses();
36+
}
37+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
"Basic toggle of logs state enable to disable and back":
3+
- do:
4+
streams.logs_enable: { }
5+
- is_true: acknowledged
6+
7+
- do:
8+
streams.status: { }
9+
- is_true: logs.enabled
10+
11+
- do:
12+
streams.logs_disable: { }
13+
- is_true: acknowledged
14+
15+
- do:
16+
streams.status: { }
17+
- is_false: logs.enabled
18+
19+
- do:
20+
streams.logs_enable: { }
21+
- is_true: acknowledged
22+
23+
- do:
24+
streams.status: { }
25+
- is_true: logs.enabled
26+
27+
---
28+
"Check for repeated toggle to same state":
29+
- do:
30+
streams.logs_enable: { }
31+
- is_true: acknowledged
32+
33+
- do:
34+
streams.status: { }
35+
- is_true: logs.enabled
36+
37+
- do:
38+
streams.logs_enable: { }
39+
- is_true: acknowledged
40+
41+
- do:
42+
streams.status: { }
43+
- is_true: logs.enabled

rest-api-spec/src/main/resources/rest-api-spec/api/streams.logs.disable.json renamed to rest-api-spec/src/main/resources/rest-api-spec/api/streams.logs_disable.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"streams.logs.disable": {
2+
"streams.logs_disable": {
33
"documentation": {
44
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/streams-logs-disable.html",
55
"description": "Disable the Logs Streams feature for this cluster"

rest-api-spec/src/main/resources/rest-api-spec/api/streams.logs.enable.json renamed to rest-api-spec/src/main/resources/rest-api-spec/api/streams.logs_enable.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"streams.logs.enable": {
2+
"streams.logs_enable": {
33
"documentation": {
44
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/streams-logs-enable.html",
55
"description": "Enable the Logs Streams feature for this cluster"

0 commit comments

Comments
 (0)