docker-mailserver/test/config/example-opendkim/keys/otherdomain.tld/mail.private
Brennan Kinney 88767f7cc8
tests(refactor): open_dkim.bats (#3060)
* tests(refactor): Make test cases for opendkim keysizes DRY

- These all do roughly the same logic that can be split into two separate methods.
- `_should_generate_dkim_key()` covers a bit more logic as it can be leveraged to handle other test cases that also perform the same logic.
- The `config/opendkim/` doesn't seem necessary for tests. Only the first few test cases here are testing against it, so we can conditionally make that available. `process_check_restart.bats` also depended on it to run OpenDKIM successfully, but this was due to the `setup-stack.sh` config defaults failing to find an "empty" file forcing `supervisord` to constantly restart the process..
- With this, there we inverse the default opendkim config, so we don't have to mount unique / empty subfolders for each test case, followed by copying over the two extra configs.

* tests(refactor): DRY up more test cases

All the remaining test cases but the last one were refactored here for a clean commit diff. The last test case will be refactored in the following commit.

Plenty of repeated logic spread across these test cases, now condensed into shared methods.

* tests(refactor): Make final test case DRY

* chore: Migrate to new testing helpers

* chore: Revise test case descriptions

* tests(refactor): Improve and simplify assertions

* tests(refactor): Use common container setup instead of `docker run`

- As the majority of test cases are only running `open-dkim` helper, we don't actually have to wait for a full container setup. So an alternative container start is called.
- Also improves assertions a bit more instead of just counting lines.
- Some test cases don't bind mount all of `/tmp/docker-mailserver` contents, thus don't raise permission errors on subsequent test runs.
- Instead of `rm -f` on some config files, have opted to mount them read-only instead, or alternatively mount an anonymous empty volume instead.
- Collapsed the first three test cases into one, thus no `setup_file()` necessary.
- Shift the `_wait_for_finished_setup_in_container()` method into `_common_container_setup()` instead since nothing else is using `_common_container_start()` yet, this allows for avoiding the wait.

* tests(refactor): Collapse dkim key size test cases into single test case

This makes these tests a bit more DRY, and enhances the raised quality issue with these tests. Now not only is the domain checked in the generated DNS dkim record, but we also verify the key size is corrected in the public and private keys via openssl.

* chore: Revise container names

* chore: Swap order of test case 1 and 2

* tests(refactor): Assert generated log output

- `__should_have_tables_trustedhosts_for_domain` shifted in each test case to just after generating the domains keys.
- Asserts `open-dkim` logs instead of just counting them.
- Added checks for domains that should not be present in a test case.
- Additional coverage and notes about the alias from vhost `@localdomain.com`
- Single assert statement with switch statement as all are using common args.

* chore: Minor changes

* tests(refactor):  Share `find` logic in helpers and tests

* tests(fix): Listing file content does not need to match line order

The order printed from local system vs CI differed causing the CI to fail. The order of lines is irrelevant so `--index` is not required.

Additionally correct the prefix of the called method to be only one `_` now that it's a `common.bash` helper method.

* chore: Collapse custom DKIM selector test into custom DKIM domain test

These cover the same test logic for the most part, the first domain could also be testing the custom selector.

`special_use_folders.bats` + `mailbox_format_dbox` can assert lines instead, removing the need for `--partial`.

* Apply suggestions from code review

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>

* chore: Split switch statement method into wrapper methods

---------

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
2023-02-10 00:18:06 +13:00

16 lines
887 B
Plaintext

-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQCurRsOh4NyTOqDnpPlPLGlQDuoQl32Gdkfzw7BBRKDcelIZBmQ
f0uhXKSZVKe5Q596w/3ESJ9WOlB03SISnHy8lq/ZJ1+vhSZQfHvp0cHQl4BgNzkt
RCARdPY+5nVerF8aUSsT3bG2O+2r09AY4okLCVfkiwg6Nz2Eo7j4Z7mqNwIDAQAB
AoGAewyYzdBqqZ9DaPrR5p+t6OJp5Cr0dARbbsv28cQ3+X7KPmO9mowB5CcWEKmR
CbJ4awwb/STHkf+8Y8bPVNsGBs0FO4Y7prLjzqjOWmm/Yw4XYRJyZLb8qkzRMcOT
AIt7AWzxvdUOWB7XkG3MZC7qjmrWnXPUltLJIrdyv/T3ynkCQQDmF7Anqez14gc2
96XfYc1s/5JQFkGyG/kAI8lGqgSHpq3aEMUDv+/YZqtIdFjN8dFwnfhJy1mMiSVN
s2mjhYz1AkEAwlgRKHAMLFbv1Nn9wasJ2crArzHrM8lG90GldRfKXLpv5HNw42GV
yPn48hIvCpxrO+gpZ1DQaX6dlPj0/dze+wJBANc8B2tC+EeV9PvFMyO/wEMa20oR
V8j9g7JOx4RTnEMsdupKz5DPZdP/TnBLbZrQfwOisdSN5SmiTQPfNY1ia1UCQDYV
SAEW3WxhbTCw0XtZ283uLJ0UqT2qH8OjUyY4zqnrgEP1FE9S0toxJmRHRywOx5DO
VOdZiAYzpCrW9WbIVo0CQQDdtJEGYcM0v8N4i6T02VNikz3MzJ65g+kcnqTjsl1t
eqowRyqQbSPlmTEMcAP0MJALg1TWDIlLaAUHd/v+5z06
-----END RSA PRIVATE KEY-----