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 process test resource and kill system call test step #241

Merged
merged 7 commits into from
Nov 19, 2024

Conversation

ekoops
Copy link
Contributor

@ekoops ekoops commented Nov 19, 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 introduces the process test resource and the kill system call test step. The process test resources is required to test the rules involving processes manipulation, such as killing a process or tracing it. The code for creating a configurable process has been exported in a separate package process, and it is leveraged by the host runner and the process resource. Moreover, this PR fixes some minor style issues.

The following is a yaml sample to test the behaviour:

tests:
  - name: test_kill_and_process_res
    rule: "-"
    description: "Testing kill system call and process resource"
    runner: HostRunner
    resources:
      - type: process
        name: p1
    before: |
      echo "Beginning test..."
    steps:
      - type: syscall
        name: k1
        syscall: kill
        args:
          pid: "${p1.pid}"
          sig: SIGKILL
    after: |
      echo "Test ended"

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Abstract process creation through a new process package.

Signed-off-by: Leonardo Di Giovanna <[email protected]>
Co-authored-by: Aldo Lacuku <[email protected]>
@poiana poiana requested review from alacuku and leogr November 19, 2024 14:55
@ekoops ekoops changed the title Ekoops/proc and kill feat(decl): add process test resource and kill system call test step Nov 19, 2024
ekoops and others added 6 commits November 19, 2024 18:31
Signed-off-by: Leonardo Di Giovanna <[email protected]>
Co-authored-by: Aldo Lacuku <[email protected]>
Signed-off-by: Leonardo Di Giovanna <[email protected]>
Co-authored-by: Aldo Lacuku <[email protected]
Signed-off-by: Leonardo Di Giovanna <[email protected]>
Co-authored-by: Aldo Lacuku <[email protected]>
Signed-off-by: Leonardo Di Giovanna <[email protected]>
Co-authored-by: Aldo Lacuku <[email protected]>
Signed-off-by: Leonardo Di Giovanna <[email protected]>
Co-authored-by: Aldo Lacuku <[email protected]>
@poiana
Copy link

poiana commented Nov 19, 2024

[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
Copy link

poiana commented Nov 19, 2024

LGTM label has been added.

Git tree hash: a2624c88cc6e292476c137e9c1fb25bbce596395

@leogr
Copy link
Member

leogr commented Nov 19, 2024

/hold

@leogr
Copy link
Member

leogr commented Nov 19, 2024

/unhold

@poiana poiana merged commit 4194bf7 into falcosecurity:declarative-testing Nov 19, 2024
5 of 6 checks passed
@ekoops ekoops deleted the ekoops/proc-and-kill branch November 20, 2024 08:17
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