Skip to content

Provide complete refactoring of openDKIM script#1812

Merged
wernerfred merged 8 commits intomasterfrom
open-dkim
Feb 18, 2021
Merged

Provide complete refactoring of openDKIM script#1812
wernerfred merged 8 commits intomasterfrom
open-dkim

Conversation

@georglauterbach
Copy link
Copy Markdown
Member

@georglauterbach georglauterbach commented Feb 16, 2021

Description

Complete refactoring of target/bin/generate-dkim-config and outsourcing of tests.

What's left to do?

Many of the currently present tests need a rewrite. This is indicated in the open_dkim.bats file with # TODO. @wernerfred or @casperklein I have already spent more time than I have on this. I would need your help here.

Note: The Makefile's test target is currently only testing the openDKIM config for speed. This will of course be reverted before merging.

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 pr/needs review priority/medium area/scripts kind/improvement Improve an existing feature, configuration file or the documentation labels Feb 16, 2021
@georglauterbach georglauterbach self-assigned this Feb 16, 2021
Comment thread README.md Outdated
Comment thread target/bin/generate-dkim-config Outdated
Comment thread Makefile
@wernerfred
Copy link
Copy Markdown
Member

Pretty busy today. I'll take a look at it as soon as I have a larger time frame available.
Last time i hotfixed the bad tests (told ya that calling them bad style is way no nice) i looked for alternatives and discovered that opendkim already provides a checkkey option. Sadly it relies on DNS i think which will not work (at least without changes). But I will see if I find a solution.
If you came up with an idea on how to check the keys in a "correct" way feel free to drop it here.

@georglauterbach
Copy link
Copy Markdown
Member Author

Pretty busy today. I'll take a look at it as soon as I have a larger time frame available.

No hurry. Some tests just require proper formatting (I already did a bit on this topic), some a bit refactoring (get rid of wc -l and stuff), and some require more attention. Take your time.

I'm learning for exams atm, therefore I don not have any more spare time.

@polarathene
Copy link
Copy Markdown
Member

After my PRs are sorted, I have a related docker-compose setup I plan to tidy up and publish on github as a reference setup. It has custom DNS service via container for all containers involved to use and another container that can update DNS records via a text template.

Might be appropriate for what you want to do, as I get the time, I'll be extending my reference to cover mail server DNS records myself. If you'd like to include for tests let me know :)

@georglauterbach georglauterbach changed the title Provide complete refactoring of openDKIM usage and tests Provide complete refactoring of openDKIM script Feb 18, 2021
@georglauterbach
Copy link
Copy Markdown
Member Author

@wernerfred I would like to propose an idea: I would like to focus on the unit tests later in a separate PR because of two reasons:

  1. I would like to see this PR merged :)
  2. I don't want to pressure you into writing tests up. Currently tests are passing fine and I already separated them into their own file, which makes working with them in the future a lot easier.

If you agree, you can just go ahead and merge this or tell me and I will do it :)

@wernerfred
Copy link
Copy Markdown
Member

Seems logic to me. I will agree as we will definitely need to refactor at least half of the test. Doing this in a separate step together with all others might safe more time in the end as doing it step by step and need to get into it every time again. But we should focus on this in the next time.
This will be a massive PR on which multiple people can work for quite a while. Shouldn't affect the development of the project at all only rebases from time to time will be necessary.

@wernerfred wernerfred merged commit 1005bb3 into master Feb 18, 2021
@wernerfred wernerfred deleted the open-dkim branch February 18, 2021 09:29
@georglauterbach
Copy link
Copy Markdown
Member Author

This will be a massive PR on which multiple people can work for quite a while. Shouldn't affect the development of the project at all only rebases from time to time will be necessary.

Completely agree.

Comment thread target/bin/open-dkim
Comment on lines +88 to +89
break
break
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you using break here instead of shift ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I messed up. Can you correct this for me? Currently short on time...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/docker-mailserver/docker-mailserver/runs/1929465064?check_suite_focus=true#step:6:325

@aendeavor any idea?:

# -- line differs --
# index    : 3
# expected :     open-dkim - configure DomainKeys Identified Mail (DKIM)
# actual   :     open-dkim - configure DomainKeys Identified Mail (DKIM)
# --
# 

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually your change (d221c58#diff-9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a089) never went through CI as it was no PR and therefore tests didn't run only the linting.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might the output have problems with colors?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it locally with \e[0m but no difference. So the problem might be something else. But I don't get it. The output is exactly the same.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I added --partial to the assert line and the test went through locally, will push this as a hotfix but I want to know which "invisible" char breaks the check

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is absolutely weird... For setup.sh it seems to work just fine...

@wernerfred wernerfred mentioned this pull request Feb 18, 2021
7 tasks
@polarathene polarathene mentioned this pull request Feb 5, 2023
5 tasks
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.

3 participants