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

Add app integeration test #23

Merged
merged 1 commit into from
Jun 24, 2024
Merged

Conversation

msherif1234
Copy link
Contributor

@msherif1234 msherif1234 commented Jun 13, 2024

depends on
#6
bpfman/bpfman#1154

Copy link

codecov bot commented Jun 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 27.08%. Comparing base (5fc5db8) to head (40f93c8).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #23      +/-   ##
==========================================
- Coverage   27.10%   27.08%   -0.02%     
==========================================
  Files          81       81              
  Lines        6837     6844       +7     
==========================================
+ Hits         1853     1854       +1     
- Misses       4800     4806       +6     
  Partials      184      184              
Flag Coverage Δ
unittests 27.08% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@msherif1234 msherif1234 force-pushed the add-app-intg-test branch 3 times, most recently from d1abc8f to 86fa441 Compare June 14, 2024 11:42
@msherif1234 msherif1234 force-pushed the add-app-intg-test branch 4 times, most recently from eb8b8d2 to 262dc24 Compare June 22, 2024 10:38
func doKprobeCheck(t *testing.T, output *bytes.Buffer) bool {
str := `Kprobe count: ([0-9]+)`
if ok, count := doProbeCommonCheck(t, output, str); ok {
t.Logf("counted %d application executions so far, BPF program is functioning", count)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
t.Logf("counted %d application executions so far, BPF program is functioning", count)
t.Logf("counted %d kprobe executions so far, BPF program is functioning", count)

func doAppKprobeCheck(t *testing.T, output *bytes.Buffer) bool {
str := `Kprobe: count: ([0-9]+)`
if ok, count := doProbeCommonCheck(t, output, str); ok {
t.Logf("counted %d application executions so far, BPF program is functioning", count)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
t.Logf("counted %d application executions so far, BPF program is functioning", count)
t.Logf("counted %d kprobe executions so far, BPF program is functioning", count)

return false
}

func doAppKprobeCheck(t *testing.T, output *bytes.Buffer) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just an observation, but I changed the logs for the application example so they had a similar format and it was more clear to me that all the code was running. As a result we need separate checks here.

Copy link
Contributor

@anfredette anfredette left a comment

Choose a reason for hiding this comment

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

I'm just seeing kprobe, tracepoint and uprobe logs in the test output:

=== RUN   TestApplicationGoCounter
    app_test.go:26: deploying target required for uprobe counter program if its not already deployed
    app_test.go:29: waiting for go target userspace daemon to be available
    app_test.go:38: deploying application counter program
    app_test.go:45: waiting for go application counter userspace daemon to be available
    common.go:28: counted 139291 application executions so far, BPF program is functioning
    common.go:73: counted 3 SIGUSR1 signals so far, BPF program is functioning
    common.go:91: counted 12 uprobe executions so far, BPF program is functioning
--- PASS: TestApplicationGoCounter (46.87s)

What happened to the TC and XDP checks?

@anfredette
Copy link
Contributor

anfredette commented Jun 24, 2024

I see what's happening. The kprobe, tracepoint and uprobe checks have a log, but the TC and XDP checks don't. However, the other tests also dump the log, so you can still tell that it's functioning when looking at the test log. I think it would be good to have "BPF program is functioning" logs for TC and XDP too.


func doTcCheck(t *testing.T, output *bytes.Buffer) bool {
if strings.Contains(output.String(), "packets received") && strings.Contains(output.String(), "bytes received") {
return true
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a "BPF program is functioning" log for the TC and XDP checks as is done for the other types.

@anfredette
Copy link
Contributor

I have a few minor requests for some log changes, but otherwise, this looks good to me. Thanks!

Signed-off-by: Mohamed Mahmoud <[email protected]>
Copy link
Contributor

@anfredette anfredette left a comment

Choose a reason for hiding this comment

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

LGTM

@mergify mergify bot merged commit e1574d6 into bpfman:main Jun 24, 2024
12 checks passed
msherif1234 added a commit to msherif1234/bpfman-operator that referenced this pull request Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants