Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(decl): add explain command #255

Merged
merged 3 commits into from
Jan 7, 2025

Conversation

ekoops
Copy link
Contributor

@ekoops ekoops commented Dec 25, 2024

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind documentation

/kind tests

/kind feature

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area commands

/area pkg

/area events

What this PR does / why we need it:

This PR adds the explain command to the declarative namespace. The explain command can produce documentation for different YAML tests description properties, as requested by the user. The following are some invocation examples:

# Generate documentation for properties directly available under the YAML document root
event-generator declarative explain

# Generate documentation for all properties in the property path leading to the `processes`
# property (i.e.: document `tests`, `context` and `processes` properties), as well as any property
# available under `processes`
event-generator declarative explain tests.context.processes

# Generate documentation for all properties in the property path leading to the `how` property
# (i.e.: document `tests`, `steps`, `args` and `how` properties), as well as any property available
# under `how`.
event-generator declarative explain tests.steps{type=syscall}{syscall=openat2}.args.how

In the last example, the expression {type=syscall}{syscall=openat2} contains two "enum requirements". An enum requirement sets the value for an enum property, unlocking additional properties that are available only for that specific value of the enum: in the aforementioned example,

  • the syscall enum property is available under steps only if the enum property type is set to syscall;
  • the args property is availaable under steps only if the enum property syscall is set to openat2

The documentation output format is by default a custom textual representation, similar to YAML. The user can select the YAML encoding by using the (--format|-f) yaml flag.

For additional details, see event-generator declarative explain --help.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

ekoops and others added 3 commits January 7, 2025 09:46
Signed-off-by: Leonardo Di Giovanna <[email protected]>
Co-authored-by: Aldo Lacuku <[email protected]>
Add explain command to output YAML tests description documentation.

Signed-off-by: Leonardo Di Giovanna <[email protected]>
Co-authored-by: Aldo Lacuku <[email protected]>
Add support for YAML format encoding of the output documention.

Signed-off-by: Leonardo Di Giovanna <[email protected]>
Co-authored-by: Aldo Lacuku <[email protected]>
@poiana poiana added the lgtm label Jan 7, 2025
@poiana
Copy link

poiana commented Jan 7, 2025

LGTM label has been added.

Git tree hash: 06f8523811c06e04c0e7838deabc5125364369db

@poiana
Copy link

poiana commented Jan 7, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ekoops, leogr

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana added the approved label Jan 7, 2025
@poiana poiana merged commit 5968034 into falcosecurity:declarative-testing Jan 7, 2025
5 of 6 checks passed
@ekoops ekoops deleted the ekoops/explain branch January 7, 2025 14:04
@leogr leogr added this to the v0.13.0 milestone Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants