Stable integration test deleting many messages using UID EXPUNGE

This commit is contained in:
Michal Horejsek
2021-01-29 12:02:29 +01:00
parent 00b5046653
commit 46bc8b08dc
4 changed files with 21 additions and 1 deletions

View File

@ -32,7 +32,10 @@ Feature: IMAP remove messages from mailbox
And there is IMAP client selected in "<mailbox>" And there is IMAP client selected in "<mailbox>"
When IMAP client marks message seq "1:*" as deleted When IMAP client marks message seq "1:*" as deleted
Then IMAP response is "OK" Then IMAP response is "OK"
When IMAP client sends expunge # Use UID version to not be sensitive about the order from API. Event loop
# could return it in different order and delete first message with seq 1,
# which would produce EXPUNGE sequence as 1 4 3 2 1, for example.
When IMAP client sends expunge by UID "1:5"
Then IMAP response is "OK" Then IMAP response is "OK"
And IMAP response contains "\* 1 EXPUNGE" And IMAP response contains "\* 1 EXPUNGE"
And IMAP response contains "\* 2 EXPUNGE" And IMAP response contains "\* 2 EXPUNGE"

View File

@ -58,6 +58,8 @@ func IMAPActionsMessagesFeatureContext(s *godog.Suite) {
s.Step(`^IMAP client "([^"]*)" starts IDLE-ing$`, imapClientNamedStartsIDLEing) s.Step(`^IMAP client "([^"]*)" starts IDLE-ing$`, imapClientNamedStartsIDLEing)
s.Step(`^IMAP client sends expunge$`, imapClientExpunge) s.Step(`^IMAP client sends expunge$`, imapClientExpunge)
s.Step(`^IMAP client "([^"]*)" sends expunge$`, imapClientNamedExpunge) s.Step(`^IMAP client "([^"]*)" sends expunge$`, imapClientNamedExpunge)
s.Step(`^IMAP client sends expunge by UID "([^"]*)"$`, imapClientExpungeByUID)
s.Step(`^IMAP client "([^"]*)" sends expunge by UID "([^"]*)"$`, imapClientNamedExpungeByUID)
s.Step(`^IMAP client sends ID with argument:$`, imapClientSendsID) s.Step(`^IMAP client sends ID with argument:$`, imapClientSendsID)
s.Step(`^IMAP client "([^"]*)" sends ID with argument:$`, imapClientNamedSendsID) s.Step(`^IMAP client "([^"]*)" sends ID with argument:$`, imapClientNamedSendsID)
} }
@ -287,6 +289,16 @@ func imapClientNamedExpunge(imapClient string) error {
return nil return nil
} }
func imapClientExpungeByUID(uids string) error {
return imapClientNamedExpungeByUID("imap", uids)
}
func imapClientNamedExpungeByUID(imapClient, uids string) error {
res := ctx.GetIMAPClient(imapClient).ExpungeUID(uids)
ctx.SetIMAPLastResponse(imapClient, res)
return nil
}
func imapClientSendsID(data *gherkin.DocString) error { func imapClientSendsID(data *gherkin.DocString) error {
return imapClientNamedSendsID("imap", data) return imapClientNamedSendsID("imap", data)
} }

View File

@ -246,6 +246,10 @@ func (c *IMAPClient) Expunge() *IMAPResponse {
return c.SendCommand("EXPUNGE") return c.SendCommand("EXPUNGE")
} }
func (c *IMAPClient) ExpungeUID(ids string) *IMAPResponse {
return c.SendCommand(fmt.Sprintf("UID EXPUNGE %s", ids))
}
// Extennsions // Extennsions
// Extennsions: IDLE // Extennsions: IDLE

View File

@ -12,3 +12,4 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
* GODT-885 Do not explicitly unlabel folders during move to match behaviour of other clients. * GODT-885 Do not explicitly unlabel folders during move to match behaviour of other clients.
### Fixed ### Fixed
* GODT-1011 Stable integration test deleting many messages using UID EXPUNGE.