You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2021/10/28 07:59:38 UTC

[GitHub] [james-project] grault opened a new pull request #715: ability to assert mock emails without possible race condition

grault opened a new pull request #715:
URL: https://github.com/apache/james-project/pull/715


   // reopening https://github.com/linagora/james-project/pull/4421 here as per @chibenwa 's request
   
   We use the mock smtp to assert emails sent out from our test environments. The GET/DELETE api is very nice, but there's no guarantee that you don't get emails between these calls. It could be that by the time you call DELETE, you got an extra email that you haven't observed via GET.
   
   One change in this PR is to amend DELETE to return the deleted emails, so you can be sure that you only delete emails that you can later observe. It's decided to be done this way to maximize backward compatibility for people already using DELETE.
   
   We also poll number of emails and not necessarily want to retrieve all the emails every time and count them. For this, an extra GET endpoint is added which just returns the number of emails currently available in the repository.
   
   For us, it would be nice to have these use cases covered by your upstream repo and then we wouldn't have to monitor for changes and rebase our patch on top of them. So in case you're not against covering these use cases, we're happy to contribute resolving changes in a different form/implementation if needed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] grault edited a comment on pull request #715: ability to assert mock emails without possible race condition

Posted by GitBox <gi...@apache.org>.
grault edited a comment on pull request #715:
URL: https://github.com/apache/james-project/pull/715#issuecomment-955030707


   > I do think a comprehensive documentation of the HTTP endpoints would make it easier for people to re-use it. Just in case you are interested this could be a really appreciated second contribution to apache/james, if you have some spare time :-p
   
   What about extending https://github.com/apache/james-project/tree/master/server/mailet/mock-smtp-server#readme with further one liners, using `curl`? `curl` speaks http and smtp. Showcasing the endpoints? Maybe pretty printing json with `jq`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] chibenwa commented on pull request #715: ability to assert mock emails without possible race condition

Posted by GitBox <gi...@apache.org>.
chibenwa commented on pull request #715:
URL: https://github.com/apache/james-project/pull/715#issuecomment-954837610


   Done. Merged. Thanks for the contribution.
   
   I am glad that the mock smtp server gets used outside of james project!
   
   The sub-project started as a humble project to test our outgoing SMTP in some complex scenario. The sub-project is poorly documented, which I believe may discourage some external uses.
   
   I do think a comprehensive documentation of the HTTP endpoints would make it easier for people to re-use it. Just in case you are interested this could be a really appreciated second contribution to apache/james, if you have some spare time :-p


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] chibenwa commented on a change in pull request #715: ability to assert mock emails without possible race condition

Posted by GitBox <gi...@apache.org>.
chibenwa commented on a change in pull request #715:
URL: https://github.com/apache/james-project/pull/715#discussion_r738152744



##########
File path: server/mailet/mock-smtp-server/src/main/java/org/apache/james/mock/smtp/server/HTTPConfigurationServer.java
##########
@@ -232,4 +242,17 @@ public RunningStage start() {
             return res.status(INTERNAL_SERVER_ERROR).send();
         }
     }
+
+    private Publisher<Void> getMailsCount(HttpServerRequest req, HttpServerResponse res) {
+        var count = receivedMailRepository.list().stream().count();

Review comment:
       Can we use the real type here to? We tend to not use `var` on this project.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] chibenwa merged pull request #715: ability to assert mock emails without possible race condition

Posted by GitBox <gi...@apache.org>.
chibenwa merged pull request #715:
URL: https://github.com/apache/james-project/pull/715


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] chibenwa commented on pull request #715: ability to assert mock emails without possible race condition

Posted by GitBox <gi...@apache.org>.
chibenwa commented on pull request #715:
URL: https://github.com/apache/james-project/pull/715#issuecomment-955139194


   Looks like a great idea to me!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] grault commented on a change in pull request #715: ability to assert mock emails without possible race condition

Posted by GitBox <gi...@apache.org>.
grault commented on a change in pull request #715:
URL: https://github.com/apache/james-project/pull/715#discussion_r738186840



##########
File path: server/mailet/mock-smtp-server/src/main/java/org/apache/james/mock/smtp/server/HTTPConfigurationServer.java
##########
@@ -232,4 +242,17 @@ public RunningStage start() {
             return res.status(INTERNAL_SERVER_ERROR).send();
         }
     }
+
+    private Publisher<Void> getMailsCount(HttpServerRequest req, HttpServerResponse res) {
+        var count = receivedMailRepository.list().stream().count();

Review comment:
       Ahh, makes sense, I managed to miss this. Fixing.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] grault commented on pull request #715: ability to assert mock emails without possible race condition

Posted by GitBox <gi...@apache.org>.
grault commented on pull request #715:
URL: https://github.com/apache/james-project/pull/715#issuecomment-955030707


   > I do think a comprehensive documentation of the HTTP endpoints would make it easier for people to re-use it. Just in case you are interested this could be a really appreciated second contribution to apache/james, if you have some spare time :-p
   
   What about extending https://github.com/apache/james-project/tree/master/server/mailet/mock-smtp-server#readme with further one liners, using `curl`? `curl` speaks http and smtp. Showcasing the endpoints?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org