Add a removeKey function with test
update webpage.sh to reference functions in utils.sh (this can likely be abstracted/refactored further)
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
Add ftl_api_port function
Signed-off-by: Christian König <ckoenig@posteo.de>
Use getFTLAPIPort in pihole
Signed-off-by: Christian König <ckoenig@posteo.de>
Use default portfile as fallback
Signed-off-by: Christian König <ckoenig@posteo.de>
Fix stickler
Signed-off-by: Christian König <ckoenig@posteo.de>
Correct variables
Signed-off-by: Christian König <ckoenig@posteo.de>
Apply suggestions from code review
Co-authored-by: DL6ER <DL6ER@users.noreply.github.com>
Add test getFTLAPIPort returing default port
Signed-off-by: Christian König <ckoenig@posteo.de>
Remove unused code from test_key_val_replacement_works
Signed-off-by: Christian König <ckoenig@posteo.de>
Add getFTLAPIPort_custom test
Signed-off-by: Christian König <ckoenig@posteo.de>
Fix output format
Signed-off-by: Christian König <ckoenig@posteo.de>
Add debugging
Signed-off-by: Christian König <ckoenig@posteo.de>
Remove debugging and fix function
Signed-off-by: Christian König <ckoenig@posteo.de>
* 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>
* 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>
* 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>
Create Github Actions config
Split tox ini into one per supported distro so they can be run seperately
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
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>
- test to ensure installer behavior with unsupported CentOS releases
- test to ensure repository enablement
- test to ensure PHP upgrade opt-in/opt-out behavior
Signed-off-by: bcambl <blayne@blaynecampbell.com>
- Check if downloaded binary file can resolve queries, if so stop and disable dnsmasq
- Add service_disable function
- Add dependency libcap2-bin on debian to enable setcap. Need to check other distos
-Always download FTL binary if /etc/pihole/ftlbranch does not contain "master"
- Change some strings/variables that reference dnsmasq and change them to pihole/pihole-FTL
Signed-off-by: Adam Warner <adamw@rner.email>
* Print newline on error message
* Output last three lines of error if update fails
* Consistent error messages & housekeeping
* Add shellcheck directive to ignore COL_TABLE
* Quoted and braced variables for codebase consistency
* Escaped newlines correctly
* Made error messages consistent (indenting and wording)
* Removed consecutive echos
* Conditional formatting consistency
* Braced, quoted and used [[ on conditionals
* Fix specific ShellCheck issues
* Fixed issues that could be safely changed without extensive testing
* Update SELinux whiptail behaviour & more
* Colourised some strings
* Fixed multiple line string indenting
* Made output consistent with existing codebase
* Removed sequential echos
* Make SELinux whiptail use "--defaultno", and change text wording
* Add help text for hostrecord, and colourise output
* this should fix the tests...
Signed-off-by: Adam Warner <adamw@rner.email>
* revert changes to `update_package_cache()` to prove tests
Signed-off-by: Adam Warner <adamw@rner.email>
* Always process DNS and DHCP settings in installer
* Make sure dnsmasq config exists before modifying it
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
* Make sure the dnsmasq config directory exists
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
* Only remove the DHCP config if it exists (fixes tests, hopefully)
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
* Define colours within COL_TABLE
* Do not output colours for non-terminal instances
* Removed ":::"
* Fixed indenting & spacing
* Made output consistent throughout project
* Reworded text to fit on standard 80 char wide Terminal screen
* Made 'sudo raspi-config' warning (insufficient disk space) only show on RPi
* Make "Installation/Update Complete" the final msg
* Remove redundant messages
* Simplify update available message
* Confirm user would like to begin uninstall
* If "git pull" string says "Already up-to-date.", place [i] before it
* Colour Temp/Interface output
* Made `pihole disable 5z` invalid
* Added error fallback if invalid argument (not s/m) is detected
* Quoted "$2" for consistency
* Updated help text
* L185/286: Replaced echo with redirect
* User agents for adblock.mahakala.is/adaway.org unnecessary
* Print newline on confirmation of repository reset
* Add output to admin-related dnsmasq restarts
* Return error message for "pihole -q"
* Imply default checkout behaviour with y/N
* Fix uninstall failing to remove pihole user
* Print checkout 'git remote show origin' STDERR on new line
* Replaced checkout "AdminLTE" wording with "Web Admin"
* Add first version of FTL tests
* Wait one second to allow FTL to start up and analyze our mock log
* Add test_FTL_telnet_statistics
* Added test_FTL_telnet_top_clients
* Add test_FTL_telnet_top_domains
* On installs with GUA and ULA's we should prefer ULA's as it's been demonstrated that GUA's can and often are rotated by ISPs. Fixes#1473
* Add test for link-local address detection
* Add ULA-only and GUA-only tests
* Add test_IPv6_GUA_ULA_test and test_IPv6_ULA_GUA_test
* Add ""
* Add mock_command_2 command that can mock a command with more than one argument (as "ip -6 address") and result multiple lines of results
* Make mock_command_2 more similar to the original mock_command
* Correct comments
* Fixed remaining comments
* Fixed one last comment...
* Fixed a comment...
Test aarch64 detection
Arm v6/v7 little endian.
x86_64 native
Test aarch64 detection
Unknown platform detection.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>