From 262b04722407fe1f2a14f53ed026841da96daa54 Mon Sep 17 00:00:00 2001 From: Clinton Gormley Date: Fri, 28 Jun 2013 17:17:23 +0200 Subject: [PATCH] Added tests for delete --- rest-api-spec/test/delete/10_basic.yaml | 31 +++++++++ .../test/delete/20_internal_version.yaml | 26 +++++++ .../test/delete/25_external_version.yaml | 29 ++++++++ rest-api-spec/test/delete/30_routing.yaml | 27 ++++++++ rest-api-spec/test/delete/40_parent.yaml | 40 +++++++++++ .../test/delete/42_missing_parent.yml | 28 ++++++++ .../test/delete/45_parent_with_routing.yaml | 39 +++++++++++ rest-api-spec/test/delete/50_refresh.yaml | 67 +++++++++++++++++++ rest-api-spec/test/delete/TODO.txt | 6 ++ 9 files changed, 293 insertions(+) create mode 100644 rest-api-spec/test/delete/10_basic.yaml create mode 100644 rest-api-spec/test/delete/20_internal_version.yaml create mode 100644 rest-api-spec/test/delete/25_external_version.yaml create mode 100644 rest-api-spec/test/delete/30_routing.yaml create mode 100644 rest-api-spec/test/delete/40_parent.yaml create mode 100644 rest-api-spec/test/delete/42_missing_parent.yml create mode 100644 rest-api-spec/test/delete/45_parent_with_routing.yaml create mode 100644 rest-api-spec/test/delete/50_refresh.yaml create mode 100644 rest-api-spec/test/delete/TODO.txt diff --git a/rest-api-spec/test/delete/10_basic.yaml b/rest-api-spec/test/delete/10_basic.yaml new file mode 100644 index 00000000000..0139d1c410a --- /dev/null +++ b/rest-api-spec/test/delete/10_basic.yaml @@ -0,0 +1,31 @@ +--- +"Basic": + - do: + catch: missing + delete: + index: test_1 + type: test + id: 1 + + - do: + delete: + index: test_1 + type: test + id: 1 + ignore_missing: 1 + + - do: + index: + index: test_1 + type: test + id: 1 + body: { foo: bar } + - ok: ok + - match: { _version: 3} + + - do: + delete: + index: test_1 + type: test + id: 1 + - match: { _version: 4} diff --git a/rest-api-spec/test/delete/20_internal_version.yaml b/rest-api-spec/test/delete/20_internal_version.yaml new file mode 100644 index 00000000000..11b3c085bd2 --- /dev/null +++ b/rest-api-spec/test/delete/20_internal_version.yaml @@ -0,0 +1,26 @@ +--- +"Internal version": + - do: + index: + index: test_1 + type: test + id: 1 + body: { foo: bar } + - match: { _version: 1} + + - do: + catch: conflict + delete: + index: test_1 + type: test + id: 1 + version: 2 + + - do: + delete: + index: test_1 + type: test + id: 1 + version: 1 + + - match: { _version: 2 } diff --git a/rest-api-spec/test/delete/25_external_version.yaml b/rest-api-spec/test/delete/25_external_version.yaml new file mode 100644 index 00000000000..4a6e23dab58 --- /dev/null +++ b/rest-api-spec/test/delete/25_external_version.yaml @@ -0,0 +1,29 @@ +--- +"External version": + - do: + index: + index: test_1 + type: test + id: 1 + body: { foo: bar } + version_type: external + version: 5 + - match: { _version: 5} + + - do: + catch: conflict + delete: + index: test_1 + type: test + id: 1 + version_type: external + version: 4 + + - do: + delete: + index: test_1 + type: test + id: 1 + version_type: external + version: 6 + - match: { _version: 6} diff --git a/rest-api-spec/test/delete/30_routing.yaml b/rest-api-spec/test/delete/30_routing.yaml new file mode 100644 index 00000000000..da14bcafa76 --- /dev/null +++ b/rest-api-spec/test/delete/30_routing.yaml @@ -0,0 +1,27 @@ +--- +"Routing": + - do: + index: + index: test_1 + type: test + id: 1 + routing: 5 + body: { foo: bar } + - do: + cluster.health: + wait_for_status: yellow + - do: + catch: missing + delete: + index: test_1 + type: test + id: 1 + routing: 4 + + - do: + delete: + index: test_1 + type: test + id: 1 + routing: 5 + diff --git a/rest-api-spec/test/delete/40_parent.yaml b/rest-api-spec/test/delete/40_parent.yaml new file mode 100644 index 00000000000..81731d4c3f4 --- /dev/null +++ b/rest-api-spec/test/delete/40_parent.yaml @@ -0,0 +1,40 @@ +--- +"Parent": + - skip: + version: "0 - 0.90.2" + reason: Delete ignores the parent param + + - do: + indices.create: + index: test_1 + body: + mappings: + test: + _parent: { type: "foo" } + - do: + cluster.health: + wait_for_status: yellow + + - do: + index: + index: test_1 + type: test + id: 1 + parent: 5 + body: { foo: bar } + + - do: + catch: missing + delete: + index: test_1 + type: test + id: 1 + parent: 1 + + - do: + delete: + index: test_1 + type: test + id: 1 + parent: 5 + diff --git a/rest-api-spec/test/delete/42_missing_parent.yml b/rest-api-spec/test/delete/42_missing_parent.yml new file mode 100644 index 00000000000..ac00a8dcba0 --- /dev/null +++ b/rest-api-spec/test/delete/42_missing_parent.yml @@ -0,0 +1,28 @@ +--- +"Delete on all shards when parent not specified": + + - do: + indices.create: + index: test_1 + body: + mappings: + test: + _parent: { type: "foo" } + - do: + cluster.health: + wait_for_status: yellow + + - do: + index: + index: test_1 + type: test + id: 1 + parent: 5 + body: { foo: bar } + + - do: + delete: + index: test_1 + type: test + id: 1 + diff --git a/rest-api-spec/test/delete/45_parent_with_routing.yaml b/rest-api-spec/test/delete/45_parent_with_routing.yaml new file mode 100644 index 00000000000..4b7124a9941 --- /dev/null +++ b/rest-api-spec/test/delete/45_parent_with_routing.yaml @@ -0,0 +1,39 @@ +--- +"Parent with routing": + - do: + indices.create: + index: test_1 + body: + mappings: + test: + _parent: { type: "foo" } + - do: + cluster.health: + wait_for_status: yellow + + - do: + index: + index: test_1 + type: test + id: 1 + parent: 5 + routing: 4 + body: { foo: bar } + + - do: + catch: missing + delete: + index: test_1 + type: test + id: 1 + parent: 5 + routing: 1 + + - do: + delete: + index: test_1 + type: test + id: 1 + parent: 5 + routing: 4 + diff --git a/rest-api-spec/test/delete/50_refresh.yaml b/rest-api-spec/test/delete/50_refresh.yaml new file mode 100644 index 00000000000..f8b0b91885d --- /dev/null +++ b/rest-api-spec/test/delete/50_refresh.yaml @@ -0,0 +1,67 @@ +--- +"Refresh": + - do: + indices.create: + index: test_1 + body: + settings: + index.refresh_interval: -1 + - do: + cluster.health: + wait_for_status: yellow + + - do: + index: + index: test_1 + type: test + id: 1 + body: { foo: bar } + refresh: 1 + + - do: + index: + index: test_1 + type: test + id: 2 + body: { foo: bar } + refresh: 1 + + - do: + search: + index: test_1 + type: test + body: + query: { terms: { _id: [1,2] }} + + - match: { hits.total: 2 } + + - do: + delete: + index: test_1 + type: test + id: 1 + + - do: + search: + index: test_1 + type: test + body: + query: { terms: { _id: [1,2] }} + + - match: { hits.total: 2 } + + - do: + delete: + index: test_1 + type: test + id: 2 + refresh: 1 + + - do: + search: + index: test_1 + type: test + body: + query: { terms: { _id: [1,2] }} + + - match: { hits.total: 1 } diff --git a/rest-api-spec/test/delete/TODO.txt b/rest-api-spec/test/delete/TODO.txt new file mode 100644 index 00000000000..041836326bb --- /dev/null +++ b/rest-api-spec/test/delete/TODO.txt @@ -0,0 +1,6 @@ +Tests missing for: + +# consistency +# replication +# timeout +