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: - do:
index: create:
index: test_1 index: test_1
type: test type: test
id: 1 id: 1
@ -11,6 +11,7 @@
- match: { _type: test } - match: { _type: test }
- match: { _id: 1} - match: { _id: 1}
- match: { _version: 1} - match: { _version: 1}
- do: - do:
get: get:
index: test_1 index: test_1
@ -22,3 +23,10 @@
- match: { _version: 1} - match: { _version: 1}
- match: { _source: { foo: bar }} - 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: - do:
index: create:
index: test_1 index: test_1
type: test type: test
body: { foo: bar } body: { foo: bar }
@ -11,6 +11,7 @@
- match: { _type: test } - match: { _type: test }
- match: { _version: 1 } - match: { _version: 1 }
- set: { _id: id } - set: { _id: id }
- do: - do:
get: get:
index: test_1 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": "Routing":
- do: - do:
index: create:
index: test_1 index: test_1
type: test type: test
id: 1 id: 1

View File

@ -12,7 +12,7 @@
wait_for_status: yellow wait_for_status: yellow
- do: - do:
index: create:
index: test_1 index: test_1
type: test type: test
id: 1 id: 1
@ -37,54 +37,3 @@
type: test type: test
id: 1 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 wait_for_status: yellow
- do: - do:
index: create:
index: test_1 index: test_1
type: test type: test
id: 1 id: 1
body: { foo: bar } body: { foo: bar }
- do: - do:
catch: missing search:
get:
index: test_1 index: test_1
type: test type: test
id: 1 body:
query: { term: { _id: 1 }}
- match: { hits.total: 0 }
- do: - do:
index: create:
index: test_1 index: test_1
type: test type: test
id: 2 id: 2
@ -33,8 +35,10 @@
body: { foo: bar } body: { foo: bar }
- do: - do:
get: search:
index: test_1 index: test_1
type: test type: test
id: 2 body:
query: { term: { _id: 2 }}
- match: { hits.total: 1 }

View File

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

View File

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