Skip to content

patching the delmailuser script to function properly (+ refactoring)#1809

Merged
georglauterbach merged 2 commits intodocker-mailserver:masterfrom
georglauterbach:delmailuser-patch
Feb 14, 2021
Merged

patching the delmailuser script to function properly (+ refactoring)#1809
georglauterbach merged 2 commits intodocker-mailserver:masterfrom
georglauterbach:delmailuser-patch

Conversation

@georglauterbach
Copy link
Copy Markdown
Member

Description

This PR refactors delmailuser to function properly (hopefully).

Fixes #1808 (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (non-breaking change that does improve existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md or ENVIRONMENT.md or the Wiki)
  • If necessary I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@georglauterbach georglauterbach added area/issue priority/medium area/scripts kind/improvement Improve an existing feature, configuration file or the documentation labels Feb 14, 2021
@georglauterbach georglauterbach self-assigned this Feb 14, 2021
@georglauterbach
Copy link
Copy Markdown
Member Author

georglauterbach commented Feb 14, 2021

So

echo "Mailbox deleted." || errex "Mailbox couldn't be deleted: ${?}"

is obviously hilarious. The tests however do not seem to like

if [[ -d "/var/mail/${MAILARR[1]}/${MAILARR[0]}" ]]
then
  ...
else
  errex "Mailbox directory '/var/mail/${MAILARR[1]}/${MAILARR[0]}' does not exist." # <- especially this
fi

which before would not be exiting with a non-zero exit code. I would just change this to

if [[ -d "/var/mail/${MAILARR[1]}/${MAILARR[0]}" ]]
then
  ...
else
  echo "Mailbox directory '/var/mail/${MAILARR[1]}/${MAILARR[0]}' did not exist."
fi

@wernerfred Your take? Ima be honest here, not sure if the tests are written to conform to the shitty script...?

PS: I just did it and I will see how it turns out.

Comment thread target/bin/delmailuser
Comment thread target/bin/delmailuser
@wernerfred
Copy link
Copy Markdown
Member

wernerfred commented Feb 14, 2021

@wernerfred Your take? Ima be honest here, not sure if the tests are written to conform to the shitty script...?

Speaking directly (no offense to the original test writers) for me it was really hard to understand what's going on with a lot of the tests I examined as I had to patch a test for the dkim PR. There are a lot of tests where calling them bad style would be too nice. Sometimes the authors even stated in the comments above that the test is really crap and will propably also pass if something else is given as ENV (testing only wc -l ). Imho there would be a major refactoring necessary. Also there is a huge wild growth of configuration dirs and configs as every test author approached it a bit different. We should also consider writing a How-To about the tests as it is really hard to get into it from a outside perspective.

echo "Mailbox deleted." || errex "Mailbox couldn't be deleted: ${?}"

🤣 🤣 🤣

@georglauterbach
Copy link
Copy Markdown
Member Author

@wernerfred Your take? Ima be honest here, not sure if the tests are written to conform to the shitty script...?

Speaking directly (no offense to the original test writers) for me it was really hard to understand what's going on with a lot of the tests I examined as I had to patch a test for the dkim PR. There are a lot of tests where calling them bad style would be too nice. Sometimes the authors even stated in the comments above that the test is really crap and will propably also pass if something else is given as ENV (testing only wc -l ). Imho there would be a major refactoring necessary. Also there is a huge wild growth of configuration dirs and configs as every test author approached it a bit different. We should also consider writing a How-To about the tests as it is really hard to get into it from a outside perspective.

Indeed, the tests will need complete overhaul in the future.

echo "Mailbox deleted." || errex "Mailbox couldn't be deleted: ${?}"

rofl rofl rofl

I didn't even see this the first time, but when I saw it, I was perplexed...


Tests are passing now. This is ready for merging, only waiting for your review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/scripts kind/improvement Improve an existing feature, configuration file or the documentation priority/medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Mailbox contents not deleted

2 participants