Skip to content

Commit

Permalink
Fix type of normalize for process.io.bytes_skipped (#2094)
Browse files Browse the repository at this point in the history
* Test that normalize fields are always lists

Fails with AssertionError: 'array' is not an instance of <class 'list'> : process.io.bytes_skipped

* Fix type of normalize for process.io.bytes_skipped

* update changelog

Co-authored-by: Kylie Geller <[email protected]>
  • Loading branch information
efd6 and kgeller authored Nov 2, 2022
1 parent 35ee4f3 commit 98ae70c
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 7 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.next.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ Thanks, you're awesome :-) -->

#### Deprecated

## [8.5.1](https://github.com/elastic/ecs/compare/v8.5.0...v8.5.1)

### Schema Changes

#### Added

#### Improvements

### Tooling and Artifact Changes

#### Bugfixes

* Fix type of `normalize` in `process.io.bytes_skipped`. #2094

## 8.5.0 (Hard Feature Freeze)

### Schema Changes
Expand Down
2 changes: 1 addition & 1 deletion experimental/generated/csv/fields.csv
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ ECS_Version,Indexed,Field_Set,Field,Type,Level,Normalization,Example,Description
8.7.0-dev+exp,true,process,process.hash.tlsh,keyword,extended,,,TLSH hash.
8.7.0-dev+exp,true,process,process.interactive,boolean,extended,,True,Whether the process is connected to an interactive shell.
8.7.0-dev+exp,true,process,process.io,object,extended,,,A chunk of input or output (IO) from a single process.
8.7.0-dev+exp,true,process,process.io.bytes_skipped,object,extended,"a, r, r, a, y",,An array of byte offsets and lengths denoting where IO data has been skipped.
8.7.0-dev+exp,true,process,process.io.bytes_skipped,object,extended,array,,An array of byte offsets and lengths denoting where IO data has been skipped.
8.7.0-dev+exp,true,process,process.io.bytes_skipped.length,number,extended,,,The length of bytes skipped.
8.7.0-dev+exp,true,process,process.io.bytes_skipped.offset,number,extended,,,The byte offset into this event's io.text (or io.bytes in the future) where length bytes were skipped.
8.7.0-dev+exp,true,process,process.io.max_bytes_per_process_exceeded,boolean,extended,,,"If true, the process producing the output has exceeded the max_kilobytes_per_process configuration setting."
Expand Down
3 changes: 2 additions & 1 deletion experimental/generated/ecs/ecs_flat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9337,7 +9337,8 @@ process.io.bytes_skipped:
flat_name: process.io.bytes_skipped
level: extended
name: io.bytes_skipped
normalize: array
normalize:
- array
short: An array of byte offsets and lengths denoting where IO data has been skipped.
type: object
process.io.bytes_skipped.length:
Expand Down
3 changes: 2 additions & 1 deletion experimental/generated/ecs/ecs_nested.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11549,7 +11549,8 @@ process:
flat_name: process.io.bytes_skipped
level: extended
name: io.bytes_skipped
normalize: array
normalize:
- array
short: An array of byte offsets and lengths denoting where IO data has been
skipped.
type: object
Expand Down
2 changes: 1 addition & 1 deletion generated/csv/fields.csv
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ ECS_Version,Indexed,Field_Set,Field,Type,Level,Normalization,Example,Description
8.7.0-dev,true,process,process.hash.tlsh,keyword,extended,,,TLSH hash.
8.7.0-dev,true,process,process.interactive,boolean,extended,,True,Whether the process is connected to an interactive shell.
8.7.0-dev,true,process,process.io,object,extended,,,A chunk of input or output (IO) from a single process.
8.7.0-dev,true,process,process.io.bytes_skipped,object,extended,"a, r, r, a, y",,An array of byte offsets and lengths denoting where IO data has been skipped.
8.7.0-dev,true,process,process.io.bytes_skipped,object,extended,array,,An array of byte offsets and lengths denoting where IO data has been skipped.
8.7.0-dev,true,process,process.io.bytes_skipped.length,number,extended,,,The length of bytes skipped.
8.7.0-dev,true,process,process.io.bytes_skipped.offset,number,extended,,,The byte offset into this event's io.text (or io.bytes in the future) where length bytes were skipped.
8.7.0-dev,true,process,process.io.max_bytes_per_process_exceeded,boolean,extended,,,"If true, the process producing the output has exceeded the max_kilobytes_per_process configuration setting."
Expand Down
3 changes: 2 additions & 1 deletion generated/ecs/ecs_flat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9268,7 +9268,8 @@ process.io.bytes_skipped:
flat_name: process.io.bytes_skipped
level: extended
name: io.bytes_skipped
normalize: array
normalize:
- array
short: An array of byte offsets and lengths denoting where IO data has been skipped.
type: object
process.io.bytes_skipped.length:
Expand Down
3 changes: 2 additions & 1 deletion generated/ecs/ecs_nested.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11469,7 +11469,8 @@ process:
flat_name: process.io.bytes_skipped
level: extended
name: io.bytes_skipped
normalize: array
normalize:
- array
short: An array of byte offsets and lengths denoting where IO data has been
skipped.
type: object
Expand Down
3 changes: 2 additions & 1 deletion schemas/process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,8 @@
description: >
An array of byte offsets and lengths denoting where IO data has been skipped.
normalize: array
normalize:
- array

- name: io.bytes_skipped.offset
level: extended
Expand Down
4 changes: 4 additions & 0 deletions scripts/tests/test_ecs_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ def test_related_fields_always_arrays(self):
self.assertIn('array', field['normalize'],
"All fields under `related.*` should be arrays")

def test_normalize_always_array(self):
for (field_name, field) in self.ecs_fields.items():
self.assertIsInstance(field.get('normalize'), list, field_name)


if __name__ == '__main__':
unittest.main()

0 comments on commit 98ae70c

Please sign in to comment.