Added tests for delete

This commit is contained in:
Clinton Gormley 2013-06-28 17:17:23 +02:00
parent 051284c346
commit 262b047224
9 changed files with 293 additions and 0 deletions

View File

@ -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}

View File

@ -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 }

View File

@ -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}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 }

View File

@ -0,0 +1,6 @@
Tests missing for:
# consistency
# replication
# timeout