Test output with no zpool.
This commit is contained in:
parent
b3ee98a234
commit
3655c02775
|
@ -10,24 +10,24 @@ set -x
|
|||
POOL_NAME="sanoid-test-1"
|
||||
POOL_TARGET="" # root
|
||||
|
||||
# UTC timestamp of start and end
|
||||
START="1483225200"
|
||||
END="1514761199"
|
||||
# # UTC timestamp of start and end
|
||||
# START="1483225200"
|
||||
# END="1514761199"
|
||||
|
||||
# prepare
|
||||
setup
|
||||
checkEnvironment
|
||||
disableTimeSync
|
||||
# disableTimeSync
|
||||
|
||||
# set timezone
|
||||
ln -sf /usr/share/zoneinfo/Europe/Vienna /etc/localtime
|
||||
# # set timezone
|
||||
# ln -sf /usr/share/zoneinfo/Europe/Vienna /etc/localtime
|
||||
|
||||
timestamp=$START
|
||||
# timestamp=$START
|
||||
|
||||
mkdir -p "${POOL_TARGET}"
|
||||
truncate -s 5120M "${POOL_TARGET}"/zpool.img
|
||||
# mkdir -p "${POOL_TARGET}"
|
||||
# truncate -s 5120M "${POOL_TARGET}"/zpool.img
|
||||
|
||||
zpool create -f "${POOL_NAME}" "${POOL_TARGET}"/zpool.img
|
||||
# zpool create -f "${POOL_NAME}" "${POOL_TARGET}"/zpool.img
|
||||
|
||||
function cleanUp {
|
||||
zpool export "${POOL_NAME}"
|
||||
|
|
|
@ -6,13 +6,23 @@
|
|||
|
||||
|
||||
import unittest
|
||||
import os
|
||||
|
||||
class TestNothing(unittest.TestCase):
|
||||
def test_nothing(self):
|
||||
"""Test"""
|
||||
sanoid_cmd = os.environ.get("SANOID")
|
||||
|
||||
# Test sanoid_snapshots_exist
|
||||
self.assertEqual(1,2)
|
||||
def monitor_snapshots_command():
|
||||
"""Runs sanoid --monitor-snapshots and returns a CompletedProcess instance"""
|
||||
return_info = subprocess.run([sanoid_cmd, "--monitor-metrics"], check=True, capture_output=True)
|
||||
return return_info
|
||||
|
||||
|
||||
|
||||
class TestMonitoringOutput(unittest.TestCase):
|
||||
def test_no_zpool(self):
|
||||
"""Test what happens if there is no zpool at all"""
|
||||
|
||||
return_info = monitor_snapshots_command()
|
||||
self.assertEqual(return_info.stdout, "chicken")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue