-
-
Notifications
You must be signed in to change notification settings - Fork 2k
feat: start implementing replication - Add DOVECOT_ITERATE_ATTRS/FILTER ENVs #3426
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -158,6 +158,53 @@ function teardown_file() { | |||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| @test "dovecot: ldap email listing works" { | ||||||||||||||||||||||||||||||||||||
| _run_in_container doveadm user '*' | ||||||||||||||||||||||||||||||||||||
| assert_success | ||||||||||||||||||||||||||||||||||||
| assert_line --index 0 '[email protected]' | ||||||||||||||||||||||||||||||||||||
| assert_line --index 1 '[email protected]' | ||||||||||||||||||||||||||||||||||||
| assert_line --index 2 '[email protected]' | ||||||||||||||||||||||||||||||||||||
| _should_output_number_of_lines 3 | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| @test "dovecot: (ENV DOVECOT_ITERATE_ATTRS=uniqueIdentifier=user) ldap email listing works" { | ||||||||||||||||||||||||||||||||||||
| local CUSTOM_SETUP_ARGUMENTS=( | ||||||||||||||||||||||||||||||||||||
| --env DOVECOT_ITERATE_ATTRS='uniqueIdentifier=user' | ||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+172
to
+174
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for reasons that I ignore, this does not seem to give the options to the container creation process Any help would be very welcome 🙏🏻
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You will need to provide the array If you want to have it added to the ENV of the container, you'll need to do so at the top of the file where the container is created I guess (or wherever it is created). Probably and
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, we need to create a new container instance when we want to use different ENV like your test-cases do. I've converted the test file into the new format we use, but it is the kind that sets all containers up in the main We could technically have multiple Technically you could right now define a common base ENV and combine like done here: docker-mailserver/test/tests/parallel/set3/container_configuration/process_check_restart.bats Lines 112 to 115 in e9f04cf
Then you can create a container with different ENV like this small test-case: docker-mailserver/test/tests/parallel/set3/container_configuration/process_check_restart.bats Lines 131 to 143 in e9f04cf
You'd just expand an array like in the prior snippet I showed for sharing the base ENV each container is needing. Do note that you don't have to call it Plan is that after converting all tests to the new format, to do another pass that moves to
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also note that a PR is about to get merged which changes the test Although my goal is iterating towards |
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| _run_in_container doveadm user '*' | ||||||||||||||||||||||||||||||||||||
| assert_success | ||||||||||||||||||||||||||||||||||||
| assert_line --index 0 'some.user' | ||||||||||||||||||||||||||||||||||||
| assert_line --index 1 'some.other.user' | ||||||||||||||||||||||||||||||||||||
| assert_line --index 2 'some.user.id' | ||||||||||||||||||||||||||||||||||||
| _should_output_number_of_lines 3 | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| @test "dovecot: (ENV DOVECOT_ITERATE_FILTER=(objectClass=PostfixBookMailAccount)) ldap email listing works" { | ||||||||||||||||||||||||||||||||||||
| local CUSTOM_SETUP_ARGUMENTS=( | ||||||||||||||||||||||||||||||||||||
| --env DOVECOT_ITERATE_FILTER='(objectClass=PostfixBookMailAccount)' | ||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| _run_in_container doveadm user '*' | ||||||||||||||||||||||||||||||||||||
| assert_success | ||||||||||||||||||||||||||||||||||||
| assert_line --index 0 '[email protected]' | ||||||||||||||||||||||||||||||||||||
| assert_line --index 1 '[email protected]' | ||||||||||||||||||||||||||||||||||||
| assert_line --index 2 '[email protected]' | ||||||||||||||||||||||||||||||||||||
| _should_output_number_of_lines 3 | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+184
to
+195
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's an example of what this would look like from the advice given in my review feedback: @test "dovecot: (ENV DOVECOT_ITERATE_FILTER=(objectClass=PostfixBookMailAccount)) ldap email listing works" {
# Container setup:
export CONTAINER_NAME='dms-test_ldap_dovecot-iter3'
local CONTAINER_ARGS_ENV_CUSTOM=(
"${CONFIG_CONTAINER_BASE[@]}"
--env DOVECOT_ITERATE_FILTER='(objectClass=PostfixBookMailAccount)'
)
_init_with_defaults
_common_container_setup 'CONTAINER_ARGS_ENV_CUSTOM'
# Actual test-case:
_run_in_container doveadm user '*'
assert_success
assert_line --index 0 '[email protected]'
assert_line --index 1 '[email protected]'
assert_line --index 2 '[email protected]'
_should_output_number_of_lines 3
# Cleanup, removes test-case container:
_default_teardown
}The cleanup is just force removing the container: docker-mailserver/test/helper/setup.bash Lines 198 to 204 in e9f04cf
Setup is like we do in Setting the name will ensure the helper methods used will know which container to use implicitly. |
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| @test "dovecot: (ENV DOVECOT_ITERATE_FILTER=(uniqueIdentifier=some.user.id)) ldap email listing works" { | ||||||||||||||||||||||||||||||||||||
| local CUSTOM_SETUP_ARGUMENTS=( | ||||||||||||||||||||||||||||||||||||
| --env DOVECOT_ITERATE_FILTER='(uniqueIdentifier=some.user.id)' | ||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| _run_in_container doveadm user '*' | ||||||||||||||||||||||||||||||||||||
| assert_success | ||||||||||||||||||||||||||||||||||||
| assert_line --index 0 '[email protected]' | ||||||||||||||||||||||||||||||||||||
| _should_output_number_of_lines 1 | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # dovecot | ||||||||||||||||||||||||||||||||||||
| @test "dovecot: ldap imap connection and authentication works" { | ||||||||||||||||||||||||||||||||||||
| _run_in_container_bash 'nc -w 1 0.0.0.0 143 < /tmp/docker-mailserver-test/auth/imap-ldap-auth.txt' | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
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.
On production I had removed the user patches lines to insert the following lines
I am starting to think that only adding ENVs like DOVECOT_ITERATE_ATTRS may not be enougth to have the magic work. Maybe default values in this file are an essential part too
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.
What is not working for you?
You just want the test-cases you added to pass with the expected output correct? I'll ensure that happens 👍