mirror of
https://github.com/darksaid98/ubuntu-server-setup.git
synced 2026-12-01 22:22:31 +00:00
Added function to add swap file
This commit is contained in:
1 parent
9ef673594e
commit
02e48fe201
2 files changed
+42
-3
No files matched your search
+19
-3
@@ -56,15 +56,21 @@ function testUfw() {
|
||||
assertContains "OpenSSH" "${ufw_status}"
|
||||
}
|
||||
|
||||
function testSwap() {
|
||||
createSwap
|
||||
|
||||
assertContains "/swapfile" "$(ls -lh /swapfile)"
|
||||
assertContains "/swapfile" "$(sudo swapon --show)"
|
||||
}
|
||||
|
||||
function testTeardown () {
|
||||
echo "Test Teardown"
|
||||
|
||||
deleteTestUser
|
||||
revertSudoers
|
||||
revertSSHConfig
|
||||
|
||||
sudo ufw delete allow OpenSSH
|
||||
sudo ufw disable
|
||||
revertUfw
|
||||
deleteSwap
|
||||
}
|
||||
|
||||
### Helper Functions ###
|
||||
@@ -89,4 +95,14 @@ function revertSSHConfig() {
|
||||
sudo rm -rf /etc/ssh/sshd_config.old
|
||||
}
|
||||
|
||||
function revertUfw() {
|
||||
sudo ufw delete allow OpenSSH
|
||||
sudo ufw disable
|
||||
}
|
||||
|
||||
function deleteSwap() {
|
||||
sudo swapoff /swapfile
|
||||
sudo rm /swapfile
|
||||
}
|
||||
|
||||
runUnitTests
|
||||
Reference in new issue
Block a user