mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Add getFTLPID() tests
Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
parent
2651abbe6c
commit
c8c4eb59b7
1 changed files with 16 additions and 4 deletions
|
@ -77,8 +77,8 @@ def test_getFTLAPIPortFile_and_getFTLAPIPort_custom(host):
|
|||
''')
|
||||
output = host.run('''
|
||||
source /opt/pihole/utils.sh
|
||||
FTL_API_PORT=$(getFTLAPIPortFile)
|
||||
getFTLAPIPort "${FTL_API_PORT}"
|
||||
FTL_API_PORT_FILE=$(getFTLAPIPortFile)
|
||||
getFTLAPIPort "${FTL_API_PORT_FILE}"
|
||||
''')
|
||||
expected_stdout = '1234\n'
|
||||
assert expected_stdout == output.stdout
|
||||
|
@ -92,14 +92,26 @@ def test_getFTLPIDFile_default(host):
|
|||
expected_stdout = '/run/pihole-FTL.pid\n'
|
||||
assert expected_stdout == output.stdout
|
||||
|
||||
def test_getFTLPIDFile_custom(host):
|
||||
def test_getFTLPID_default(host):
|
||||
''' Confirms getFTLPID returns the default value if FTL is not running '''
|
||||
output = host.run('''
|
||||
source /opt/pihole/utils.sh
|
||||
getFTLPID
|
||||
''')
|
||||
expected_stdout = '-1\n'
|
||||
assert expected_stdout == output.stdout
|
||||
|
||||
def test_getFTLPIDFile_and_getFTLPID_custom(host):
|
||||
''' Confirms getFTLPIDFile returns a custom PID file path '''
|
||||
host.run('''
|
||||
echo "PIDFILE=/tmp/pid.file" > /etc/pihole/pihole-FTL.conf
|
||||
echo "1234" > /tmp/pid.file
|
||||
''')
|
||||
output = host.run('''
|
||||
source /opt/pihole/utils.sh
|
||||
getFTLPIDFile
|
||||
FTL_PID_FILE=$(getFTLPIDFile)
|
||||
getFTLPID "${FTL_PID_FILE}"
|
||||
''')
|
||||
expected_stdout = '/tmp/pid.file\n'
|
||||
assert expected_stdout == output.stdout
|
||||
|
||||
|
|
Loading…
Reference in a new issue