|
| 1 | +--- |
| 2 | +setup: |
| 3 | + - do: |
| 4 | + snapshot.create_repository: |
| 5 | + repository: test_repo |
| 6 | + body: |
| 7 | + type: fs |
| 8 | + settings: |
| 9 | + location: test_repo |
| 10 | + |
| 11 | +--- |
| 12 | +teardown: |
| 13 | + - do: |
| 14 | + snapshot.delete_repository: |
| 15 | + repository: test_repo |
| 16 | + |
| 17 | +--- |
| 18 | +"Create a snapshot and then restore it": |
| 19 | + - skip: |
| 20 | + version: " - 7.99.99" |
| 21 | + reason: introduced in 8.0.0 |
| 22 | + features: ["allowed_warnings"] |
| 23 | + |
| 24 | + # Create index |
| 25 | + - do: |
| 26 | + indices.create: |
| 27 | + index: test_index |
| 28 | + body: |
| 29 | + settings: |
| 30 | + index: |
| 31 | + mode: time_series |
| 32 | + number_of_replicas: 0 |
| 33 | + number_of_shards: 2 |
| 34 | + mappings: |
| 35 | + properties: |
| 36 | + "@timestamp": |
| 37 | + type: date |
| 38 | + metricset: |
| 39 | + type: keyword |
| 40 | + time_series_dimension: true |
| 41 | + k8s: |
| 42 | + properties: |
| 43 | + pod: |
| 44 | + properties: |
| 45 | + uid: |
| 46 | + type: keyword |
| 47 | + time_series_dimension: true |
| 48 | + name: |
| 49 | + type: keyword |
| 50 | + ip: |
| 51 | + type: ip |
| 52 | + network: |
| 53 | + properties: |
| 54 | + tx: |
| 55 | + type: long |
| 56 | + rx: |
| 57 | + type: long |
| 58 | + - do: |
| 59 | + bulk: |
| 60 | + refresh: true |
| 61 | + index: test_index |
| 62 | + body: |
| 63 | + - '{"index": {}}' |
| 64 | + - '{"@timestamp": "2021-04-28T18:50:04.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}' |
| 65 | + - '{"index": {}}' |
| 66 | + - '{"@timestamp": "2021-04-28T18:50:24.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2005177954, "rx": 801479970}}}}' |
| 67 | + - '{"index": {}}' |
| 68 | + - '{"@timestamp": "2021-04-28T18:50:44.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2006223737, "rx": 802337279}}}}' |
| 69 | + - '{"index": {}}' |
| 70 | + - '{"@timestamp": "2021-04-28T18:51:04.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.2", "network": {"tx": 2012916202, "rx": 803685721}}}}' |
| 71 | + - '{"index": {}}' |
| 72 | + - '{"@timestamp": "2021-04-28T18:50:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434521831, "rx": 530575198}}}}' |
| 73 | + - '{"index": {}}' |
| 74 | + - '{"@timestamp": "2021-04-28T18:50:23.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434577921, "rx": 530600088}}}}' |
| 75 | + - '{"index": {}}' |
| 76 | + - '{"@timestamp": "2021-04-28T18:50:53.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434587694, "rx": 530604797}}}}' |
| 77 | + - '{"index": {}}' |
| 78 | + - '{"@timestamp": "2021-04-28T18:51:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434595272, "rx": 530605511}}}}' |
| 79 | + - '{"index": {}}' |
| 80 | + - '{"@timestamp": "2021-04-28T18:50:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "cow", "uid":"1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39", "ip": "10.10.55.4", "network": {"tx": 1434521831, "rx": 530575198}}}}' |
| 81 | + - '{"index": {}}' |
| 82 | + - '{"@timestamp": "2021-04-28T18:50:23.142Z", "metricset": "pod", "k8s": {"pod": {"name": "cow", "uid":"1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39", "ip": "10.10.55.4", "network": {"tx": 1434577921, "rx": 530600088}}}}' |
| 83 | + - '{"index": {}}' |
| 84 | + - '{"@timestamp": "2021-04-28T18:50:53.142Z", "metricset": "pod", "k8s": {"pod": {"name": "cow", "uid":"1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39", "ip": "10.10.55.4", "network": {"tx": 1434587694, "rx": 530604797}}}}' |
| 85 | + - '{"index": {}}' |
| 86 | + - '{"@timestamp": "2021-04-28T18:51:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "cow", "uid":"1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39", "ip": "10.10.55.4", "network": {"tx": 1434595272, "rx": 530605511}}}}' |
| 87 | + |
| 88 | + |
| 89 | + # Wait for green |
| 90 | + - do: |
| 91 | + cluster.health: |
| 92 | + wait_for_status: green |
| 93 | + |
| 94 | + # Take snapshot |
| 95 | + - do: |
| 96 | + snapshot.create: |
| 97 | + repository: test_repo |
| 98 | + snapshot: test_restore_tsdb |
| 99 | + wait_for_completion: true |
| 100 | + |
| 101 | + - match: { snapshot.snapshot: test_restore_tsdb } |
| 102 | + - match: { snapshot.state : SUCCESS } |
| 103 | + - match: { snapshot.shards.successful: 2 } |
| 104 | + - match: { snapshot.shards.failed : 0 } |
| 105 | + - is_true: snapshot.version |
| 106 | + - gt: { snapshot.version_id: 0} |
| 107 | + |
| 108 | + # Close index |
| 109 | + - do: |
| 110 | + indices.close: |
| 111 | + index : test_index |
| 112 | + allowed_warnings: |
| 113 | + - "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" |
| 114 | + |
| 115 | + # Restore index |
| 116 | + - do: |
| 117 | + snapshot.restore: |
| 118 | + repository: test_repo |
| 119 | + snapshot: test_restore_tsdb |
| 120 | + wait_for_completion: true |
| 121 | + |
| 122 | + # Check recovery stats |
| 123 | + - do: |
| 124 | + indices.recovery: |
| 125 | + index: test_index |
| 126 | + |
| 127 | + - match: { test_index.shards.0.type: SNAPSHOT } |
| 128 | + - match: { test_index.shards.0.stage: DONE } |
| 129 | + - match: { test_index.shards.0.index.files.recovered: 1} |
| 130 | + - gt: { test_index.shards.0.index.size.recovered_in_bytes: 0} |
| 131 | + |
| 132 | + - do: |
| 133 | + search: |
| 134 | + index: test_index |
| 135 | + body: |
| 136 | + query: |
| 137 | + query_string: |
| 138 | + query: '+@timestamp:"2021-04-28T18:51:04.467Z" +k8s.pod.name:cat' |
| 139 | + |
| 140 | + - match: {hits.total.value: 1} |
| 141 | + - match: {hits.hits.0._source.k8s.pod.uid: 947e4ced-1786-4e53-9e0c-5c447e959507} |
| 142 | + # TODO assert the _tsid once we generate it |
0 commit comments