Added tests for create

This commit is contained in:
Clinton Gormley 2013-06-26 21:18:14 +01:00
parent f2455917e9
commit 7d0b0fb146
12 changed files with 154 additions and 159 deletions

View File

@ -1,7 +1,7 @@
---
"Index with ID":
"Create with ID":
- do:
index:
create:
index: test_1
type: test
id: 1
@ -11,6 +11,7 @@
- match: { _type: test }
- match: { _id: 1}
- match: { _version: 1}
- do:
get:
index: test_1
@ -22,3 +23,10 @@
- match: { _version: 1}
- match: { _source: { foo: bar }}
- do:
catch: conflict
create:
index: test_1
type: test
id: 1
body: { foo: bar }

View File

@ -1,7 +1,7 @@
---
"Index without ID":
"Create without ID":
- do:
index:
create:
index: test_1
type: test
body: { foo: bar }
@ -11,6 +11,7 @@
- match: { _type: test }
- match: { _version: 1 }
- set: { _id: id }
- do:
get:
index: test_1

View File

@ -1,25 +0,0 @@
---
"Optype":
- do:
index:
index: test_1
type: test
id: 1
op_type: create
body: { foo: bar }
- do:
catch: conflict
index:
index: test_1
type: test
id: 1
op_type: create
body: { foo: bar }
- do:
index:
index: test_1
type: test
id: 1
op_type: index
body: { foo: bar }
- match: { _version: 2 }

View File

@ -0,0 +1,18 @@
---
"Internal version":
- do:
create:
index: test_1
type: test
id: 1
body: { foo: bar }
- match: { _version: 1}
- do:
catch: conflict
create:
index: test_1
type: test
id: 1
body: { foo: bar }

View File

@ -1,63 +0,0 @@
---
"Internal version":
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
- match: { _version: 1}
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
- match: { _version: 2}
- do:
catch: conflict
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version: 1
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version: 2
- match: { _version: 3 }
---
"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
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
version: 5
- do:
catch: conflict
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
version: 6
- match: { _version: 6}

View File

@ -0,0 +1,29 @@
---
"External version":
- do:
create:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
version: 5
- match: { _version: 5}
- do:
catch: conflict
create:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
version: 5
- do:
catch: conflict
create:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
version: 6

View File

@ -1,7 +1,7 @@
---
"Routing":
- do:
index:
create:
index: test_1
type: test
id: 1

View File

@ -12,7 +12,7 @@
wait_for_status: yellow
- do:
index:
create:
index: test_1
type: test
id: 1
@ -37,54 +37,3 @@
type: test
id: 1
---
"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:
get:
index: test_1
type: test
id: 1
parent: 5
routing: 4
fields: [_parent, _routing]
- match: { _id: 1}
- match: { fields._parent: 5}
- match: { fields._routing: 4}
- do:
catch: missing
get:
index: test_1
type: test
id: 1
parent: 5
- do:
catch: missing
get:
index: test_1
type: test
id: 1
routing: 4

View File

@ -0,0 +1,49 @@
---
"Parent with routing":
- do:
indices.create:
index: test_1
body:
mappings:
test:
_parent: { type: "foo" }
- do:
cluster.health:
wait_for_status: yellow
- do:
create:
index: test_1
type: test
id: 1
parent: 5
routing: 4
body: { foo: bar }
- do:
get:
index: test_1
type: test
id: 1
parent: 5
routing: 4
fields: [_parent, _routing]
- match: { _id: 1}
- match: { fields._parent: 5}
- match: { fields._routing: 4}
- do:
catch: missing
get:
index: test_1
type: test
id: 1
parent: 5
- do:
get:
index: test_1
type: test
id: 1
routing: 4

View File

@ -11,21 +11,23 @@
wait_for_status: yellow
- do:
index:
create:
index: test_1
type: test
id: 1
body: { foo: bar }
- do:
catch: missing
get:
search:
index: test_1
type: test
id: 1
body:
query: { term: { _id: 1 }}
- match: { hits.total: 0 }
- do:
index:
create:
index: test_1
type: test
id: 2
@ -33,8 +35,10 @@
body: { foo: bar }
- do:
get:
search:
index: test_1
type: test
id: 2
body:
query: { term: { _id: 2 }}
- match: { hits.total: 1 }

View File

@ -15,7 +15,7 @@
# blank timestamp
- do:
index:
create:
index: test_1
type: test
id: 1
@ -32,7 +32,12 @@
# milliseconds since epoch
- do:
index:
delete:
index: test_1
type: test
id: 1
- do:
create:
index: test_1
type: test
id: 1
@ -50,7 +55,12 @@
# date format
- do:
index:
delete:
index: test_1
type: test
id: 1
- do:
create:
index: test_1
type: test
id: 1

View File

@ -16,7 +16,7 @@
# blank ttl
- do:
index:
create:
index: test_1
type: test
id: 1
@ -34,7 +34,12 @@
# milliseconds
- do:
index:
delete:
index: test_1
type: test
id: 1
- do:
create:
index: test_1
type: test
id: 1
@ -52,7 +57,12 @@
# duration
- do:
index:
delete:
index: test_1
type: test
id: 1
- do:
create:
index: test_1
type: test
id: 1
@ -70,9 +80,14 @@
# with timestamp
- do:
delete:
index: test_1
type: test
id: 1
- do:
catch: /AlreadyExpiredException/
index:
create:
index: test_1
type: test
id: 1