|
| 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: "Direct writes to child streams are prohibited. Index directly into the [logs] stream instead" } |
| 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: "Direct writes to child streams are prohibited. Index directly into the [logs] stream instead" } |
| 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: "Pipelines can't re-route documents to child streams, but pipeline [reroute-to-logs-foo] tried to reroute this document from index [bad-index] to index [logs.foo]. Reroute history: bad-index" } |
| 73 | + |
| 74 | +--- |
| 75 | +"Check Bulk Index With Script Processor To Substream Is Rejected": |
| 76 | + - do: |
| 77 | + streams.logs_enable: { } |
| 78 | + - is_true: acknowledged |
| 79 | + |
| 80 | + - do: |
| 81 | + streams.status: { } |
| 82 | + - is_true: logs.enabled |
| 83 | + |
| 84 | + - do: |
| 85 | + ingest.put_pipeline: |
| 86 | + id: "script-to-logs-foo" |
| 87 | + body: |
| 88 | + processors: |
| 89 | + - script: |
| 90 | + source: "ctx._index = 'logs.foo'" |
| 91 | + - do: |
| 92 | + indices.create: |
| 93 | + index: "bad-index-script" |
| 94 | + body: |
| 95 | + settings: |
| 96 | + index.default_pipeline: "script-to-logs-foo" |
| 97 | + - do: |
| 98 | + bulk: |
| 99 | + body: | |
| 100 | + { "index": { "_index": "bad-index-script" } } |
| 101 | + { "foo": "bar" } |
| 102 | + - match: { errors: true } |
| 103 | + - match: { items.0.index.status: 400 } |
| 104 | + - match: { items.0.index.error.type: "illegal_argument_exception" } |
| 105 | + - match: { items.0.index.error.reason: "Pipelines can't re-route documents to child streams, but pipeline [script-to-logs-foo] tried to reroute this document from index [bad-index-script] to index [logs.foo]. Reroute history: bad-index-script" } |
| 106 | + |
| 107 | +--- |
| 108 | +"Check Delete By Query Directly On Substream After Reroute Succeeds": |
| 109 | + - do: |
| 110 | + streams.logs_enable: { } |
| 111 | + - is_true: acknowledged |
| 112 | + |
| 113 | + - do: |
| 114 | + streams.status: { } |
| 115 | + - is_true: logs.enabled |
| 116 | + |
| 117 | + - do: |
| 118 | + ingest.put_pipeline: |
| 119 | + id: "reroute-to-logs-foo-success" |
| 120 | + body: |
| 121 | + processors: |
| 122 | + - reroute: |
| 123 | + destination: "logs.foo" |
| 124 | + - do: |
| 125 | + indices.create: |
| 126 | + index: "logs" |
| 127 | + body: |
| 128 | + settings: |
| 129 | + index.default_pipeline: "reroute-to-logs-foo-success" |
| 130 | + - do: |
| 131 | + bulk: |
| 132 | + refresh: true |
| 133 | + body: | |
| 134 | + { "index": { "_index": "logs" } } |
| 135 | + { "foo": "bar", "baz": "qux" } |
| 136 | + - match: { errors: false } |
| 137 | + - match: { items.0.index.status: 201 } |
| 138 | + |
| 139 | + - do: |
| 140 | + delete_by_query: |
| 141 | + index: logs.foo |
| 142 | + refresh: true |
| 143 | + body: |
| 144 | + query: |
| 145 | + match: |
| 146 | + foo: "bar" |
| 147 | + - match: { deleted: 1 } |
| 148 | + - match: { total: 1 } |
| 149 | + |
| 150 | + - do: |
| 151 | + search: |
| 152 | + index: logs.foo |
| 153 | + body: |
| 154 | + query: |
| 155 | + match_all: {} |
| 156 | + - match: { hits.total.value: 0 } |
0 commit comments