tests(integration): move most test inside groups.
This commit is contained in:
parent
eba7357cb1
commit
86aba45d67
32 changed files with 37 additions and 40 deletions
14
tests/integration/utils/blkid.bats
Normal file
14
tests/integration/utils/blkid.bats
Normal 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
|
||||
}
|
||||
19
tests/integration/utils/chsh.bats
Normal file
19
tests/integration/utils/chsh.bats
Normal 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
|
||||
}
|
||||
26
tests/integration/utils/df.bats
Normal file
26
tests/integration/utils/df.bats
Normal 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
|
||||
}
|
||||
30
tests/integration/utils/dmesg.bats
Normal file
30
tests/integration/utils/dmesg.bats
Normal 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
|
||||
}
|
||||
38
tests/integration/utils/lsblk.bats
Normal file
38
tests/integration/utils/lsblk.bats
Normal 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
|
||||
}
|
||||
18
tests/integration/utils/lscpu.bats
Normal file
18
tests/integration/utils/lscpu.bats
Normal 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
|
||||
}
|
||||
26
tests/integration/utils/lspci.bats
Normal file
26
tests/integration/utils/lspci.bats
Normal 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
|
||||
}
|
||||
19
tests/integration/utils/pstree.bats
Normal file
19
tests/integration/utils/pstree.bats
Normal 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
|
||||
}
|
||||
|
||||
14
tests/integration/utils/sync.bats
Normal file
14
tests/integration/utils/sync.bats
Normal 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 /
|
||||
}
|
||||
15
tests/integration/utils/users.bats
Normal file
15
tests/integration/utils/users.bats
Normal 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
|
||||
}
|
||||
|
||||
18
tests/integration/utils/uuidd.bats
Normal file
18
tests/integration/utils/uuidd.bats
Normal 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
|
||||
}
|
||||
14
tests/integration/utils/uuidgen.bats
Normal file
14
tests/integration/utils/uuidgen.bats
Normal 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
|
||||
}
|
||||
19
tests/integration/utils/who.bats
Normal file
19
tests/integration/utils/who.bats
Normal 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
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue