Commit graph

108 commits

Author SHA1 Message Date
MichaIng
14a379d448
Fix generated /etc/os-release file in OS check test
Signed-off-by: MichaIng <micha@dietpi.com>
2021-11-30 02:57:44 +01:00
Adam Warner
cdd4d9ea9e
Update the tests (#4427)
* unpin the requirements and update all to latest available - needs more work still. see notes in `def host()`

Signed-off-by: Adam Warner <me@adamwarner.co.uk>

* fix py3 monkey patch of testinfra docker using bash

Signed-off-by: Adam Hill <adam@diginc.us>

* update the other test files to use `host` instead of `Pihole`
Address some sticklr and codefactor
update python version from 3.7 to 3.8
preload `git` onto the centos/fedora test images, and switch which with command -v in the passthrough mock
testinfra is deprecated, use pytest-testinfra

Signed-off-by: Adam Warner <me@adamwarner.co.uk>

Co-authored-by: Adam Hill <adam@diginc.us>
2021-11-18 01:03:37 +00:00
pvogt09
cedd1a2591
unit test for umask problems in #3177 and #2730 (#3191)
* add test for file permissions of $webroot

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* changes sudo to su for running command as user www-data

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* installs PIHOLE_WEB_DEPS to create LIGHTTPD_USER

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* changes stdout to rc

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* use installPihole instead of installPiholeWeb in test

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* try installation process with main

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* mock systemctl

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* removes stickler errors

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* start lighttpd and make webpage test optional

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* test all files and directories in $webroot

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* fix stickler and codefactor warnings

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* set permission for /var/cache if it did not exist before

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* add test case for pihole files

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* fix stickler errors

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* revert "set permission for /var/cache if it did not exist before" and make lighttpd start work

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* add --add-cap=NET_ADMIN to enable FTL start

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* specify DNS server for cURL

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* check files created by FTL

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* reorder code and change nameserver in /etc/resolv.conf

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* resolve with dig instead of relying on /etc/resolv.conf

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* set IP to 127.0.0.1 in setupVars.conf for blockpage tests

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* resolve domain with dig and remove debug output

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* fix stickler errors

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* no git pull in Github Action runs for pull requests

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* --cap-add=ALL test

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* fix stickler errors

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* remove debug code

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* update_repo patch for CentOS 7 in Github Actions

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* removes TODOs and stickler warnings

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* adds trailing slash to domain

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* use only first result from dig

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* domain name resolution does not work reliably in docker container

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* repair executable permission

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* Create mock_command_passthrough that allows intercepting of specific arguments - everything else is passed through to the proper command. Use this new command instead of making changes in basic-install.sh to make the tests pass.

Signed-off-by: Adam Warner <me@adamwarner.co.uk>

Co-authored-by: Adam Warner <me@adamwarner.co.uk>
2021-11-11 16:44:57 +00:00
Adam Warner
5b03160295
Install script comment tweaks (#4361) 2021-10-04 11:40:53 +01:00
Christian König
466520366d Fogot to save...
Signed-off-by: Christian König <ckoenig@posteo.de>
2021-10-02 23:47:13 +02:00
Christian König
9dbcbdbe66 Adjust tests
Signed-off-by: Christian König <ckoenig@posteo.de>
2021-10-02 23:43:08 +02:00
yubiuser
1c286c7bc4
Select proper PHP version on RPM based OS after INSTALLER_DEPS have been installed (#4325)
* Select proper PHP version on RPM based OS after INSTALLER_DEPS have been installed

* Remove check for unsupported RPM distros as it is checked in os_check already

* Add select_rpm_php function to tox tests

Signed-off-by: Christian König <ckoenig@posteo.de>
2021-09-12 13:40:37 -07:00
Adam Warner
d68a2ffaf3
Install only minimal requiered package before performing os_check
Co-authored-by: Christian König <ckoenig@posteo.de>
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2021-08-05 19:02:36 +01:00
Adam Warner
1358209a9a
rename distro_check to package_manager_detect, as it is more in keeping with what the function actually does
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2021-08-05 19:02:36 +01:00
Adam Warner
4ac4bc5c18
Merge branch 'development' into fix/gravity_no_locallist 2021-07-04 00:48:09 +01:00
Adam Warner
87f2ae82cd
Stickler gonna stickle...
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2021-07-03 00:07:37 +01:00
Adam Warner
469b715442
Add three new tests (one for each dependecy array) to check packages are available in supported OS package repos
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2021-07-03 00:00:54 +01:00
DL6ER
aa88be335e
Acknowledge that IPV{4,6}_ADDRESS may not exist
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-04-16 11:44:54 +02:00
DL6ER
74948ae5c1
The correct port separator is '#' not ':' in dnsmasq style. This should not have been changed in #4083 in the first place.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-04-14 22:53:12 +02:00
jbzdarkid
8090071eff Update regex to disallow leading zeros
Also updated a comment to point to a non-experimental RFC.

Signed-off-by: jbzdarkid <jbzdarkid@gmail.com>
2021-03-21 16:27:08 -07:00
Joseph Blackman
89c80947df Improve regexes for ipv4 matching
Signed-off-by: jbzdarkid <jbzdarkid@gmail.com>
2021-03-21 16:24:35 -07:00
Adam Warner
fb454ebe14
fix stickler complaints
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-10-23 23:09:07 +01:00
Adam Warner
ee556088b5
Fake OS details in /etc/os-release and confirm install fails
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-10-23 23:05:41 +01:00
bcambl
a7c58e7112
E302 expected 2 blank lines, found 1
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2020-10-23 22:20:36 +01:00
Adam Warner
5aab68ab41
Update test/test_automated_install.py
Co-authored-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>
2020-10-23 22:20:36 +01:00
Adam Warner
c9edcfa335
add test to check "os_check" works
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-10-23 22:18:42 +01:00
DL6ER
01c9bbd3ca
Improve processor detection to use the new dedicated ARMv4T, ARMv5TE and ARMv8-A binaries we provide for FTL.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-10-14 20:31:22 +02:00
Adam Warner
9e96ff37de
Fix merge conflicts
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-05-12 22:16:43 +01:00
Adam Warner
a37dba2c81
remove configureFirewall function, the call to it, and related tests
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-04-19 14:52:01 +01:00
pvogt09
25c5661c1b fix stickler errors
Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>
2020-04-03 19:22:30 +02:00
pvogt09
a993b8b34d fixes #3217 by checking for existing pihole group
Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>
2020-04-03 13:18:32 +02:00
XhmikosR
7b8611ced0
Assorted typo fixes. (#3126)
* Assorted typo fixes.

Signed-off-by: XhmikosR <xhmikosr@gmail.com>

Co-authored-by: Dan Schaper <dan.schaper@pi-hole.net>
2020-03-08 16:53:14 -07:00
jnozsc
4a711340ef
use py3 instead py2 (#3153)
* use py3 instead py2

Signed-off-by: jnozsc <jnozsc@gmail.com>

* use python 3.6

Signed-off-by: jnozsc <jnozsc@gmail.com>
2020-03-02 23:30:44 -08:00
Adam Warner
12817c09bb
(Squashed commits)
Always ensure we have the correct machine arch by storing to/reading from a file rather than depending on global variable that for some reason is not always populated...

Signed-off-by: Adam Warner <me@adamwarner.co.uk>

no need for global variable

Signed-off-by: Adam Warner <me@adamwarner.co.uk>

Use a file in the temporary FTL download directory

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>

Local binary variable named to l_binary. Disambiguate from global binary.

Allow 'binary' to be shadowed for testing.

Use ./ftlbinary in all operations.

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>

Revert shadow ability on binary variable.

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>

Remove unused tests, binary variable can not be overridden.

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>

This should work here, too

Signed-off-by: Adam Warner <me@adamwarner.co.uk>

binary name is passed through from pihole checkout

Signed-off-by: Adam Warner <me@adamwarner.co.uk>

Add comments

Signed-off-by: Adam Warner <me@adamwarner.co.uk>

OK, let's try it this way again

Signed-off-by: Adam Warner <me@adamwarner.co.uk>

we might be getting somewhere.. squash after this I think!

Signed-off-by: Adam Warner <me@adamwarner.co.uk>

This is a test to see if it fixes the aarch64 test (we are definitely squashing these commits

Signed-off-by: Adam Warner <me@adamwarner.co.uk>

fix the rest of the tests

Signed-off-by: Adam Warner <me@adamwarner.co.uk>

Remove trailing whitespace in the files we've touched here

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2019-11-15 19:49:09 +00:00
bcambl
cd9b1fcb8c update tests for SELinux changes
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2019-10-14 13:02:44 -06:00
Adam Warner
9a6deb5a1a
Fix tests
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2019-09-17 21:16:49 +01:00
Mcat12
1d5755a4c2
Add tests for valid_ip
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-07-10 21:18:58 -07:00
bcambl
218476fab0 ensure installation dependencies for FTL tests which rely on /etc/init.d
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2019-07-06 11:06:08 -06:00
pvogt09
efbd42f7b5 Moves creation of pihole user before FTL installation
Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>
2019-05-12 11:27:25 +02:00
DL6ER
7479485d45
Add test for the case the binary variable is unset (defaults to "tbd" in this case)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-01-31 20:00:26 +01:00
DL6ER
d26f2dcb2c
Use global binary variable in tests for automated install
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-01-24 09:47:28 +01:00
Mcat12
c22e94c9c7
Update test to include empty FTL config
The installer ensures that an FTL config will exist, and creates an
empty file if it doesn't.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-08-20 19:33:15 -04:00
DL6ER
f5c3dc5d9d
Improve download error message that is shown when downloading or verifying the binary failed
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-07 16:51:58 +02:00
Adam Hill
8ca4c66e3c
make smarter assertions rathe than largestring not in string
Signed-off-by: Adam Hill <adam@diginc.us>
2018-07-12 00:03:25 -05:00
bcambl
fff31558a0 assert REMI repository is not installed for Fedora
- fix whiptail mock comments to clarify continue vs cancel

Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-08 14:02:31 -06:00
bcambl
09d40679c0 add test for unsupported distro checking
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-06 10:07:43 -06:00
bcambl
5ca2ad6148 move test globals & mock commands to conftest
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-05 18:10:43 -06:00
bcambl
40537e1522 python linting: missing whitespace after ',' (E231)
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-03 00:43:24 -06:00
bcambl
064a75b21b python linting: missing whitespace around operator (E225)
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-03 00:43:18 -06:00
bcambl
79232d02c9 python linting: 'pytest' imported but unused (F401)
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-03 00:30:00 -06:00
bcambl
9bd4986781 python linting: whitespace before ':' (E203)
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-03 00:21:57 -06:00
bcambl
c3d443aaff python linting: lines > 79 characters (E501)
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-03 00:09:56 -06:00
bcambl
da3dfd0998 python linting: missing whitespace after ':' (E231)
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-02 15:25:51 -06:00
bcambl
4468d81472 python linting: 2 lines prior to defs (E302)
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-07-02 14:54:19 -06:00
bcambl
9d3d33b6a2 add tests for selinux checking
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-06-26 00:09:30 -06:00