Just put this function in the test script

This commit is contained in:
diginc 2016-09-13 23:56:24 -05:00
parent 56119ec268
commit 4dd694f978
2 changed files with 11 additions and 10 deletions

View file

@ -935,15 +935,6 @@ readSetupVarsIfPresent() {
fi fi
} }
printSetupVars() {
# Currently debug test function only
echo "piholeInterface=${piholeInterface}"
echo "IPv4addr=${IPv4addr}"
echo "piholeIPv6=${piholeIPv6}"
echo "piholeDNS1=${piholeDNS1}"
echo "piholeDNS2=${piholeDNS2}"
}
# Start the installer # Start the installer
readSetupVarsIfPresent "${1}" readSetupVarsIfPresent "${1}"

View file

@ -26,6 +26,16 @@ def test_setupVars_are_sourced_to_global_scope(Pihole):
script = dedent('''#!/bin/bash -e script = dedent('''#!/bin/bash -e
. /opt/pihole/stub_basic-install.sh . /opt/pihole/stub_basic-install.sh
readSetupVarsIfPresent pihole readSetupVarsIfPresent pihole
printSetupVars() {
# Currently debug test function only
echo "piholeInterface=\${piholeInterface}"
echo "IPv4addr=\${IPv4addr}"
echo "piholeIPv6=\${piholeIPv6}"
echo "piholeDNS1=\${piholeDNS1}"
echo "piholeDNS2=\${piholeDNS2}"
}
printSetupVars''') printSetupVars''')
write_test_script(Pihole, script) write_test_script(Pihole, script)
@ -58,4 +68,4 @@ def test_setupVars_saved_to_file(Pihole):
def write_test_script(Pihole, script): def write_test_script(Pihole, script):
Pihole.run('cat <<EOF> /test\n{}\nEOF'.format(script)) Pihole.run('cat <<EOF> /test\n{}\nEOF'.format(script))
Pihole.run('chmod +x /test') Pihole.run('chmod +x /test')
#print Pihole.run('cat /test; ls -lat /test').stdout print Pihole.run('cat /test; ls -lat /test').stdout