-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add false positive package to detect regressions in JSON marshalling
- Loading branch information
Showing
15 changed files
with
153 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
test/packages/false_positives/long_integers_as_json_numbers.expected_errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<failure>test case failed: Expected results are different from actual ones:.*</failure> |
3 changes: 3 additions & 0 deletions
3
test/packages/false_positives/long_integers_as_json_numbers/_dev/build/build.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dependencies: | ||
ecs: | ||
reference: git@1.10 |
5 changes: 5 additions & 0 deletions
5
...ackages/false_positives/long_integers_as_json_numbers/_dev/build/docs/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Long Integer Tests | ||
|
||
{{event "test"}} | ||
|
||
{{fields "test"}} |
6 changes: 6 additions & 0 deletions
6
test/packages/false_positives/long_integers_as_json_numbers/changelog.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# newer versions go on top | ||
- version: "0.0.1" | ||
changes: | ||
- description: Initial draft of the package | ||
type: enhancement | ||
link: https://github.com/elastic/integrations/pull/1 # FIXME Replace with the real PR link |
1 change: 1 addition & 0 deletions
1
...ives/long_integers_as_json_numbers/data_stream/test/_dev/test/pipeline/test-sequences.log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
4503599627370497,9007199254740991,9007199254740993,18014398509481985,9223372036854773807 |
2 changes: 2 additions & 0 deletions
2
...ntegers_as_json_numbers/data_stream/test/_dev/test/pipeline/test-sequences.log-config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fields: | ||
"@warning": "The values in sequence_number must match the values in message." |
15 changes: 15 additions & 0 deletions
15
...gers_as_json_numbers/data_stream/test/_dev/test/pipeline/test-sequences.log-expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"expected": [ | ||
{ | ||
"@warning": "The values in sequence_number must match the values in message.", | ||
"message": "4503599627370497,9007199254740991,9007199254740993,18014398509481985,9223372036854773807", | ||
"sequence_number": [ | ||
4503599627370497, | ||
9007199254740991, | ||
9007199254740992, | ||
18014398509481984, | ||
9223372036854774000 | ||
] | ||
} | ||
] | ||
} |
7 changes: 7 additions & 0 deletions
7
...alse_positives/long_integers_as_json_numbers/data_stream/test/agent/stream/stream.yml.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
paths: | ||
{{#each paths as |path i|}} | ||
- {{path}} | ||
{{/each}} | ||
exclude_files: [".gz$"] | ||
processors: | ||
- add_locale: ~ |
16 changes: 16 additions & 0 deletions
16
.../long_integers_as_json_numbers/data_stream/test/elasticsearch/ingest_pipeline/default.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
description: Pipeline for processing sample logs | ||
processors: | ||
- split: | ||
field: message | ||
separator: "," | ||
target_field: sequence_number | ||
ignore_missing: true | ||
- convert: | ||
field: sequence_number | ||
type: long | ||
|
||
on_failure: | ||
- set: | ||
field: error.message | ||
value: '{{ _ingest.on_failure_message }}' |
22 changes: 22 additions & 0 deletions
22
...ges/false_positives/long_integers_as_json_numbers/data_stream/test/fields/base-fields.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
- name: data_stream.type | ||
type: constant_keyword | ||
description: Data stream type. | ||
- name: data_stream.dataset | ||
type: constant_keyword | ||
description: Data stream dataset. | ||
- name: data_stream.namespace | ||
type: constant_keyword | ||
description: Data stream namespace. | ||
- name: '@timestamp' | ||
type: date | ||
description: Event timestamp. | ||
- name: '@warning' | ||
type: keyword | ||
description: Warning for devs. | ||
- name: message | ||
type: keyword | ||
description: Original input. | ||
- name: sequence_number | ||
type: long | ||
description: | | ||
Log entry identifier that is incremented sequentially. Unique for each log type. |
13 changes: 13 additions & 0 deletions
13
test/packages/false_positives/long_integers_as_json_numbers/data_stream/test/manifest.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
title: "Test" | ||
type: logs | ||
streams: | ||
- input: logfile | ||
title: Sample logs | ||
description: Collect sample logs | ||
vars: | ||
- name: paths | ||
type: text | ||
title: Paths | ||
multi: true | ||
default: | ||
- /var/log/*.log |
11 changes: 11 additions & 0 deletions
11
...packages/false_positives/long_integers_as_json_numbers/data_stream/test/sample_event.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"@warning": "The values in sequence_number must match the values in message.", | ||
"message": "4503599627370497,9007199254740991,9007199254740993,18014398509481985,9223372036854773807", | ||
"sequence_number": [ | ||
4503599627370497, | ||
9007199254740991, | ||
9007199254740993, | ||
18014398509481985, | ||
9223372036854773807 | ||
] | ||
} |
29 changes: 29 additions & 0 deletions
29
test/packages/false_positives/long_integers_as_json_numbers/docs/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Long Integer Tests | ||
|
||
An example event for `test` looks as following: | ||
|
||
```json | ||
{ | ||
"@warning": "The values in sequence_number must match the values in message.", | ||
"message": "4503599627370497,9007199254740991,9007199254740993,18014398509481985,9223372036854773807", | ||
"sequence_number": [ | ||
4503599627370497, | ||
9007199254740991, | ||
9007199254740993, | ||
18014398509481985, | ||
9223372036854773807 | ||
] | ||
} | ||
``` | ||
|
||
**Exported fields** | ||
|
||
| Field | Description | Type | | ||
|---|---|---| | ||
| @timestamp | Event timestamp. | date | | ||
| @warning | Warning for devs. | keyword | | ||
| data_stream.dataset | Data stream dataset. | constant_keyword | | ||
| data_stream.namespace | Data stream namespace. | constant_keyword | | ||
| data_stream.type | Data stream type. | constant_keyword | | ||
| message | Original input. | keyword | | ||
| sequence_number | Log entry identifier that is incremented sequentially. Unique for each log type. | long | |
22 changes: 22 additions & 0 deletions
22
test/packages/false_positives/long_integers_as_json_numbers/manifest.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
format_version: 1.0.0 | ||
name: long_integers_as_json_numbers | ||
title: "Long Integer Tests" | ||
version: 0.0.1 | ||
license: basic | ||
description: "These are tests of long integer round tripping, they should fail if JSON is not decoded using JSON numbers." | ||
type: integration | ||
categories: | ||
- custom | ||
release: experimental | ||
conditions: | ||
kibana.version: "^8.0.0" | ||
policy_templates: | ||
- name: test | ||
title: Test | ||
description: Description | ||
inputs: | ||
- type: file | ||
title: Collect logs via file. | ||
description: Collecting logs via file. | ||
owner: | ||
github: elastic/integrations |