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

test for retrieving exit code #634

Closed
kkourt opened this issue Jan 17, 2023 · 3 comments · Fixed by #852
Closed

test for retrieving exit code #634

kkourt opened this issue Jan 17, 2023 · 3 comments · Fixed by #852
Labels
area/ci Related to CI good first issue Good for newcomers

Comments

@kkourt
Copy link
Contributor

kkourt commented Jan 17, 2023

Add a test to check that tetragon returns the exit code of the process correctly. (see: #630)

@zhy76
Copy link
Contributor

zhy76 commented Mar 22, 2023

I'm interested in this, but I'm new here, could you give me more suggestion?

@kkourt
Copy link
Contributor Author

kkourt commented Mar 28, 2023

Programs have an exit code that indicate whether there is an error or not. In a shell such as bash, the error code is accessible via the $? environment variable.

E.g.,

$ bash -c 'exit 42'
$ echo $?
42

The purpose here is to write a test that executes such a program and checks that the status value in Tetragon exit event (see: https://github.com/cilium/tetragon/tree/main/api/v1#tetragon-ProcessExit) is the actual exit value.

Some example tests can be found in: https://github.com/cilium/tetragon/blob/main/pkg/sensors/exec/exit_test.go

@zhy76
Copy link
Contributor

zhy76 commented Mar 28, 2023

Programs have an exit code that indicate whether there is an error or not. In a shell such as bash, the error code is accessible via the $? environment variable.

E.g.,

$ bash -c 'exit 42'
$ echo $?
42

The purpose here is to write a test that executes such a program and checks that the status value in Tetragon exit event (see: https://github.com/cilium/tetragon/tree/main/api/v1#tetragon-ProcessExit) is the actual exit value.

Some example tests can be found in: https://github.com/cilium/tetragon/blob/main/pkg/sensors/exec/exit_test.go

Thanks for your advice, I will try to solve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci Related to CI good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants