|
| 1 | +setup: |
| 2 | + - skip: |
| 3 | + features: allowed_warnings |
| 4 | + |
| 5 | +--- |
| 6 | +"Test single data stream": |
| 7 | + - requires: |
| 8 | + cluster_features: [ "logs_stream" ] |
| 9 | + reason: requires setting 'logs_stream' to get or set data stream settings |
| 10 | + - do: |
| 11 | + allowed_warnings: |
| 12 | + - "index template [my-template] has index patterns [my-data-stream-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [my-template] will take precedence during new index creation" |
| 13 | + indices.put_index_template: |
| 14 | + name: my-template |
| 15 | + body: |
| 16 | + index_patterns: [ my-data-stream-* ] |
| 17 | + data_stream: { } |
| 18 | + template: |
| 19 | + settings: |
| 20 | + number_of_replicas: 0 |
| 21 | + lifecycle.name: my-policy |
| 22 | + |
| 23 | + - do: |
| 24 | + indices.create_data_stream: |
| 25 | + name: my-data-stream-1 |
| 26 | + |
| 27 | + - do: |
| 28 | + cluster.health: |
| 29 | + index: "my-data-stream-1" |
| 30 | + wait_for_status: green |
| 31 | + |
| 32 | + - do: |
| 33 | + indices.get_data_stream_settings: |
| 34 | + name: my-data-stream-1 |
| 35 | + - match: { data_streams.0.name: my-data-stream-1 } |
| 36 | + - match: { data_streams.0.settings: {} } |
| 37 | + - match: { data_streams.0.effective_settings.index.number_of_shards: null } |
| 38 | + - match: { data_streams.0.effective_settings.index.number_of_replicas: "0" } |
| 39 | + - match: { data_streams.0.effective_settings.index.lifecycle.name: "my-policy" } |
| 40 | + |
| 41 | + - do: |
| 42 | + indices.get_data_stream: |
| 43 | + name: my-data-stream-1 |
| 44 | + - match: { data_streams.0.name: my-data-stream-1 } |
| 45 | + - match: { data_streams.0.settings: {} } |
| 46 | + - match: { data_streams.0.effective_settings: null } |
| 47 | + |
| 48 | + - do: |
| 49 | + indices.put_data_stream_settings: |
| 50 | + name: my-data-stream-1 |
| 51 | + body: |
| 52 | + index: |
| 53 | + number_of_shards: 2 |
| 54 | + lifecycle.name: my-new-policy |
| 55 | + - match: { data_streams.0.name: my-data-stream-1 } |
| 56 | + - match: { data_streams.0.applied_to_data_stream: true } |
| 57 | + - match: { data_streams.0.index_settings_results.applied_to_data_stream_only: [index.number_of_shards]} |
| 58 | + - match: { data_streams.0.index_settings_results.applied_to_data_stream_and_backing_indices: [index.lifecycle.name] } |
| 59 | + - match: { data_streams.0.settings.index.number_of_shards: "2" } |
| 60 | + - match: { data_streams.0.settings.index.lifecycle.name: "my-new-policy" } |
| 61 | + - match: { data_streams.0.effective_settings.index.number_of_shards: "2" } |
| 62 | + - match: { data_streams.0.effective_settings.index.number_of_replicas: "0" } |
| 63 | + - match: { data_streams.0.effective_settings.index.lifecycle.name: "my-new-policy" } |
| 64 | + |
| 65 | + - do: |
| 66 | + indices.rollover: |
| 67 | + alias: "my-data-stream-1" |
| 68 | + |
| 69 | + - do: |
| 70 | + cluster.health: |
| 71 | + index: "my-data-stream-1" |
| 72 | + wait_for_status: green |
| 73 | + |
| 74 | + - do: |
| 75 | + indices.get_data_stream_settings: |
| 76 | + name: my-data-stream-1 |
| 77 | + - match: { data_streams.0.name: my-data-stream-1 } |
| 78 | + - match: { data_streams.0.settings.index.number_of_shards: "2" } |
| 79 | + - match: { data_streams.0.effective_settings.index.number_of_shards: "2" } |
| 80 | + - match: { data_streams.0.effective_settings.index.number_of_replicas: "0" } |
| 81 | + - match: { data_streams.0.effective_settings.index.lifecycle.name: "my-new-policy" } |
| 82 | + |
| 83 | + - do: |
| 84 | + indices.get_data_stream: |
| 85 | + name: my-data-stream-1 |
| 86 | + - match: { data_streams.0.name: my-data-stream-1 } |
| 87 | + - match: { data_streams.0.settings.index.number_of_shards: "2" } |
| 88 | + - match: { data_streams.0.settings.index.lifecycle.name: "my-new-policy" } |
| 89 | + - match: { data_streams.0.effective_settings: null } |
| 90 | + |
| 91 | + - do: |
| 92 | + indices.get_data_stream: |
| 93 | + name: my-data-stream-1 |
| 94 | + - set: { data_streams.0.indices.0.index_name: idx0name } |
| 95 | + - set: { data_streams.0.indices.1.index_name: idx1name } |
| 96 | + |
| 97 | + - do: |
| 98 | + indices.get_settings: |
| 99 | + index: my-data-stream-1 |
| 100 | + - match: { .$idx0name.settings.index.number_of_shards: "1" } |
| 101 | + - match: { .$idx0name.settings.index.lifecycle.name: "my-new-policy" } |
| 102 | + - match: { .$idx1name.settings.index.number_of_shards: "2" } |
| 103 | + - match: { .$idx1name.settings.index.lifecycle.name: "my-new-policy" } |
| 104 | + |
| 105 | +--- |
| 106 | +"Test multiple data streams": |
| 107 | + - requires: |
| 108 | + cluster_features: [ "logs_stream" ] |
| 109 | + reason: requires setting 'logs_stream' to get or set data stream settings |
| 110 | + - do: |
| 111 | + allowed_warnings: |
| 112 | + - "index template [my-template] has index patterns [my-data-stream-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [my-template] will take precedence during new index creation" |
| 113 | + indices.put_index_template: |
| 114 | + name: my-template |
| 115 | + body: |
| 116 | + index_patterns: [ my-data-stream-* ] |
| 117 | + data_stream: { } |
| 118 | + template: |
| 119 | + settings: |
| 120 | + number_of_replicas: 0 |
| 121 | + lifecycle.name: my-policy |
| 122 | + |
| 123 | + - do: |
| 124 | + indices.create_data_stream: |
| 125 | + name: my-data-stream-1 |
| 126 | + |
| 127 | + - do: |
| 128 | + indices.create_data_stream: |
| 129 | + name: my-data-stream-2 |
| 130 | + |
| 131 | + - do: |
| 132 | + indices.create_data_stream: |
| 133 | + name: my-data-stream-3 |
| 134 | + |
| 135 | + - do: |
| 136 | + cluster.health: |
| 137 | + index: "my-data-stream-1,my-data-stream-2,my-data-stream-3" |
| 138 | + wait_for_status: green |
| 139 | + |
| 140 | + - do: |
| 141 | + indices.get_data_stream_settings: |
| 142 | + name: "*" |
| 143 | + - length: { data_streams: 3 } |
| 144 | + |
| 145 | + - do: |
| 146 | + indices.get_data_stream_settings: |
| 147 | + name: "my-data-stream-1,my-data-stream-2" |
| 148 | + - length: { data_streams: 2 } |
| 149 | + |
| 150 | + - do: |
| 151 | + indices.put_data_stream_settings: |
| 152 | + name: my-data-stream-1,my-data-stream-2 |
| 153 | + body: |
| 154 | + index: |
| 155 | + number_of_shards: 2 |
| 156 | + lifecycle.name: my-new-policy |
| 157 | + - length: { data_streams: 2 } |
| 158 | + |
| 159 | +--- |
| 160 | +"Test invalid settings": |
| 161 | + - requires: |
| 162 | + cluster_features: [ "logs_stream" ] |
| 163 | + reason: requires setting 'logs_stream' to get or set data stream settings |
| 164 | + - do: |
| 165 | + allowed_warnings: |
| 166 | + - "index template [my-template] has index patterns [my-data-stream-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [my-template] will take precedence during new index creation" |
| 167 | + indices.put_index_template: |
| 168 | + name: my-template |
| 169 | + body: |
| 170 | + index_patterns: [ my-data-stream-* ] |
| 171 | + data_stream: { } |
| 172 | + template: |
| 173 | + settings: |
| 174 | + number_of_replicas: 0 |
| 175 | + lifecycle.name: my-policy |
| 176 | + |
| 177 | + - do: |
| 178 | + indices.create_data_stream: |
| 179 | + name: my-data-stream-1 |
| 180 | + |
| 181 | + - do: |
| 182 | + cluster.health: |
| 183 | + index: "my-data-stream-1" |
| 184 | + wait_for_status: green |
| 185 | + |
| 186 | + - do: |
| 187 | + indices.put_data_stream_settings: |
| 188 | + name: my-data-stream-1 |
| 189 | + body: |
| 190 | + index: |
| 191 | + fake_setting: 1234 |
| 192 | + - match: { data_streams.0.name: my-data-stream-1 } |
| 193 | + - match: { data_streams.0.applied_to_data_stream: false } |
| 194 | + - match: { data_streams.0.error: "Cannot set the following settings on a data stream: [index.fake_setting]" } |
0 commit comments