Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds remaining non-ML tests #27

Merged
merged 4 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions tests/indices/migrate_modify_data_stream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
setup:
- do:
index:
index: 'my-data-index'
refresh: true
body:
name: 'Test data'
"@timestamp": "2023-12-20"
- do:
index:
index: 'my-data-index2'
refresh: true
body:
name: 'Test data'
"@timestamp": "2023-12-20"
- do:
indices.put_index_template:
name: 'my-data-template'
body:
index_patterns: ['my-data-alias*']
data_stream: {}
- do:
indices.put_alias:
index: 'my-data-index'
name: 'my-data-alias'
---
teardown:
- do:
indices.delete_data_stream:
name: 'my-data-alias'
---
'migrate to data stream and modify':
- do:
indices.migrate_to_data_stream:
name: 'my-data-alias'
- is_true: acknowledged
- do:
indices.modify_data_stream:
body:
actions:
- add_backing_index:
data_stream: 'my-data-alias'
index: 'my-data-index2'
- is_true: acknowledged
69 changes: 69 additions & 0 deletions tests/indices/rollover.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
teardown:
- do:
indices.delete: { index: logs-1 }
- do:
indices.delete: { index: logs-000002 }
---
"Rollover index via API":
# create index with alias
- do:
indices.create:
index: logs-1
wait_for_active_shards: 1
body:
aliases:
logs_index: {}
logs_search: {}
# index document
- do:
index:
index: logs-1
id: "1"
body: { "foo": "hello world" }
# make this doc visible in index stats
refresh: true
- do:
get:
index: logs_search
id: "1"
- match: { _index: logs-1 }
- match: { _id: "1" }
- match: { _source: { foo: "hello world" } }

# perform alias rollover
- do:
indices.rollover:
alias: "logs_search"
wait_for_active_shards: 1
body:
conditions:
max_docs: 1
- match: { old_index: logs-1 }
- match: { new_index: logs-000002 }
- match: { rolled_over: true }
- match: { dry_run: false }
- match: { conditions: { "[max_docs: 1]": true } }

# ensure new index is created
- do:
indices.exists:
index: logs-000002
- is_true: ''

# index into new index
- do:
index:
index: logs-000002
id: "2"
body: { "foo": "hello world" }
- do:
indices.refresh: {}

# check alias points to the new index
- do:
search:
rest_total_hits_as_int: true
index: logs_search
- match: { hits.total: 1 }
- match: { hits.hits.0._index: "logs-000002"}
3 changes: 3 additions & 0 deletions tests/ingest/10_basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@
- do:
ingest.delete_pipeline: { id: 'test_pipeline' }
- match: { acknowledged: true }
- do:
ingest.processor_grok
- is_true: patterns
29 changes: 29 additions & 0 deletions tests/rank_eval.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
setup:
- do:
index:
index: "my-index-000001"
id: "doc1"
refresh: true
body: { text: 'travelling to Amsterdam' }
---
teardown:
- do:
indices.delete: { index: "my-index-000001" }
---
"rank eval":
- do:
rank_eval:
index: "my-index-000001"
body:
requests:
- id: "amsterdam_query"
request: { query: { match: { text: "amsterdam" } } }
ratings:
- { "_index": "my-index-000001", "_id": "doc1", "rating": 0 }
- { "_index": "my-index-000001", "_id": "doc2", "rating": 3 }
- { "_index": "my-index-000001", "_id": "doc3", "rating": 1 }
metric:
precision:
k: 5
- match: { details.amsterdam_query.hits.0.hit._index: 'my-index-000001' }