tests: add a few integration tests.
This commit is contained in:
parent
0c2385fef9
commit
d579b33011
16 changed files with 325 additions and 6 deletions
22
tests/integration/systemd/bootctl.bats
Normal file
22
tests/integration/systemd/bootctl.bats
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bats
|
||||
# apparmor.d - Full set of apparmor profiles
|
||||
# Copyright (C) 2025 Alexandre Pujol <alexandre@pujol.io>
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
load ../common
|
||||
|
||||
@test "bootctl: Show information about the system firmware and the bootloaders" {
|
||||
sudo bootctl status
|
||||
}
|
||||
|
||||
@test "bootctl: Show all available bootloader entries" {
|
||||
sudo bootctl list
|
||||
}
|
||||
|
||||
@test "bootctl: Install 'systemd-boot' into the EFI system partition" {
|
||||
sudo bootctl install
|
||||
}
|
||||
|
||||
@test "bootctl: Remove all installed versions of 'systemd-boot' from the EFI system partition" {
|
||||
sudo bootctl remove
|
||||
}
|
||||
27
tests/integration/systemd/busctl.bats
Normal file
27
tests/integration/systemd/busctl.bats
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bats
|
||||
# apparmor.d - Full set of apparmor profiles
|
||||
# Copyright (C) 2025 Alexandre Pujol <alexandre@pujol.io>
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
load ../common
|
||||
|
||||
@test "busctl: Show all peers on the bus, by their service names" {
|
||||
busctl list
|
||||
}
|
||||
|
||||
@test "busctl: Show process information and credentials of a bus service, a process, or the owner of the bus (if no parameter is specified)" {
|
||||
busctl status 1
|
||||
busctl status org.freedesktop.DBus
|
||||
}
|
||||
|
||||
@test "busctl: Show an object tree of one or more services (or all services if no service is specified)" {
|
||||
busctl tree org.freedesktop.DBus
|
||||
}
|
||||
|
||||
@test "busctl: Show interfaces, methods, properties and signals of the specified object on the specified service" {
|
||||
busctl introspect org.freedesktop.login1 /org/freedesktop/login1
|
||||
}
|
||||
|
||||
@test "busctl: Retrieve the current value of one or more object properties" {
|
||||
busctl get-property org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager Docked
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ setup_file() {
|
|||
}
|
||||
|
||||
@test "homectl: Create a user account and their associated home directory" {
|
||||
sudo homectl create user2
|
||||
printf "user2\nuser2" | sudo homectl create user2
|
||||
}
|
||||
|
||||
@test "homectl: List user accounts and their associated home directories" {
|
||||
|
|
|
|||
30
tests/integration/systemd/journalctl.bats
Normal file
30
tests/integration/systemd/journalctl.bats
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env bats
|
||||
# apparmor.d - Full set of apparmor profiles
|
||||
# Copyright (C) 2025 Alexandre Pujol <alexandre@pujol.io>
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
load ../common
|
||||
|
||||
@test "journalctl: Show all messages with priority level 3 (errors) from this boot" {
|
||||
sudo journalctl -b --priority=3
|
||||
}
|
||||
|
||||
@test "journalctl: Show only the last N lines of the journal" {
|
||||
sudo journalctl --lines 100
|
||||
}
|
||||
|
||||
@test "journalctl: Show all messages by a specific [u]nit" {
|
||||
sudo journalctl --unit apparmor.service
|
||||
}
|
||||
|
||||
@test "journalctl: Show all messages by a specific process" {
|
||||
sudo journalctl _PID=1
|
||||
}
|
||||
|
||||
@test "journalctl: Show all messages by a specific executable" {
|
||||
sudo journalctl /usr/bin/bootctl
|
||||
}
|
||||
|
||||
@test "journalctl: Delete journal logs which are older than 10 seconds" {
|
||||
sudo journalctl --vacuum-time=10s
|
||||
}
|
||||
23
tests/integration/systemd/localectl.bats
Normal file
23
tests/integration/systemd/localectl.bats
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bats
|
||||
# apparmor.d - Full set of apparmor profiles
|
||||
# Copyright (C) 2025 Alexandre Pujol <alexandre@pujol.io>
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
load ../common
|
||||
|
||||
@test "localectl: Show the current settings of the system locale and keyboard mapping" {
|
||||
localectl
|
||||
}
|
||||
|
||||
@test "localectl: List available locales" {
|
||||
localectl list-locales
|
||||
}
|
||||
|
||||
@test "localectl: Set a system locale variable" {
|
||||
sudo localectl set-locale LANG=en_US.UTF-8
|
||||
}
|
||||
|
||||
@test "localectl: Set the system keyboard mapping for the console and X11" {
|
||||
sudo localectl set-keymap uk
|
||||
}
|
||||
|
||||
26
tests/integration/systemd/machinectl.bats
Normal file
26
tests/integration/systemd/machinectl.bats
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bats
|
||||
# apparmor.d - Full set of apparmor profiles
|
||||
# Copyright (C) 2025 Alexandre Pujol <alexandre@pujol.io>
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
load ../common
|
||||
|
||||
@test "importctl: Import an image as a machine" {
|
||||
sudo importctl pull-tar --force --class=machine -N https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64-root.tar.xz noble
|
||||
}
|
||||
|
||||
@test "machinectl: Display a list of available images" {
|
||||
sudo machinectl list-images
|
||||
}
|
||||
|
||||
@test "machinectl: Start a machine as a service using systemd-nspawn" {
|
||||
sudo machinectl start noble
|
||||
}
|
||||
|
||||
@test "machinectl: Display a list of running machines" {
|
||||
sudo machinectl list
|
||||
}
|
||||
|
||||
@test "machinectl: Stop a running machine" {
|
||||
sudo machinectl stop noble
|
||||
}
|
||||
18
tests/integration/systemd/networkctl.bats
Normal file
18
tests/integration/systemd/networkctl.bats
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env bats
|
||||
# apparmor.d - Full set of apparmor profiles
|
||||
# Copyright (C) 2025 Alexandre Pujol <alexandre@pujol.io>
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
load ../common
|
||||
|
||||
@test "networkctl: List existing links with their status" {
|
||||
sudo networkctl list
|
||||
}
|
||||
|
||||
@test "networkctl: Show an overall network status" {
|
||||
sudo networkctl status
|
||||
}
|
||||
|
||||
@test "networkctl: Reload configuration files (.netdev and .network)" {
|
||||
sudo networkctl reload
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue