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 support for running tests in containers #244

Merged
merged 8 commits into from
Nov 28, 2024

Conversation

ekoops
Copy link
Contributor

@ekoops ekoops commented Nov 26, 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 support for running tests inside containers.

At the moment the containers handling is done by leveraging the containerd API.

If the user specifies that want to run a test inside a container, the test process chain is built inside the container. The event-generator image is used to instantiate containers. If the user specifies a different image name from the base one, the base one is tagged with the provided name. The user can also specify a custom container name and/or additional environment variables to provide to the container.

Besides the root process, using a container for testing always means adding 1 process to the process chain: for this reason, in case no other processes are specified in the process chain, we avoid to add the default process.

In order to use useradd and userdel inside the event-generator container, the base image Dockerfile has been updated to use debian-based slim images.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

ekoops and others added 6 commits November 26, 2024 17:37
Add container context fields documentation and the env field.

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]>
ekoops and others added 2 commits November 26, 2024 18:01
Enhance process labels propagation system to propagate container
image and name information.

Signed-off-by: Leonardo Di Giovanna <[email protected]>
Co-authored-by: Aldo Lacuku <[email protected]>
Omit default process injection if the test must be run inside a
container, since spawning a container already involves a process
creation.

Signed-off-by: Leonardo Di Giovanna <[email protected]>
Co-authored-by: Aldo Lacuku <[email protected]>
@ekoops ekoops changed the title wip: feat(decl): add support for running tests in containers feat(decl): add support for running tests in containers Nov 26, 2024
Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

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

/approve

@poiana
Copy link

poiana commented Nov 28, 2024

LGTM label has been added.

Git tree hash: ef2da231263894559d557a85fa26e59d6e2f4dca

@poiana
Copy link

poiana commented Nov 28, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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 merged commit 723aaff into falcosecurity:declarative-testing Nov 28, 2024
5 of 6 checks passed
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