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
Failed to generate hash of commit
32 changed files with 37 additions and 40 deletions

View file

@ -3,10 +3,9 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
setup_file() { setup_file() {
aa_setup
skip skip
} }

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "aa-status: Check status" { @test "aa-status: Check status" {
sudo aa-status sudo aa-status

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "gpgconf: List all components" { @test "gpgconf: List all components" {
gpgconf --list-components gpgconf --list-components

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "ps: List all running processes" { @test "ps: List all running processes" {
ps aux ps aux

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "sysctl: Show all available variables and their values" { @test "sysctl: Show all available variables and their values" {
sysctl -a sysctl -a
@ -24,4 +24,3 @@ load common
@test "sysctl: Apply changes from `/etc/sysctl.conf`" { @test "sysctl: Apply changes from `/etc/sysctl.conf`" {
sysctl -p sysctl -p
} }

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "w: Display information about all users who are currently logged in" { @test "w: Display information about all users who are currently logged in" {
w w
@ -12,3 +12,8 @@ load common
@test "w: Display information about a specific user" { @test "w: Display information about a specific user" {
w root w root
} }
@test "w: Display information without including the header, the login, JCPU and PCPU columns" {
w --no-header
w --short
}

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "groupadd: Create a new group" { @test "groupadd: Create a new group" {
sudo groupadd user2 sudo groupadd user2

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "groups: Print group memberships for the current user" { @test "groups: Print group memberships for the current user" {
groups groups

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
setup_file() { setup_file() {
sudo systemctl start systemd-homed sudo systemctl start systemd-homed

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "hostnamectl: Get the hostname of the computer" { @test "hostnamectl: Get the hostname of the computer" {
hostnamectl hostnamectl

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "systemd-ac-power: Report whether we are connected to an external power source." { @test "systemd-ac-power: Report whether we are connected to an external power source." {
systemd-ac-power || true systemd-ac-power || true

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "systemd-analyze: List all running units, ordered by the time they took to initialize" { @test "systemd-analyze: List all running units, ordered by the time they took to initialize" {
systemd-analyze --no-pager blame systemd-analyze --no-pager blame
@ -16,5 +16,3 @@ load common
@test "systemd-analyze: Show security scores of running units" { @test "systemd-analyze: Show security scores of running units" {
systemd-analyze --no-pager security systemd-analyze --no-pager security
} }

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "systemd-cat: Write the output of the specified command to the journal (both output streams are captured)" { @test "systemd-cat: Write the output of the specified command to the journal (both output streams are captured)" {
systemd-cat pwd systemd-cat pwd

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "systemd-cgls: Display the whole control group hierarchy on your system" { @test "systemd-cgls: Display the whole control group hierarchy on your system" {
systemd-cgls --no-pager systemd-cgls --no-pager
@ -16,4 +16,3 @@ load common
@test "systemd-cgls: Display the control group hierarchy of one or more systemd units" { @test "systemd-cgls: Display the control group hierarchy of one or more systemd units" {
systemd-cgls --no-pager --unit systemd-logind systemd-cgls --no-pager --unit systemd-logind
} }

View file

@ -3,23 +3,20 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "systemd-detect-virt: List detectable virtualization technologies" { @test "systemd-detect-virt: List detectable virtualization technologies" {
systemd-detect-virt --list systemd-detect-virt --list
} }
# bats test_tags=systemd-detect-virt
@test "systemd-detect-virt: Detect virtualization, print the result and return a zero status code when running in a VM or a container, and a non-zero code otherwise" { @test "systemd-detect-virt: Detect virtualization, print the result and return a zero status code when running in a VM or a container, and a non-zero code otherwise" {
systemd-detect-virt || true systemd-detect-virt || true
} }
# bats test_tags=systemd-detect-virt
@test "systemd-detect-virt: Silently check without printing anything" { @test "systemd-detect-virt: Silently check without printing anything" {
systemd-detect-virt --quiet || true systemd-detect-virt --quiet || true
} }
# bats test_tags=systemd-detect-virt
@test "systemd-detect-virt: Only detect hardware virtualization" { @test "systemd-detect-virt: Only detect hardware virtualization" {
systemd-detect-virt --vm || true systemd-detect-virt --vm || true
} }

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "systemd-id128: Generate a new random identifier" { @test "systemd-id128: Generate a new random identifier" {
systemd-id128 new systemd-id128 new

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "systemd-sysusers: Print the contents of all configuration files (before each file, its name is printed as a comment)" { @test "systemd-sysusers: Print the contents of all configuration files (before each file, its name is printed as a comment)" {
systemd-sysusers --cat-config systemd-sysusers --cat-config

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "userdbctl: List all known user records" { @test "userdbctl: List all known user records" {
userdbctl --no-pager user userdbctl --no-pager user

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "lsusb: List all the USB devices available" { @test "lsusb: List all the USB devices available" {
lsusb || true lsusb || true

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "blkid: List all partitions" { @test "blkid: List all partitions" {
sudo blkid sudo blkid

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "chsh: list available shells" { @test "chsh: list available shells" {
chsh --list-shells || true chsh --list-shells || true

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "df: Display all filesystems and their disk usage" { @test "df: Display all filesystems and their disk usage" {
df df

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "dmesg: Show kernel messages" { @test "dmesg: Show kernel messages" {
sudo dmesg sudo dmesg

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "lsblk: List all storage devices in a tree-like format" { @test "lsblk: List all storage devices in a tree-like format" {
lsblk lsblk

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "lscpu: Display information about all CPUs" { @test "lscpu: Display information about all CPUs" {
lscpu lscpu

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "lspci: Show a brief list of devices" { @test "lspci: Show a brief list of devices" {
lspci lspci

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "pstree: Display a tree of processes" { @test "pstree: Display a tree of processes" {
pstree pstree

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "sync: Flush all pending write operations on all disks" { @test "sync: Flush all pending write operations on all disks" {
sync sync

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "users: Print logged in usernames" { @test "users: Print logged in usernames" {
users users

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "uuidd: Generate a random UUID" { @test "uuidd: Generate a random UUID" {
uuidd --random uuidd --random

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "uuidgen: Create a random UUIDv4" { @test "uuidgen: Create a random UUIDv4" {
uuidgen --random uuidgen --random

View file

@ -3,7 +3,7 @@
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
load common load ../common
@test "who: Display the username, line, and time of all currently logged-in sessions" { @test "who: Display the username, line, and time of all currently logged-in sessions" {
who who