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
check-for-changes: performance improvements + wait for settle #2104
check-for-changes: performance improvements + wait for settle #2104
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
…mailserver into check-for-changes-performance
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... |
5b4c84a
to
f5bcfd2
Compare
Please ignore the bats submodule for now. I'm using that to gain visibility into the tests and will revert it soon. |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A double-dash in a shell command signals the end of options and disables further option processing.
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.
Commonly used for example when you're trying to grep
something that starts with a double dash, you'd write
grep -E -- "--to-grep" $FILE
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good -- including in #2134
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code doesn't run on mac, it'll run inside of the linux contianer. Shouldn't be an issue.
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.
You are absolutely right.
check-for-changes: performance improvements + wait for settle (docker-mailserver#2104) lint fix reverted a mistake whoops, forgot one testing flakey tests reverted stopwaitsecs for postfix (docker-mailserver#2137) more tests more testing Bats developer explains that run_*_file_if_necessary isn't needed since 1.2.1 more test testing more testing more testing docs: Adds a new blog post (docker-mailserver#2138) Adds a new blog post that covers setting up docker-mailserver on a VPS, including but not limited to * Considerations when selecting a VPS * Initial configuration of docker-mailserver * DNS setup and verification of settings * Multiple domains Co-authored-by: Frederic Werner <20406381+wernerfred@users.noreply.github.com> docs: add matrixes as a contributor for blog (docker-mailserver#2139) * docs: update CONTRIBUTORS.md * docs: update .all-contributorsrc * fix: remove projectmanagement * chore: remove projectmanagement Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> Co-authored-by: Frederic Werner <20406381+wernerfred@users.noreply.github.com> added wait for smtp port quick fix quick fix
+ test changes to support + test change to wait for smtp port to fix flakey tests since docker-mailserver#2104
+ test changes to support + test change to wait for smtp port to fix flakey tests since docker-mailserver#2104
+ test changes to support + test change to wait for smtp port to fix flakey tests since docker-mailserver#2104
+ test changes to support + test change to wait for smtp port to fix flakey tests since docker-mailserver#2104
+ test changes to support + test change to wait for smtp port to fix flakey tests since docker-mailserver#2104
* 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 <44545919+georglauterbach@users.noreply.github.com> Co-authored-by: Casper <casperklein@users.noreply.github.com>
…ker-mailserver#2134) * 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 docker-mailserver#2104 * quick fix * Update setup.sh Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com> Co-authored-by: Casper <casperklein@users.noreply.github.com>
…ker-mailserver#2134) * 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 docker-mailserver#2104 * quick fix * Update setup.sh Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com> Co-authored-by: Casper <casperklein@users.noreply.github.com>
Description
See: #2098
This PR will:
check-for-changes.sh
wait 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/
)