Fixed tests for info, ping and index

This commit is contained in:
Clinton Gormley 2013-06-26 21:04:20 +01:00
parent 7d98e42f8c
commit f2455917e9
19 changed files with 513 additions and 57 deletions

View File

@ -0,0 +1,24 @@
---
"Index with ID":
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
- ok: ok
- match: { _index: test_1 }
- match: { _type: test }
- match: { _id: 1}
- match: { _version: 1}
- do:
get:
index: test_1
type: test
id: 1
- match: { _index: test_1 }
- match: { _type: test }
- match: { _id: 1}
- match: { _version: 1}
- match: { _source: { foo: bar }}

View File

@ -0,0 +1,24 @@
---
"Index without ID":
- do:
index:
index: test_1
type: test
body: { foo: bar }
- ok: ok
- ok: _id
- match: { _index: test_1 }
- match: { _type: test }
- match: { _version: 1 }
- set: { _id: id }
- do:
get:
index: test_1
type: test
id: '$id'
- match: { _index: test_1 }
- match: { _type: test }
- match: { _id: $id }
- match: { _version: 1 }
- match: { _source: { foo: bar }}

View File

@ -0,0 +1,25 @@
---
"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,29 @@
---
"Routing":
- do:
index:
index: test_1
type: test
id: 1
routing: 5
body: { foo: bar }
- do:
cluster.health:
wait_for_status: yellow
- do:
get:
index: test_1
type: test
id: 1
routing: 5
fields: [_routing]
- match: { _id: 1}
- match: { fields._routing: 5}
- do:
catch: missing
get:
index: test_1
type: test
id: 1

View File

@ -0,0 +1,90 @@
---
"Parent":
- 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:
get:
index: test_1
type: test
id: 1
parent: 5
fields: [_parent, _routing]
- match: { _id: 1}
- match: { fields._parent: 5}
- match: { fields._routing: 5}
- do:
catch: missing
get:
index: test_1
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,40 @@
---
"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 }
- do:
catch: missing
get:
index: test_1
type: test
id: 1
- do:
index:
index: test_1
type: test
id: 2
refresh: 1
body: { foo: bar }
- do:
get:
index: test_1
type: test
id: 2

View File

@ -0,0 +1,67 @@
---
"Timestamp":
- do:
indices.create:
index: test_1
body:
mappings:
test:
_timestamp:
enabled: 1
store: yes
- do:
cluster.health:
wait_for_status: yellow
# blank timestamp
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
- do:
get:
index: test_1
type: test
id: 1
fields: _timestamp
- ok: fields._timestamp
# milliseconds since epoch
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
timestamp: 1372011280000
- do:
get:
index: test_1
type: test
id: 1
fields: _timestamp
- match: { fields._timestamp: 1372011280000 }
# date format
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
timestamp: 2013-06-23T18:14:40
- do:
get:
index: test_1
type: test
id: 1
fields: _timestamp
- match: { fields._timestamp: 1372011280000 }

View File

@ -0,0 +1,82 @@
---
"TTL":
- do:
indices.create:
index: test_1
body:
mappings:
test:
_ttl:
enabled: 1
store: yes
default: 10s
- do:
cluster.health:
wait_for_status: yellow
# blank ttl
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
- do:
get:
index: test_1
type: test
id: 1
fields: _ttl
- lt: { fields._ttl: 10000}
- gt: { fields._ttl: 0}
# milliseconds
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
ttl: 100000
- do:
get:
index: test_1
type: test
id: 1
fields: _ttl
- lt: { fields._ttl: 100000}
- gt: { fields._ttl: 10000}
# duration
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
ttl: 20s
- do:
get:
index: test_1
type: test
id: 1
fields: _ttl
- lt: { fields._ttl: 20000}
- gt: { fields._ttl: 10000}
# with timestamp
- do:
catch: /AlreadyExpiredException/
index:
index: test_1
type: test
id: 1
body: { foo: bar }
ttl: 20s
timestamp: 2013-06-23T18:14:40

View File

@ -0,0 +1,5 @@
Tests missing for:
# consistency
# percolate
# replication

View File

@ -11,6 +11,7 @@
- match: { _type: test }
- match: { _id: 1}
- match: { _version: 1}
- do:
get:
index: test_1

View File

@ -11,6 +11,7 @@
- match: { _type: test }
- match: { _version: 1 }
- set: { _id: id }
- do:
get:
index: test_1

View File

@ -7,6 +7,7 @@
id: 1
op_type: create
body: { foo: bar }
- do:
catch: conflict
index:
@ -15,6 +16,7 @@
id: 1
op_type: create
body: { foo: bar }
- do:
index:
index: test_1
@ -22,4 +24,5 @@
id: 1
op_type: index
body: { foo: bar }
- match: { _version: 2 }

View File

@ -0,0 +1,35 @@
---
"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 }

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
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
version: 5
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
version: 6
- match: { _version: 6}

View File

@ -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:
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:
get:
index: test_1
type: test
id: 1
routing: 4

View File

@ -18,11 +18,13 @@
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:
@ -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

@ -8,6 +8,5 @@
- ok: version
- ok: version.lucene_version
- ok: version.number
- ok: version.snapshot_build