grab version on startup for web footer. 2 tests stablized
Signed-off-by: Adam Hill <adam@diginc.us>
This commit is contained in:
parent
999f02b598
commit
65a1ac7f1e
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
prepare_configs() {
|
prepare_configs() {
|
||||||
|
# Done in /start.sh, don't do twice
|
||||||
PH_TEST=true . $PIHOLE_INSTALL
|
PH_TEST=true . $PIHOLE_INSTALL
|
||||||
distro_check
|
distro_check
|
||||||
installConfigs
|
installConfigs
|
||||||
|
@ -17,6 +18,8 @@ prepare_configs() {
|
||||||
chown pihole:pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /etc/pihole /etc/pihole/dhcp.leases /var/log/pihole.log
|
chown pihole:pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /etc/pihole /etc/pihole/dhcp.leases /var/log/pihole.log
|
||||||
chmod 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
|
chmod 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
|
||||||
set -e
|
set -e
|
||||||
|
# Update version numbers
|
||||||
|
pihole updatechecker
|
||||||
# Re-write all of the setupVars to ensure required ones are present (like QUERY_LOGGING)
|
# Re-write all of the setupVars to ensure required ones are present (like QUERY_LOGGING)
|
||||||
|
|
||||||
# If the setup variable file exists,
|
# If the setup variable file exists,
|
||||||
|
|
|
@ -9,7 +9,7 @@ def DockerGeneric(request, args, image, cmd, entrypoint=''):
|
||||||
assert 'docker' in check_output('id'), "Are you in the docker group?"
|
assert 'docker' in check_output('id'), "Are you in the docker group?"
|
||||||
if 'pihole' in image:
|
if 'pihole' in image:
|
||||||
args += " --dns 127.0.0.1 -v /dev/null:/etc/pihole/adlists.default -e PYTEST=\"True\""
|
args += " --dns 127.0.0.1 -v /dev/null:/etc/pihole/adlists.default -e PYTEST=\"True\""
|
||||||
docker_run = "docker run -d {args} {entry} {image} {cmd}".format(args, image, cmd)
|
docker_run = "docker run -d {args} {entry} {image} {cmd}".format(args=args, entry=entrypoint, image=image, cmd=cmd)
|
||||||
print docker_run
|
print docker_run
|
||||||
docker_id = check_output(docker_run)
|
docker_id = check_output(docker_run)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,8 @@ import time
|
||||||
''' Note, testinfra builtins don't seem fully compatible with
|
''' Note, testinfra builtins don't seem fully compatible with
|
||||||
docker containers (esp. musl based OSs) stripped down nature '''
|
docker containers (esp. musl based OSs) stripped down nature '''
|
||||||
|
|
||||||
@pytest.mark.parametrize('entrypoint', ['--entrypoint=/bin/bash'])
|
# If the test runs /start.sh, do not let s6 run it too! Kill entrypoint to avoid race condition/duplicated execution
|
||||||
|
@pytest.mark.parametrize('entrypoint,cmd', [('--entrypoint=tail','-f /dev/null')])
|
||||||
@pytest.mark.parametrize('args', [ '' ])
|
@pytest.mark.parametrize('args', [ '' ])
|
||||||
def test_ServerIP_missing_triggers_start_error(Docker):
|
def test_ServerIP_missing_triggers_start_error(Docker):
|
||||||
''' When args to docker are empty start.sh exits saying ServerIP is required '''
|
''' When args to docker are empty start.sh exits saying ServerIP is required '''
|
||||||
|
@ -13,7 +14,8 @@ def test_ServerIP_missing_triggers_start_error(Docker):
|
||||||
assert start.rc == 1
|
assert start.rc == 1
|
||||||
assert error_msg in start.stdout
|
assert error_msg in start.stdout
|
||||||
|
|
||||||
@pytest.mark.parametrize('entrypoint', ['--entrypoint=/bin/bash'])
|
# If the test runs /start.sh, do not let s6 run it too! Kill entrypoint to avoid race condition/duplicated execution
|
||||||
|
@pytest.mark.parametrize('entrypoint,cmd', [('--entrypoint=tail','-f /dev/null')])
|
||||||
@pytest.mark.parametrize('args,error_msg,expect_rc', [
|
@pytest.mark.parametrize('args,error_msg,expect_rc', [
|
||||||
('-e ServerIP="1.2.3.z"', "ServerIP Environment variable (1.2.3.z) doesn't appear to be a valid IPv4 address",1),
|
('-e ServerIP="1.2.3.z"', "ServerIP Environment variable (1.2.3.z) doesn't appear to be a valid IPv4 address",1),
|
||||||
('-e ServerIP="1.2.3.4" -e ServerIPv6="1234:1234:1234:ZZZZ"', "Environment variable (1234:1234:1234:ZZZZ) doesn't appear to be a valid IPv6 address",1),
|
('-e ServerIP="1.2.3.4" -e ServerIPv6="1234:1234:1234:ZZZZ"', "Environment variable (1234:1234:1234:ZZZZ) doesn't appear to be a valid IPv6 address",1),
|
||||||
|
|
Loading…
Reference in New Issue