tests(integration): move most test inside groups.

This commit is contained in:
Alexandre Pujol 2025-03-02 00:00:08 +01:00
parent eba7357cb1
commit 86aba45d67
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
32 changed files with 37 additions and 40 deletions

View file

@ -0,0 +1,14 @@
#!/usr/bin/env bats
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
load ../common
@test "blkid: List all partitions" {
sudo blkid
}
@test "blkid: List all partitions in a table, including current mountpoints" {
sudo blkid -o list
}

View file

@ -0,0 +1,19 @@
#!/usr/bin/env bats
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
load ../common
@test "chsh: list available shells" {
chsh --list-shells || true
}
@test "chsh: Set a specific login shell for the current user" {
echo "$PASSWORD" | chsh --shell /usr/bin/bash
}
# bats test_tags=chsh
@test "chsh: Set a login shell for a specific user" {
sudo chsh --shell /usr/bin/sh root
}

View file

@ -0,0 +1,26 @@
#!/usr/bin/env bats
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
load ../common
@test "df: Display all filesystems and their disk usage" {
df
}
@test "df: Display all filesystems and their disk usage in human-readable form" {
df -h
}
@test "df: Display the filesystem and its disk usage containing the given file or directory" {
df apparmor.d/
}
@test "df: Include statistics on the number of free inodes" {
df --inodes
}
@test "df: Display filesystem types" {
df --print-type
}

View file

@ -0,0 +1,30 @@
#!/usr/bin/env bats
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
load ../common
@test "dmesg: Show kernel messages" {
sudo dmesg
}
@test "dmesg: Show kernel error messages" {
sudo dmesg --level err
}
@test "dmesg: Show how much physical memory is available on this system" {
sudo dmesg | grep -i memory
}
@test "dmesg: Show kernel messages with a timestamp (available in kernels 3.5.0 and newer)" {
sudo dmesg -T
}
@test "dmesg: Show kernel messages in human-readable form (available in kernels 3.5.0 and newer)" {
sudo dmesg -H
}
@test "dmesg: Colorize output (available in kernels 3.5.0 and newer)" {
sudo dmesg -L
}

View file

@ -0,0 +1,38 @@
#!/usr/bin/env bats
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
load ../common
@test "lsblk: List all storage devices in a tree-like format" {
lsblk
}
@test "lsblk: Also list empty devices" {
lsblk -a
}
@test "lsblk: Print the SIZE column in bytes rather than in a human-readable format" {
lsblk -b
}
@test "lsblk: Output info about filesystems" {
lsblk -f
}
@test "lsblk: Use ASCII characters for tree formatting" {
lsblk -i
}
@test "lsblk: Output info about block-device topology" {
lsblk -t
}
@test "lsblk: Exclude the devices specified by the comma-separated list of major device numbers" {
lsblk -e 1
}
@test "lsblk: Display a customized summary using a comma-separated list of columns" {
lsblk --output NAME,SERIAL,MODEL,TRAN,TYPE,SIZE,FSTYPE,MOUNTPOINT
}

View file

@ -0,0 +1,18 @@
#!/usr/bin/env bats
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
load ../common
@test "lscpu: Display information about all CPUs" {
lscpu
}
@test "lscpu: Display information in a table" {
lscpu --extended
}
@test "lscpu: Display only information about offline CPUs in a table" {
lscpu --extended --offline
}

View file

@ -0,0 +1,26 @@
#!/usr/bin/env bats
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
load ../common
@test "lspci: Show a brief list of devices" {
lspci
}
@test "lspci: Display additional info" {
lspci -v
}
@test "lspci: Display drivers and modules handling each device" {
lspci -k
}
@test "lspci: Show a specific device" {
lspci -s 00:00.0
}
@test "lspci: Dump info in a readable form" {
lspci -vm
}

View file

@ -0,0 +1,19 @@
#!/usr/bin/env bats
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
load ../common
@test "pstree: Display a tree of processes" {
pstree
}
@test "pstree: Display a tree of processes with PIDs" {
pstree -p
}
@test "pstree: Display all process trees rooted at processes owned by specified user" {
pstree root
}

View file

@ -0,0 +1,14 @@
#!/usr/bin/env bats
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
load ../common
@test "sync: Flush all pending write operations on all disks" {
sync
}
@test "sync: Flush all pending write operations on a single file to disk" {
sudo sync /
}

View file

@ -0,0 +1,15 @@
#!/usr/bin/env bats
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
load ../common
@test "users: Print logged in usernames" {
users
}
@test "users: Print logged in usernames according to a given file" {
users /var/log/wmtp
}

View file

@ -0,0 +1,18 @@
#!/usr/bin/env bats
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
load ../common
@test "uuidd: Generate a random UUID" {
uuidd --random
}
@test "uuidd: Generate a bulk number of random UUIDs" {
uuidd --random --uuids 10
}
@test "uuidd: Generate a time-based UUID, based on the current time and MAC address of the system" {
uuidd --time
}

View file

@ -0,0 +1,14 @@
#!/usr/bin/env bats
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
load ../common
@test "uuidgen: Create a random UUIDv4" {
uuidgen --random
}
@test "uuidgen: Create a UUIDv1 based on the current time" {
uuidgen --time
}

View file

@ -0,0 +1,19 @@
#!/usr/bin/env bats
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
load ../common
@test "who: Display the username, line, and time of all currently logged-in sessions" {
who
}
@test "who: Display all available information" {
who -a
}
@test "who: Display all available information with table headers" {
who -a -H
}