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
44
tests/integration/systemd/homectl.bats
Normal file
44
tests/integration/systemd/homectl.bats
Normal 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
|
||||
}
|
||||
20
tests/integration/systemd/hostnamectl.bats
Normal file
20
tests/integration/systemd/hostnamectl.bats
Normal 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"
|
||||
}
|
||||
15
tests/integration/systemd/systemd-ac-power.bats
Normal file
15
tests/integration/systemd/systemd-ac-power.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 "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
|
||||
}
|
||||
|
||||
18
tests/integration/systemd/systemd-analyze.bats
Normal file
18
tests/integration/systemd/systemd-analyze.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 "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
|
||||
}
|
||||
14
tests/integration/systemd/systemd-cat.bats
Normal file
14
tests/integration/systemd/systemd-cat.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 "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
|
||||
}
|
||||
18
tests/integration/systemd/systemd-cgls.bats
Normal file
18
tests/integration/systemd/systemd-cgls.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 "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
|
||||
}
|
||||
23
tests/integration/systemd/systemd-detect-virt.bats
Normal file
23
tests/integration/systemd/systemd-detect-virt.bats
Normal 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
|
||||
}
|
||||
|
||||
23
tests/integration/systemd/systemd-id128.bats
Normal file
23
tests/integration/systemd/systemd-id128.bats
Normal 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
|
||||
}
|
||||
|
||||
18
tests/integration/systemd/systemd-sysusers.bats
Normal file
18
tests/integration/systemd/systemd-sysusers.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 "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
|
||||
}
|
||||
27
tests/integration/systemd/userdbctl.bats
Normal file
27
tests/integration/systemd/userdbctl.bats
Normal 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
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue