Skip to content

Commit

Permalink
Add agent fields into config file for system tests (#739)
Browse files Browse the repository at this point in the history
Add the current agent fields used to customize Elastic Agent
in the spec for the configuration file of system tests.
  • Loading branch information
mrodm authored May 14, 2024
1 parent e9e7eb8 commit 9da309f
Show file tree
Hide file tree
Showing 8 changed files with 188 additions and 4 deletions.
3 changes: 3 additions & 0 deletions spec/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
- description: Support store mapping option.
type: enhancement
link: https://github.com/elastic/package-spec/pull/748
- description: Add agent settings definitions into configuration files for system tests.
type: enhancement
link: https://github.com/elastic/package-spec/pull/739
- version: 3.1.4
changes:
- description: Add definitions for different deployment modes.
Expand Down
122 changes: 122 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 @@ -23,3 +23,125 @@ spec:
items:
type: string
example: "error.message"
agent:
description: "Configuration overrides for the Elastic Agent"
type: object
additionalProperties: true
properties:
runtime:
description: "Runtime to run the Elastic Agent process"
type: string
enum:
- docker
default: docker
user:
description: "User that runs the Elastic Agent process"
type: string
example: root
default: ""
pid_mode:
description: >
(From docker-compose docs) Turns on sharing between container and the host
operating system the PID address space
type: string
enum:
- host
ports:
description: "List of ports to be exposed to access to the Elastic Agent"
type: array
items:
type: string
description: Port to be exposed, as defined in https://docs.docker.com/compose/compose-file/compose-file-v2/#ports
examples:
- "3000"
- "8000:8000"
- "127.0.0.1:7443:7443"
- "8000:8000/udp"
linux_capabilities:
description: "Linux Capabilities that must been enabled in the system to run the Elastic Agent process"
type: array
items:
type: string
description: Capability name
# https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities
enum:
- AUDIT_CONTROL
- AUDIT_READ
- AUDIT_WRITE
- BLOCK_SUSPEND
- BPF
- CHECKPOINT_RESTORE
- CHOWN
- DAC_OVERRIDE
- DAC_READ_SEARCH
- FOWNER
- FSETID
- IPC_LOCK
- IPC_OWNER
- KILL
- LEASE
- LINUX_IMMUTABLE
- MAC_ADMIN
- MAC_OVERRIDE
- MKNOD
- NET_ADMIN
- NET_BIND_SERVICE
- NET_BROADCAST
- NET_RAW
- PERFORM
- SETFCAP
- SETGID
- SETPCAP
- SETUID
- SYS_ADMIN
- SYS_BOOT
- SYS_CHROOT
- SYS_MODULE
- SYS_NICE
- SYS_PACCT
- SYS_PTRACE
- SYS_RAWIO
- SYS_RESOURCE
- SYS_TIME
- SYS_TTY_CONFIG
- SYSLOG
- WAKE_ALARM
examples:
- AUDIT_CONTROL
- AUDIT_READ
provisioning_script:
description: "Optional: Custom script to be run to update environment where Elastic Agent runs (e.g. installing new libraries/dependencies)"
type: object
additionalProperties: false
properties:
language:
description: "Programming language to run the script."
type: string
examples:
- "sh"
- "bash"
- "python"
default: "sh"
contents:
description: "Contents of the script."
type: string
default: ""
required:
- contents
pre_start_script:
description: "Optional: Custom sh script to be run to set required changes for the Elastic Agent process (e.g. export environment variables)"
type: object
additionalProperties: false
properties:
language:
description: "Programming language to run the script. Currently, just supported \"sh\"."
type: string
enum:
- sh
default: sh
contents:
description: "Contents of the script."
type: string
default: ""
required:
- contents
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
wait_for_data_timeout: 10m
vars: ~
agent:
runtime: docker
user: root
pid_mode: host
linux_capabilities:
- AUDIT_CONTROL
ports:
- 127.0.0.0:8000:8000
- 8888:8888
provisioning_script:
language: bash
contents: |
mkdir -p /testfolder/
pre_start_script:
language: sh
contents: |
export PATH=${PATH}:/testfolder/
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: ~
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
description: Pipeline for processing sample logs
processors:
- set:
field: sample_field
value: "1"
on_failure:
- set:
field: error.message
value: '{{ _ingest.on_failure_message }}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- 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.
13 changes: 13 additions & 0 deletions test/packages/good_v3/data_stream/agent_settings/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
title: "Agent Settings"
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
6 changes: 2 additions & 4 deletions test/packages/good_v3/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ policy_templates:
description: Collect logs and metrics from Apache instances
deployment_modes:
agentless:
enabled:
true
enabled: true
inputs:
- type: apache/metrics
title: Collect metrics from Apache instances
Expand Down Expand Up @@ -69,8 +68,7 @@ policy_templates:
description: Collect logs and metrics from Apache instances in agentless
deployment_modes:
agentless:
enabled:
true
enabled: true
inputs:
- type: apache/metrics
title: Collect metrics in agentless
Expand Down

0 comments on commit 9da309f

Please sign in to comment.