Skip to content

Commit

Permalink
Fix yaml test failure
Browse files Browse the repository at this point in the history
Signed-off-by: Gao Binlong <gbinlong@amazon.com>
  • Loading branch information
gaobinlong committed Jul 31, 2024
1 parent 8f9f91a commit dde3be1
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 123 deletions.
Original file line number Diff line number Diff line change
@@ -1,69 +1,9 @@
setup:
- do:
ingest.put_pipeline:
id: "pipeline1"
body: >
{
"description": "_description",
"processors": [
{
"set" : {
"field" : "_op_type",
"value": "create"
}
}
]
}
- do:
ingest.put_pipeline:
id: "pipeline2"
body: >
{
"description": "_description",
"processors": [
{
"set" : {
"field" : "_op_type",
"value": "invalidOpType"
}
}
]
}
- do:
indices.put_index_template:
name: test_index_template_for_data_stream
body:
index_patterns: test_data_stream1*
data_stream: {}
template:
settings:
number_of_shards: 1
number_of_replicas: 0
- do:
indices.create_data_stream:
name: test_data_stream1
---
teardown:
- do:
ingest.delete_pipeline:
id: "1"
ignore: 404
- do:
ingest.delete_pipeline:
id: "pipeline1"
ignore: 404
- do:
ingest.delete_pipeline:
id: "pipeline2"
ignore: 404
- do:
indices.delete_index_template:
name: test_index_template_for_data_stream
ignore: 404
- do:
indices.delete:
name: test_data_stream1
ignore: 404

---
"Test set processor with template value":
Expand Down Expand Up @@ -168,6 +108,52 @@ teardown:
version: " - 2.99.99"
reason: "introduced in 3.0.0"

- do:
ingest.put_pipeline:
id: "pipeline1"
body: >
{
"description": "_description",
"processors": [
{
"set" : {
"field" : "_op_type",
"value": "create"
}
}
]
}
- do:
ingest.put_pipeline:
id: "pipeline2"
body: >
{
"description": "_description",
"processors": [
{
"set" : {
"field" : "_op_type",
"value": "invalidOpType"
}
}
]
}
- do:
indices.put_index_template:
name: test_index_template_for_data_stream
body:
index_patterns: test_data_stream1*
data_stream: {}
template:
settings:
number_of_shards: 1
number_of_replicas: 0
- do:
indices.create_data_stream:
name: test_data_stream1

- do:
index:
index: test_data_stream1
Expand All @@ -178,18 +164,27 @@ teardown:
- match: { result: "created" }

- do:
get:
index: test_data_stream1
id: 1
- match: { _source: {"foo": "bar", "@timestamp": "2099-03-08T11:04:05.000Z"} }

- do:
catch: /illegal_argument_exception/
index:
index: test_data_stream1
id: 1
op_type: index
pipeline: pipeline2
body: { "foo": "bar", "@timestamp": "2099-03-08T11:04:05.000Z" }
- match: { items.0.status: 400 }
- match: { items.0.error.type: "illegal_argument_exception" }
- match: { items.0.error.reason: "opType must be 'create' or 'index', found: [invalidOpType]" }

- do:
ingest.delete_pipeline:
id: "pipeline1"
ignore: 404
- do:
ingest.delete_pipeline:
id: "pipeline2"
ignore: 404
- do:
indices.delete_data_stream:
name: test_data_stream1
ignore: 404
- do:
indices.delete_index_template:
name: test_index_template_for_data_stream
ignore: 404
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,6 @@ setup:
}
]
}
- do:
ingest.put_pipeline:
id: "pipeline3"
body: >
{
"description": "_description",
"processors": [
{
"set" : {
"field" : "_op_type",
"value": "create"
}
}
]
}
- do:
indices.put_index_template:
name: test_index_template_for_data_stream
body:
index_patterns: test_data_stream1*
data_stream: {}
template:
settings:
number_of_shards: 1
number_of_replicas: 0
- do:
indices.create_data_stream:
name: test_data_stream1
---
teardown:
- do:
Expand All @@ -68,22 +40,6 @@ teardown:
ingest.delete_pipeline:
id: "pipeline2"
ignore: 404
- do:
ingest.delete_pipeline:
id: "pipeline3"
ignore: 404
- do:
indices.delete_index_template:
name: test_index_template_for_bulk
ignore: 404
- do:
indices.delete_index_template:
name: test_index_template_for_data_stream
ignore: 404
- do:
indices.delete:
name: test_data_stream1
ignore: 404

---
"Test bulk request without default pipeline":
Expand Down Expand Up @@ -307,6 +263,35 @@ teardown:
version: " - 2.99.99"
reason: "introduced in 3.0.0"

- do:
ingest.put_pipeline:
id: "pipeline3"
body: >
{
"description": "_description",
"processors": [
{
"set" : {
"field" : "_op_type",
"value": "create"
}
}
]
}
- do:
indices.put_index_template:
name: test_index_template_for_data_stream
body:
index_patterns: test_data_stream1*
data_stream: {}
template:
settings:
number_of_shards: 1
number_of_replicas: 0
- do:
indices.create_data_stream:
name: test_data_stream1

- do:
bulk:
refresh: true
Expand All @@ -317,13 +302,14 @@ teardown:
- match: { items.0.create.result: created }

- do:
search:
index: test_data_stream1
body: {
query: {
match_all: {}
}
}

- length: { hits.hits: 1 }
- match: { hits.hits.0._source: {"foo": "bar", "@timestamp": "2099-03-08T11:04:05.000Z"} }
ingest.delete_pipeline:
id: "pipeline3"
ignore: 404
- do:
indices.delete_data_stream:
name: test_data_stream1
ignore: 404
- do:
indices.delete_index_template:
name: test_index_template_for_data_stream
ignore: 404

0 comments on commit dde3be1

Please sign in to comment.