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

tests: replace panic with t.Fatal, upgrade to latest base image for vmtests and fix enforcer tests #2685

Merged
merged 5 commits into from
Jul 18, 2024

Conversation

kevsecurity
Copy link
Contributor

@kevsecurity kevsecurity commented Jul 17, 2024

Related to #2686.

Panicking in tests is bad as it fails to tell the test handler that the test failed. Instead we should use t.Fatal(). This commit changes instances of panic in tests to t.Fatal().

Panicking in tests is bad as it fails to tell the test handler that the
test failed. Instead we should use t.Fatal(). This commit changes
instances of panic in tests to t.Fatal().

Signed-off-by: Kevin Sheldrake <[email protected]>
@kevsecurity kevsecurity added the release-note/misc This PR makes changes that have no direct user impact. label Jul 17, 2024
@kevsecurity kevsecurity requested a review from a team as a code owner July 17, 2024 15:52
@kevsecurity kevsecurity requested a review from olsajiri July 17, 2024 15:52
Copy link
Member

@mtardy mtardy left a comment

Choose a reason for hiding this comment

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

Okay good so the CI is failing as expected now. I still don't understand why "panic" made it not fail on main and v1.1, but fail on v1.0. I have a patch to add the netcat.openbsd cilium/little-vm-helper-images#582 on base image which is a reasonable fix that we can integrate into that PR when it's ready.

Is it okay if I push to this PR?

@kevsecurity
Copy link
Contributor Author

Okay good so the CI is failing as expected now. I still don't understand why "panic" made it not fail on main and v1.1, but fail on v1.0. I have a patch to add the netcat.openbsd cilium/little-vm-helper-images#582 on base image which is a reasonable fix that we can integrate into that PR when it's ready.

Is it okay if I push to this PR?

Push away; I made it for you!

@mtardy
Copy link
Member

mtardy commented Jul 17, 2024

Ok thanks.

Because of root-images update in previous commit, the enforcer security
tests started failing, after investigation we realized that the
difference was that the old image mounted /tmp on the disk fs and the
new one with tmpfs. Then the direct-write-tester.c program was failing
using O_DIRECT (because apparently it fails on tmpfs). It failed
silently on recent linux versions however because O_DIRECT on tmpfs
might just be a noop.

/var/tmp should be backed by disk so it should be a fix for our issue.

Signed-off-by: Mahe Tardy <[email protected]>
@mtardy mtardy added the area/ci Related to CI label Jul 18, 2024
O_DIRECT is not posix so we need to add _GNU_SOURCE

Co-authored-by: Jiri Olsa <[email protected]>
Signed-off-by: Mahe Tardy <[email protected]>
@mtardy mtardy force-pushed the pr/kevsecurity/change-panic-to-fatal-in-tests branch from c7c7e52 to f7f227e Compare July 18, 2024 11:33
Copy link
Contributor

@olsajiri olsajiri left a comment

Choose a reason for hiding this comment

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

thanks

Use the output returned by Fatal instead of passing stuff to printf

Signed-off-by: Mahe Tardy <[email protected]>
@mtardy mtardy changed the title Test: Change panic to t.Fatal tests: replace panic with t.Fatal, upgrade to latest base image for vmtests and fix enforcer tests Jul 18, 2024
@mtardy mtardy merged commit 057d734 into main Jul 18, 2024
41 checks passed
@mtardy mtardy deleted the pr/kevsecurity/change-panic-to-fatal-in-tests branch July 18, 2024 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci Related to CI release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
3 participants