Skip to content

Commit

Permalink
test: Break apart the multi type aspect of rolling upgrade tests,
Browse files Browse the repository at this point in the history
so that old multi type support can be tested if upgrading from ES versions prior 6.0 and otherwise these multi type support tests are ignored
  • Loading branch information
martijnvg committed Nov 6, 2017
1 parent 202c67c commit 3ba2aff
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

- do:
search:
type: doc
index: test_index

- match: { hits.total: 5 } # no new indexed data, so expect the original 5 documents from the old cluster
Expand All @@ -21,21 +22,21 @@
bulk:
refresh: true
body:
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"index": {"_index": "test_index", "_type": "doc"}}'
- '{"f1": "v1_mixed", "f2": 5}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"index": {"_index": "test_index", "_type": "doc"}}'
- '{"f1": "v2_mixed", "f2": 6}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"index": {"_index": "test_index", "_type": "doc"}}'
- '{"f1": "v3_mixed", "f2": 7}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"index": {"_index": "test_index", "_type": "doc"}}'
- '{"f1": "v4_mixed", "f2": 8}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"index": {"_index": "test_index", "_type": "doc"}}'
- '{"f1": "v5_mixed", "f2": 9}'

- do:
index:
index: test_index
type: test_type
type: doc
id: d10
body: {"f1": "v6_mixed", "f2": 10}

Expand All @@ -45,14 +46,15 @@

- do:
search:
type: doc
index: test_index

- match: { hits.total: 11 } # 5 docs from old cluster, 6 docs from mixed cluster

- do:
delete:
index: test_index
type: test_type
type: doc
id: d10

- do:
Expand All @@ -61,6 +63,7 @@

- do:
search:
type: doc
index: test_index

- match: { hits.total: 10 }
Expand All @@ -86,3 +89,56 @@
ingest.get_pipeline:
id: "my_pipeline"
- match: { my_pipeline.description: "_description" }

---
"Test old multi type stuff":
- skip:
version: "6.0.0 - "
reason: multiple types are not supported from 6.0 and beyond

- do:
bulk:
refresh: true
body:
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "v1_mixed", "f2": 5}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "v2_mixed", "f2": 6}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "v3_mixed", "f2": 7}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "v4_mixed", "f2": 8}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "v5_mixed", "f2": 9}'

- do:
index:
index: test_index
type: test_type
id: d10
body: {"f1": "v6_mixed", "f2": 10}

- do:
indices.flush:
index: test_index

- do:
search:
index: test_index
type: test_type

- match: { hits.total: 6 }

- do:
delete:
refresh: true
index: test_index
type: test_type
id: d10

- do:
search:
index: test_index
type: test_type

- match: { hits.total: 5 }
Original file line number Diff line number Diff line change
@@ -1,34 +1,12 @@
---
"Index data, search, and create things in the cluster state that we'll validate are there after the ugprade":
"Index data, search, and create things in the cluster state that we'll validate are there after the upgrade":
- do:
indices.create:
index: test_index
body:
settings:
index:
number_of_replicas: 0
- do:
indices.create:
index: multi_type_index
body:
settings:
index.number_of_replicas: 0
index.mapping.single_type: false

- do:
bulk:
refresh: true
body:
- '{"index": {"_index": "multi_type_index", "_type": "type1"}}'
- '{"f1": "v1_old", "f2": 0}'
- '{"index": {"_index": "multi_type_index", "_type": "type2"}}'
- '{"f1": "v1_old", "f2": 0}'

- do:
search:
index: multi_type_index

- match: { hits.total: 2 }

- do:
indices.create:
Expand Down Expand Up @@ -123,3 +101,32 @@
params:
f1: v5_old
- match: { hits.total: 1 }

---
"Test old multi type stuff":
- skip:
version: "6.0.0 - "
reason: multiple types are not supported from 6.0 and beyond

- do:
indices.create:
index: multi_type_index
body:
settings:
index.number_of_replicas: 0
index.mapping.single_type: false

- do:
bulk:
refresh: true
body:
- '{"index": {"_index": "multi_type_index", "_type": "type1"}}'
- '{"f1": "v1_old", "f2": 0}'
- '{"index": {"_index": "multi_type_index", "_type": "type2"}}'
- '{"f1": "v1_old", "f2": 0}'

- do:
search:
index: multi_type_index

- match: { hits.total: 2 }
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- do:
search:
index: test_index
type: doc

- match: { hits.total: 10 } # no new indexed data, so expect the original 10 documents from the old and mixed clusters

Expand All @@ -20,32 +21,19 @@

- match: { hits.total: 5 } # just check we recovered fine


- do:
search:
index: multi_type_index

- match: { hits.total: 2 } # just check we recovered fine

- do:
indices.get_settings:
index: multi_type_index

- match: { multi_type_index.settings.index.mapping.single_type: "false"}

- do:
bulk:
refresh: true
body:
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"index": {"_index": "test_index", "_type": "doc"}}'
- '{"f1": "v1_upgraded", "f2": 10}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"index": {"_index": "test_index", "_type": "doc"}}'
- '{"f1": "v2_upgraded", "f2": 11}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"index": {"_index": "test_index", "_type": "doc"}}'
- '{"f1": "v3_upgraded", "f2": 12}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"index": {"_index": "test_index", "_type": "doc"}}'
- '{"f1": "v4_upgraded", "f2": 13}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"index": {"_index": "test_index", "_type": "doc"}}'
- '{"f1": "v5_upgraded", "f2": 14}'

- do:
Expand All @@ -54,6 +42,7 @@

- do:
search:
type: doc
index: test_index

- match: { hits.total: 15 } # 10 docs from previous clusters plus 5 new docs
Expand All @@ -79,3 +68,48 @@
ingest.get_pipeline:
id: "my_pipeline"
- match: { my_pipeline.description: "_description" }

---
"Test old multi type stuff":
- skip:
version: "6.0.0 - "
reason: multiple types are not supported from 6.0 and beyond

- do:
search:
index: multi_type_index

- match: { hits.total: 2 } # just check we recovered fine

- do:
indices.get_settings:
index: multi_type_index

- match: { multi_type_index.settings.index.mapping.single_type: "false"}

- do:
bulk:
refresh: true
body:
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "v1_upgraded", "f2": 10}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "v2_upgraded", "f2": 11}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "v3_upgraded", "f2": 12}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "v4_upgraded", "f2": 13}'
- '{"index": {"_index": "test_index", "_type": "test_type"}}'
- '{"f1": "v5_upgraded", "f2": 14}'

- do:
indices.flush:
index: test_index

- do:
search:
type: test_type
index: test_index

- match: { hits.total: 10 } # 5 docs from previous clusters plus 5 new docs

0 comments on commit 3ba2aff

Please sign in to comment.