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,44 @@
#!/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
setup_file() {
sudo systemctl start systemd-homed
skip
aa_setup
}
@test "homectl: Display help" {
homectl --no-pager --help
}
@test "homectl: Create a user account and their associated home directory" {
sudo homectl create user2
}
@test "homectl: List user accounts and their associated home directories" {
homectl list
}
@test "homectl: Change the password for a specific user" {
sudo homectl passwd user2
}
@test "homectl: Run a shell or a command with access to a specific home directory" {
sudo homectl with user2 -- ls -al /home/user2
}
@test "homectl: Lock or unlock a specific home directory" {
sudo homectl lock user2
}
@test "homectl: Change the disk space assigned to a specific home directory to 100 GiB" {
sudo homectl resize user2 1G
}
@test "homectl: Remove a specific user and the associated home directory" {
sudo homectl remove user2
}

View file

@ -0,0 +1,20 @@
#!/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 "hostnamectl: Get the hostname of the computer" {
hostnamectl
}
@test "hostnamectl: Get the location of the computer" {
hostnamectl location
}
@test "hostnamectl: Set the hostname of the computer" {
name=$(hostnamectl hostname)
sudo hostnamectl set-hostname "new"
sudo hostnamectl set-hostname "$name"
}

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 "systemd-ac-power: Report whether we are connected to an external power source." {
systemd-ac-power || true
}
@test "systemd-ac-power: Check if battery is discharging and low" {
systemd-ac-power --low || true
}

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 "systemd-analyze: List all running units, ordered by the time they took to initialize" {
systemd-analyze --no-pager blame
}
@test "systemd-analyze: Print a tree of the time-critical chain of units" {
systemd-analyze --no-pager critical-chain
}
@test "systemd-analyze: Show security scores of running units" {
systemd-analyze --no-pager security
}

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 "systemd-cat: Write the output of the specified command to the journal (both output streams are captured)" {
systemd-cat pwd
}
@test "systemd-cat: Write the output of a pipeline to the journal (`stderr` stays connected to the terminal)" {
echo apparmor.d-test-suite | systemd-cat
}

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 "systemd-cgls: Display the whole control group hierarchy on your system" {
systemd-cgls --no-pager
}
@test "systemd-cgls: Display a control group tree of a specific resource controller" {
systemd-cgls --no-pager io
}
@test "systemd-cgls: Display the control group hierarchy of one or more systemd units" {
systemd-cgls --no-pager --unit systemd-logind
}

View file

@ -0,0 +1,23 @@
#!/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 "systemd-detect-virt: List detectable virtualization technologies" {
systemd-detect-virt --list
}
@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
}
@test "systemd-detect-virt: Silently check without printing anything" {
systemd-detect-virt --quiet || true
}
@test "systemd-detect-virt: Only detect hardware virtualization" {
systemd-detect-virt --vm || true
}

View file

@ -0,0 +1,23 @@
#!/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 "systemd-id128: Generate a new random identifier" {
systemd-id128 new
}
@test "systemd-id128: Print the identifier of the current machine" {
systemd-id128 machine-id
}
@test "systemd-id128: Print the identifier of the current boot" {
systemd-id128 boot-id
}
@test "systemd-id128: Generate a new random identifier and print it as a UUID (five groups of digits separated by hyphens)" {
systemd-id128 new --uuid
}

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 "systemd-sysusers: Print the contents of all configuration files (before each file, its name is printed as a comment)" {
systemd-sysusers --cat-config
}
@test "systemd-sysusers: Process configuration files and print what would be done without actually doing anything" {
systemd-sysusers --dry-run
}
@test "systemd-sysusers: Create users and groups from all configuration file" {
sudo systemd-sysusers
}

View file

@ -0,0 +1,27 @@
#!/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 "userdbctl: List all known user records" {
userdbctl --no-pager user
}
@test "userdbctl: Show details of a specific user" {
userdbctl --no-pager user "$USER"
}
@test "userdbctl: List all known groups" {
userdbctl --no-pager group
}
@test "userdbctl: Show details of a specific group" {
sudo userdbctl --no-pager group "$USER"
}
@test "userdbctl: List all services currently providing user/group definitions to the system" {
userdbctl --no-pager services
}