check-for-changes: performance improvements + wait for settle#2104
check-for-changes: performance improvements + wait for settle#2104georglauterbach merged 14 commits intodocker-mailserver:masterfrom NorseGaud:check-for-changes-performance
Conversation
…formance improvements throughout + removed addmailuser while loops
|
Forgot to draft this... again... Sorry... It's still a WIP |
… various test fixes for new check-for-changes logic
|
It looks like both the CI and my local machine are getting the following (running with new verbose flag): It seems like
@polarathene, I'm going to see if anything else fails after removing it but I wanted to see if it's ok if it's removed (as long as everything else passes). |
That is odd looking uid and gid values, and with that volume is this Windows/WSL? That context seems to be missing in the CI tests (due to lack of verbose flag I guess?) But this other volume looks more of an issue:
I'm not familiar with this mount, but that Chances are the I think my test was one of the only ones to write to such a location which might be why it's failing in particular, if so it'd be better to fix whatever change has introduced that breakage, and not quick fix it by modifying the temporary files location used in the test. |
|
I believe whatever changes have been introduced have broken the functionality of docker-mailserver/test/security_tls_cipherlists.bats Lines 22 to 23 in f333740 EDIT: If you are noticing any issues with Windows/WSL running the tests that are inconsistent with the CI, it might be another reason in favor of running bats from docker? I was looking into that at some point, not entirely sure if it'd resolve any issues with volume mounts though (a throwaway data volume that is a container instead of bind mount on the host filesystem might also work?). |
|
Thanks @polarathene , appreciate your insight. So, I rolled bats back to 1.3.0 and it works. It looks like 1.4.0 introduced a change to BATS_TMPDIR: bats-core/bats-core#410 (comment) How the hell this didn't fail in #2095 is beyond me... Might be good to have @casperklein and @georglauterbach take a look if they get a few minutes. I'm unsure about how the CI is all set up TBH. IMO this shouldn't have passed... |
|
Please ignore the bats submodule for now. I'm using that to gain visibility into the tests and will revert it soon. |
|
Is this WIP or ready to be revied? |
|
@georglauterbach , no it's ready for review |
|
@NorseGaud when you push yourself, my review will be dismissed I think. But @docker-mailserver/maintainers can update the branch via the webUI which should not dismiss it (if that is somehow important) :D I could do it myself, but I've become cautious with your PRs because I already messed up twice in other PRs 😆 |
|
LGTM 👍 @casperklein or @wernerfred feel free to merge this PR if you approve it :) |
|
I will go ahead and merge this :) |
|
I hadn't time to review this yet. Otherwise I had approved it.. |
|
Dito ⌛ |
| service postfix start & | ||
| wait |
There was a problem hiding this comment.
I think the sleep here was, because service postfix start exit (0) successfully pretty fast, however postfix needs some time to come up completely.
service postfix start &
wait
is equal to just service postfix start ?
I am not sure if it's related, but I read an issue/PR this week, about our CI behaving "flacky" again. Maybe this is the reason?
There was a problem hiding this comment.
Good points -- I'll play around with it and see what I find.
| CMP_RESULT=$(cmp -- "${CHKSUM_FILE}" "${CHKSUM_FILE}.new") | ||
| if [[ -n "${CMP_RESULT}" ]] # If there is a difference between checksum files |
There was a problem hiding this comment.
I know it was there before, but do some know what the -- are for? I couldn't find something in the man page.
There was a problem hiding this comment.
A double-dash in a shell command signals the end of options and disables further option processing.
There was a problem hiding this comment.
Commonly used for example when you're trying to grep something that starts with a double dash, you'd write
grep -E -- "--to-grep" $FILEThere was a problem hiding this comment.
I knew that. I was wondering, if in that case, it has another purpose. Because it seems to me unnecessary here.
PS:
A double-dash in a shell command signals the end of options and disables further option processing.
I wouldn't rely on that, as not every command implements that logic 😞
There was a problem hiding this comment.
I never use it personally :)
| # wait until postfix is dead (triggered by trap) | ||
| while kill -0 "$(< /var/spool/postfix/pid/master.pid)" | ||
| do | ||
| sleep 5 | ||
| sleep 1 | ||
| done |
There was a problem hiding this comment.
Inspired by your other changes, I wonder if this one liner would work too:
wait $(</var/spool/postfix/pid/master.pid)
There was a problem hiding this comment.
Unfortunately, wait only works on child processes of the current shell:
# wait $(</var/spool/postfix/pid/master.pid)
bash: wait: pid 3108 is not a child of this shell
However https://stackoverflow.com/a/41613532/568737 suggests tail instead (which works):
tail -f --pid="$(</var/spool/postfix/pid/master.pid)" /dev/null
We could replace the while loop with that.
There was a problem hiding this comment.
I am unsure. This could lead to problems on MacOS? I don't have a mac to test, but the stackoverflow posts suggest this only for linux.
On the other hand, we don't support MacOS officially. What do you think @docker-mailserver/maintainers?
There was a problem hiding this comment.
The code doesn't run on mac, it'll run inside of the linux contianer. Shouldn't be an issue.
* docker_container first, then fall back to docker_image + test changes to support + test change to wait for smtp port to fix flakey tests since #2104 * quick fix * Update setup.sh Co-authored-by: Georg Lauterbach <[email protected]> Co-authored-by: Casper <[email protected]>
Description
See: #2098
This PR will:
check-for-changes.shwait for changes to "settle" (checksum comparison has to not have changed over two different checks with 5 second gaps between) before modifying and restarting anythingThis is, in my opinion, critically needed for an API to be performing changes -- and lots of them all at once! See docker-mailserver/docker-mailserver-admin#3 for more discussion about this.
Type of change
Checklist:
docs/)