Skip to content

Commit c8570b2

Browse files
committed
SNAPSHOT - YAML tests
1 parent 196ba6e commit c8570b2

File tree

3 files changed

+79
-2
lines changed

3 files changed

+79
-2
lines changed

modules/streams/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ esplugin {
2020

2121
restResources {
2222
restApi {
23-
include '_common', 'streams'
23+
include '_common', 'streams', "bulk", "index", "ingest", "indices"
2424
}
2525
}
2626

@@ -38,4 +38,5 @@ artifacts {
3838

3939
dependencies {
4040
testImplementation project(path: ':test:test-clusters')
41+
clusterModules project(':modules:ingest-common')
4142
}

modules/streams/src/yamlRestTest/java/org/elasticsearch/streams/StreamsYamlTestSuiteIT.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ public static Iterable<Object[]> parameters() throws Exception {
2929
}
3030

3131
@ClassRule
32-
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().module("streams").feature(FeatureFlag.LOGS_STREAM).build();
32+
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
33+
.module("streams")
34+
.module("ingest-common")
35+
.feature(FeatureFlag.LOGS_STREAM)
36+
.build();
3337

3438
@Override
3539
protected String getTestRestCluster() {
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
"Check User Can't Write To Substream Directly":
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+
bulk:
13+
body: |
14+
{ "index": { "_index": "logs.foo" } }
15+
{ "foo": "bar" }
16+
- match: { errors: true }
17+
- match: { items.0.index.status: 400 }
18+
- match: { items.0.index.error.type: "illegal_argument_exception" }
19+
- match: { items.0.index.error.reason: "Writes to child stream [logs.foo] are not allowed, use the parent stream instead: [logs]" }
20+
21+
---
22+
"Check User Can't Write To Substream Directly With Single Doc":
23+
- do:
24+
streams.logs_enable: { }
25+
- is_true: acknowledged
26+
27+
- do:
28+
streams.status: { }
29+
- is_true: logs.enabled
30+
31+
- do:
32+
catch: bad_request
33+
index:
34+
index: logs.foo
35+
id: "1"
36+
body:
37+
foo: bar
38+
- match: { error.type: "illegal_argument_exception" }
39+
- match: { error.reason: "Writes to child stream [logs.foo] are not allowed, use the parent stream instead: [logs]" }
40+
41+
---
42+
"Check Bulk Index With Reroute Processor To Substream Is Rejected":
43+
- do:
44+
streams.logs_enable: { }
45+
- is_true: acknowledged
46+
47+
- do:
48+
streams.status: { }
49+
- is_true: logs.enabled
50+
51+
- do:
52+
ingest.put_pipeline:
53+
id: "reroute-to-logs-foo"
54+
body:
55+
processors:
56+
- reroute:
57+
destination: "logs.foo"
58+
- do:
59+
indices.create:
60+
index: "bad-index"
61+
body:
62+
settings:
63+
index.default_pipeline: "reroute-to-logs-foo"
64+
- do:
65+
bulk:
66+
body: |
67+
{ "index": { "_index": "bad-index" } }
68+
{ "foo": "bar" }
69+
- match: { errors: true }
70+
- match: { items.0.index.status: 400 }
71+
- match: { items.0.index.error.type: "illegal_argument_exception" }
72+
- match: { items.0.index.error.reason: "Cannot reroute to substream [logs.foo] as only the stream itself can reroute to substreams. Please reroute to the stream [logs] instead." }

0 commit comments

Comments
 (0)