-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Use FTL's build-in wait-for command for checking the logs #1898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Tests are failing because the line |
|
Yes, this is an interesting bug. We |
|
See pi-hole/FTL#2634 |
Signed-off-by: yubiuser <[email protected]>
|
I tried to use docker-pi-hole/test/tests/test_general.py Lines 59 to 60 in 5ff925b
but it did not work. The |
This is odd to me, too. I'm also wondering if a "better" test for clean shut down is actually volume mounting the logs directory and then checking the contents of the log file after the container has stopped. But that's for another time. |
Signed-off-by: yubiuser <[email protected]>
I think you're onto something here. We should not try to postpone shutdown just to read logs from inside the container. |
Co-authored-by: Adam Warner <[email protected]> Signed-off-by: yubiuser <[email protected]>
|
| done | ||
| # Wait until the FTL log contains the "FTL started" message before continuing, timeout after 10 seconds | ||
| # exit if we do not find it | ||
| pihole-FTL wait-for '########## FTL started' /var/log/pihole/FTL.log 10 "0 > /dev/null" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the PR for the shutdown test - you comment that we check for up to 60 secodns to give slow RISCV devices a chance to start up. Perhaps we should wait 60 seconds here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference is: Within the start.sh, pihole-FTL wait-for will only wait for the log line to appear, which is triggered by the capsh --user="${DNSMASQ_USER}" --keep=1 -- -c "/usr/bin/pihole-FTL $FTL_CMD >/dev/null" & line just above. Not much time should be in between.
The other PR watches the container from the outside before it kills the container. There are other (maintenance) tasks before FTL will even be invoked, e.g. running gravity. Therefore I gave it more time.
|
FTL's build-in wait-for command uses inotify, which doesn't support network file systems. https://man7.org/linux/man-pages/man7/inotify.7%40%40man-pages.html
This could introduce potential issues with network mounted file systems like NFS/CIFS/SMB. I found this alternative: ( tail -f -n0 /var/log/pihole/FTL.log & ) | grep -q "########## FTL started"See also https://superuser.com/a/900134 |
|
Thanks for testing. I did a bit more research. I think this works, because the changes are made locally by FTL. So the kernel knows about this and inotify works. But that shouldn't be an issue here. Sorry for the noise. In another project we run into issues, when we watched a certificate file for changes on a NFS mount with inotify. The certificate was managed and renewed externally. Inotify did not work in that case. That triggered me when I saw this PR. |
|
@casperklein Thanks for keeping an eye on this. Network share have been causing trouble before already. |
|
No need to apologise for noise! It's an angle I never thought to test - and I learned something about creating CIFS volumes in docker :) I tried with an NFS volume too, but there were also all sorts of other permission errors there, with or without this change set. Either I have no idea what I'm doing with NFS, or it is a tricky beast! Interestingly, I couldn't use a UNC path or a mapped network drive directly in the compose file. |
Use
pihole-FTL wait-forfunction to wait for a specific log line to appear.pi-hole/FTL#2631