-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add more integration tests for core tools.
- Loading branch information
Showing
19 changed files
with
484 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,28 @@ | ||
#!/usr/bin/env bats | ||
# apparmor.d - Full set of apparmor profiles | ||
# Copyright (C) 2024 Alexandre Pujol <[email protected]> | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
|
||
load common | ||
|
||
setup_file() { | ||
aa_setup | ||
} | ||
|
||
# bats test_tags=cpuid | ||
@test "cpuid: Display information for all CPUs" { | ||
cpuid | ||
aa_check | ||
} | ||
|
||
# bats test_tags=cpuid | ||
@test "cpuid: Display information only for the current CPU" { | ||
cpuid -1 | ||
aa_check | ||
} | ||
|
||
# bats test_tags=cpuid | ||
@test "cpuid: Display raw hex information with no decoding" { | ||
cpuid -r | ||
aa_check | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,34 @@ | ||
#!/usr/bin/env bats | ||
# apparmor.d - Full set of apparmor profiles | ||
# Copyright (C) 2024 Alexandre Pujol <[email protected]> | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
|
||
load common | ||
|
||
setup_file() { | ||
aa_setup | ||
} | ||
|
||
# bats test_tags=dfc | ||
@test "dfc: Display filesystems and their disk usage in human-readable form with colors and graphs" { | ||
dfc | ||
aa_check | ||
} | ||
|
||
# bats test_tags=dfc | ||
@test "dfc: Display all filesystems including pseudo, duplicate and inaccessible filesystems" { | ||
dfc -a | ||
aa_check | ||
} | ||
|
||
# bats test_tags=dfc | ||
@test "dfc: Display filesystems without color" { | ||
dfc -c never | ||
aa_check | ||
} | ||
|
||
# bats test_tags=dfc | ||
@test "dfc: Display filesystems containing "ext" in the filesystem type" { | ||
dfc -t ext | ||
aa_check | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,58 @@ | ||
#!/usr/bin/env bats | ||
# apparmor.d - Full set of apparmor profiles | ||
# Copyright (C) 2024 Alexandre Pujol <[email protected]> | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
|
||
load common | ||
|
||
setup_file() { | ||
aa_setup | ||
} | ||
|
||
# bats test_tags=homectl | ||
@test "homectl: Display help" { | ||
homectl --no-pager --help | ||
aa_check | ||
} | ||
|
||
# bats test_tags=homectl | ||
@test "homectl: Create a user account and their associated home directory" { | ||
sudo homectl create user2 | ||
aa_check | ||
} | ||
|
||
# bats test_tags=homectl | ||
@test "homectl: List user accounts and their associated home directories" { | ||
homectl list | ||
aa_check | ||
} | ||
|
||
# bats test_tags=homectl | ||
@test "homectl: Change the password for a specific user" { | ||
sudo homectl passwd user2 | ||
aa_check | ||
} | ||
|
||
# bats test_tags=homectl | ||
@test "homectl: Run a shell or a command with access to a specific home directory" { | ||
sudo homectl with user2 -- ls -al /home/user2 | ||
aa_check | ||
} | ||
|
||
# bats test_tags=homectl | ||
@test "homectl: Lock or unlock a specific home directory" { | ||
sudo homectl lock user2 | ||
aa_check | ||
} | ||
|
||
# bats test_tags=homectl | ||
@test "homectl: Change the disk space assigned to a specific home directory to 100 GiB" { | ||
sudo homectl resize user2 1G | ||
aa_check | ||
} | ||
|
||
# bats test_tags=homectl | ||
@test "homectl: Remove a specific user and the associated home directory" { | ||
sudo homectl remove user2 | ||
aa_check | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,27 @@ | ||
#!/usr/bin/env bats | ||
# apparmor.d - Full set of apparmor profiles | ||
# Copyright (C) 2024 Alexandre Pujol <[email protected]> | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
|
||
load common | ||
|
||
setup() { | ||
aa_setup | ||
} | ||
|
||
# bats test_tags=hostnamectl | ||
@test "hostnamectl: Get the hostname of the computer" { | ||
hostnamectl | ||
} | ||
|
||
# bats test_tags=hostnamectl | ||
@test "hostnamectl: Get the location of the computer" { | ||
hostnamectl location | ||
} | ||
|
||
# bats test_tags=hostnamectl | ||
@test "hostnamectl: Set the hostname of the computer" { | ||
name=$(hostnamectl hostname) | ||
sudo hostnamectl set-hostname "new" | ||
sudo hostnamectl set-hostname "$name" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,22 @@ | ||
#!/usr/bin/env bats | ||
# apparmor.d - Full set of apparmor profiles | ||
# Copyright (C) 2024 Alexandre Pujol <[email protected]> | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
|
||
load common | ||
|
||
setup_file() { | ||
aa_setup | ||
} | ||
|
||
# bats test_tags=sync | ||
@test "sync: Flush all pending write operations on all disks" { | ||
sync | ||
aa_check | ||
} | ||
|
||
# bats test_tags=sync | ||
@test "sync: Flush all pending write operations on a single file to disk" { | ||
sudo sync / | ||
aa_check | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,23 @@ | ||
#!/usr/bin/env bats | ||
# apparmor.d - Full set of apparmor profiles | ||
# Copyright (C) 2024 Alexandre Pujol <[email protected]> | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
|
||
load common | ||
|
||
setup_file() { | ||
aa_setup | ||
} | ||
|
||
# bats test_tags=systemd-ac-power | ||
@test "systemd-ac-power: Report whether we are connected to an external power source." { | ||
systemd-ac-power || true | ||
aa_check | ||
} | ||
|
||
# bats test_tags=systemd-ac-power | ||
@test "systemd-ac-power: Check if battery is discharging and low" { | ||
systemd-ac-power --low || true | ||
aa_check | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,29 @@ | ||
#!/usr/bin/env bats | ||
# apparmor.d - Full set of apparmor profiles | ||
# Copyright (C) 2024 Alexandre Pujol <[email protected]> | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
|
||
load common | ||
|
||
setup_file() { | ||
aa_setup | ||
} | ||
|
||
# bats test_tags=systemd-analyze | ||
@test "systemd-analyze: List all running units, ordered by the time they took to initialize" { | ||
systemd-analyze --no-pager blame | ||
aa_check | ||
} | ||
|
||
# bats test_tags=systemd-analyze | ||
@test "systemd-analyze: Print a tree of the time-critical chain of units" { | ||
systemd-analyze --no-pager critical-chain | ||
aa_check | ||
} | ||
|
||
# bats test_tags=systemd-analyze | ||
@test "systemd-analyze: Show security scores of running units" { | ||
systemd-analyze --no-pager security | ||
aa_check | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,22 @@ | ||
#!/usr/bin/env bats | ||
# apparmor.d - Full set of apparmor profiles | ||
# Copyright (C) 2024 Alexandre Pujol <[email protected]> | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
|
||
load common | ||
|
||
setup_file() { | ||
aa_setup | ||
} | ||
|
||
# bats test_tags=systemd-cat | ||
@test "systemd-cat: Write the output of the specified command to the journal (both output streams are captured)" { | ||
systemd-cat pwd | ||
aa_check | ||
} | ||
|
||
# bats test_tags=systemd-cat | ||
@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 | ||
aa_check | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,29 @@ | ||
#!/usr/bin/env bats | ||
# apparmor.d - Full set of apparmor profiles | ||
# Copyright (C) 2024 Alexandre Pujol <[email protected]> | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
|
||
load common | ||
|
||
setup_file() { | ||
aa_setup | ||
} | ||
|
||
# bats test_tags=systemd-cgls | ||
@test "systemd-cgls: Display the whole control group hierarchy on your system" { | ||
systemd-cgls --no-pager | ||
aa_check | ||
} | ||
|
||
# bats test_tags=systemd-cgls | ||
@test "systemd-cgls: Display a control group tree of a specific resource controller" { | ||
systemd-cgls --no-pager io | ||
aa_check | ||
} | ||
|
||
# bats test_tags=systemd-cgls | ||
@test "systemd-cgls: Display the control group hierarchy of one or more systemd units" { | ||
systemd-cgls --no-pager --unit systemd-logind | ||
aa_check | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,41 @@ | ||
#!/usr/bin/env bats | ||
# apparmor.d - Full set of apparmor profiles | ||
# Copyright (C) 2024 Alexandre Pujol <[email protected]> | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
|
||
load common | ||
|
||
setup_file() { | ||
aa_setup | ||
} | ||
|
||
# bats test_tags=systemd-id128 | ||
@test "systemd-id128: Generate a new random identifier" { | ||
systemd-id128 new | ||
aa_check | ||
} | ||
|
||
# bats test_tags=systemd-id128 | ||
@test "systemd-id128: Print the identifier of the current machine" { | ||
systemd-id128 machine-id | ||
aa_check | ||
} | ||
|
||
# bats test_tags=systemd-id128 | ||
@test "systemd-id128: Print the identifier of the current boot" { | ||
systemd-id128 boot-id | ||
aa_check | ||
} | ||
|
||
# bats test_tags=systemd-id128 | ||
@test "systemd-id128: Print the identifier of the current service invocation (this is available in systemd services)" { | ||
systemd-id128 invocation-id | ||
aa_check | ||
} | ||
|
||
# bats test_tags=systemd-id128 | ||
@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 | ||
aa_check | ||
} | ||
|
Oops, something went wrong.