Skip to content

pkg/sysinfo: cleanup tests#49189

Merged
thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah:pkg_sysinfo_cleanup_tests
Jan 2, 2025
Merged

pkg/sysinfo: cleanup tests#49189
thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah:pkg_sysinfo_cleanup_tests

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

  • use t.TempDir()
  • combine various tests to check if New() sets expected values instead of skipping tests when not.
  • remove gotest.tools, as it was only used minimally
  • replace uses of "path" for filepath operations.

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah thaJeztah added status/2-code-review kind/refactor PR's that refactor, or clean-up code labels Jan 1, 2025
@thaJeztah thaJeztah added this to the 28.0.0 milestone Jan 1, 2025
@thaJeztah thaJeztah self-assigned this Jan 1, 2025
// Check if AppArmor is supported. then it must be TRUE , else FALSE
if _, err := os.Stat("/sys/kernel/security/apparmor"); err != nil {
t.Skip("AppArmor Must be Enabled")
if expected := seccomp.IsEnabled(); sysInfo.Seccomp != expected {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Starting to consider if we should create a local copy of this instead of depending on containerd's seccomp package, because it's really minimal. We could even consider moving it into our profiles/seccomp package, but perhaps that's not needed if we only use it here.

(this is the only package where we import containerd's pkg/seccomp)

Comment thread pkg/sysinfo/sysinfo_linux_test.go Outdated
- use t.TempDir()
- combine various tests to check if New() sets expected values instead
  of skipping tests when not.
- remove gotest.tools, as it was only used minimally
- replace uses of "path" for filepath operations.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah force-pushed the pkg_sysinfo_cleanup_tests branch from 46173b9 to 547151a Compare January 2, 2025 15:51
@thaJeztah thaJeztah merged commit 35cfb6f into moby:master Jan 2, 2025
@thaJeztah thaJeztah deleted the pkg_sysinfo_cleanup_tests branch January 2, 2025 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactor PR's that refactor, or clean-up code status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants