Skip to content
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
3 changes: 3 additions & 0 deletions spec/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
- description: Add support for `profiles` policy template type in input packages
type: enhancement
link: https://github.com/elastic/package-spec/pull/1092
- description: Support including multiple sample events
type: enhancement
link: https://github.com/elastic/package-spec/pull/582
- version: 3.5.8
changes:
- description: Add deployer option to system benchmark configuration.
Expand Down
2 changes: 1 addition & 1 deletion spec/input/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
$ref: "../integration/data_stream/fields/spec.yml"
- description: Sample event file
type: file
name: "sample_event.json"
pattern: "^sample_event(_[a-z0-9]+)?.json$"
contentMediaType: "application/json"
required: false
- description: Folder containing development resources
Expand Down
33 changes: 33 additions & 0 deletions spec/integration/data_stream/_dev/test/system/config.spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,36 @@ spec:
type: array
items:
$ref: "./../config.spec.yml#/definitions/package_requirement"
samples:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently in: elastic/elastic-package#3373
A sample event with sample_event_<name>.json is created for every stream dataType encountered.

I like this "opt-in" pattern as it helps disambiguate events through named declaration here, that may otherwise collide if they were of same dataType but different datasets.

description: >
List of sample event files to collect from this test. Each entry selects a sample
event file by name (the suffix in `sample_event_<name>.json`) and can optionally
define a condition to restrict which documents are used.
type: array
items:
type: object
additionalProperties: false
properties:
name:
description: >
Name identifying the sample event file to use. Corresponds to the suffix in
`sample_event_<name>.json`.
type: string
example: one
condition:
description: Condition to filter documents used for the sample event.
type: object
additionalProperties: false
properties:
key:
description: Field name to check in the document.
type: string
example: "sql.driver"
value:
description: Expected value of the field.
type: string
example: "mysql"
required:
- key
required:
- name
2 changes: 1 addition & 1 deletion spec/integration/data_stream/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ spec:
$ref: "../../integration/elasticsearch/pipeline.spec.yml"
- description: Sample event file
type: file
name: "sample_event.json"
pattern: "^sample_event(_[a-z0-9]+)?.json$"
contentMediaType: "application/json"
required: false
- description: Folder containing testing related files and sub-folders
Expand Down
63 changes: 63 additions & 0 deletions test/packages/good_input/sample_event_other.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"@timestamp": "2022-11-16T19:00:58.919Z",
"agent": {
"ephemeral_id": "1f2789fe-4041-4b4d-aac2-076a34c5d24f",
"id": "47bdbac3-731d-4b11-9af6-06fba253dba8",
"name": "docker-fleet-agent",
"type": "metricbeat",
"version": "8.5.0"
},
"data_stream": {
"dataset": "good_input.sql_query",
"namespace": "ep",
"type": "metrics"
},
"ecs": {
"version": "8.0.0"
},
"elastic_agent": {
"id": "47bdbac3-731d-4b11-9af6-06fba253dba8",
"snapshot": true,
"version": "8.5.0"
},
"event": {
"dataset": "good_input.sql_query",
"duration": 1326395,
"module": "sql"
},
"host": {
"architecture": "x86_64",
"containerized": false,
"hostname": "docker-fleet-agent",
"id": "0addaca3101a43f4a52be882837fb33d",
"ip": [
"192.168.192.7"
],
"mac": [
"02-42-C0-A8-C0-07"
],
"name": "docker-fleet-agent",
"os": {
"codename": "focal",
"family": "debian",
"kernel": "5.15.0-50-generic",
"name": "Ubuntu",
"platform": "ubuntu",
"type": "linux",
"version": "20.04.5 LTS (Focal Fossa)"
}
},
"metricset": {
"name": "query",
"period": 10000
},
"service": {
"address": "elastic-package-service-good_input-1:3306",
"type": "sql"
},
"sql": {
"driver": "mysql",
"metrics": {},
"query": "SHOW GLOBAL STATUS LIKE 'Innodb_system%'"
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
wait_for_data_timeout: 10m
vars: ~
vars: ~

samples:
Comment thread
mrodm marked this conversation as resolved.
- name: "one"
condition:
key: "sql.driver"
value: "mysql"
- name: "two"
condition:
key: "sql.driver"
Comment thread
mrodm marked this conversation as resolved.
63 changes: 63 additions & 0 deletions test/packages/good_v2/data_stream/foo/sample_event_one.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"@timestamp": "2022-11-16T19:00:58.919Z",
"agent": {
"ephemeral_id": "1f2789fe-4041-4b4d-aac2-076a34c5d24f",
"id": "47bdbac3-731d-4b11-9af6-06fba253dba8",
"name": "docker-fleet-agent",
"type": "metricbeat",
"version": "8.5.0"
},
"data_stream": {
"dataset": "sql_input.sql_query",
"namespace": "ep",
"type": "metrics"
},
"ecs": {
"version": "8.0.0"
},
"elastic_agent": {
"id": "47bdbac3-731d-4b11-9af6-06fba253dba8",
"snapshot": true,
"version": "8.5.0"
},
"event": {
"dataset": "sql_input.sql_query",
"duration": 1326395,
"module": "sql"
},
"host": {
"architecture": "x86_64",
"containerized": false,
"hostname": "docker-fleet-agent",
"id": "0addaca3101a43f4a52be882837fb33d",
"ip": [
"192.168.192.7"
],
"mac": [
"02-42-C0-A8-C0-07"
],
"name": "docker-fleet-agent",
"os": {
"codename": "focal",
"family": "debian",
"kernel": "5.15.0-50-generic",
"name": "Ubuntu",
"platform": "ubuntu",
"type": "linux",
"version": "20.04.5 LTS (Focal Fossa)"
}
},
"metricset": {
"name": "query",
"period": 10000
},
"service": {
"address": "elastic-package-service-sql_input-1:3306",
"type": "sql"
},
"sql": {
"driver": "mysql",
"metrics": {},
"query": "SHOW GLOBAL STATUS LIKE 'Innodb_system%'"
}
}
63 changes: 63 additions & 0 deletions test/packages/good_v2/data_stream/foo/sample_event_two.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"@timestamp": "2022-11-16T19:00:58.919Z",
"agent": {
"ephemeral_id": "1f2789fe-4041-4b4d-aac2-076a34c5d24f",
"id": "47bdbac3-731d-4b11-9af6-06fba253dba8",
"name": "docker-fleet-agent",
"type": "metricbeat",
"version": "8.5.0"
},
"data_stream": {
"dataset": "sql_input.sql_query",
"namespace": "ep",
"type": "metrics"
},
"ecs": {
"version": "8.0.0"
},
"elastic_agent": {
"id": "47bdbac3-731d-4b11-9af6-06fba253dba8",
"snapshot": true,
"version": "8.5.0"
},
"event": {
"dataset": "sql_input.sql_query",
"duration": 1326395,
"module": "sql"
},
"host": {
"architecture": "x86_64",
"containerized": false,
"hostname": "docker-fleet-agent",
"id": "0addaca3101a43f4a52be882837fb33d",
"ip": [
"192.168.192.7"
],
"mac": [
"02-42-C0-A8-C0-07"
],
"name": "docker-fleet-agent",
"os": {
"codename": "focal",
"family": "debian",
"kernel": "5.15.0-50-generic",
"name": "Ubuntu",
"platform": "ubuntu",
"type": "linux",
"version": "20.04.5 LTS (Focal Fossa)"
}
},
"metricset": {
"name": "query",
"period": 10000
},
"service": {
"address": "elastic-package-service-sql_input-1:3306",
"type": "sql"
},
"sql": {
"driver": "mysql",
"metrics": {},
"query": "SHOW GLOBAL STATUS LIKE 'Innodb_system%'"
}
}