Categorygithub.com/foxcpp/go-imap-backend-tests
modulepackage
0.0.0-20200617132817-958ea5829771
Repository: https://github.com/foxcpp/go-imap-backend-tests.git
Documentation: pkg.go.dev

# README

go-imap-backend-tests

Blackbox tests for go-imap backends.

The main intention of suite is to test for basic RFC 3501 conformance. Tests are developed in parallel with go-imap-sql so they reflect its conformance.

Tests

  • IMAPUserDB interface tests
  • Tests for mailbox management commands
  • Tests for SEARCH and FETCH commands (for UID versions too) (ListMessages, SearchMessages)
  • Tests for COPY/UID COPY commands (CopyMessages)
  • Tests for STATUS command (Status)
  • Tests for EXPUNGE command (Expunge)
  • Tests for UPDATE command (SetMessagesFlags)
  • Tests for unilateral updates (optional, backend.Updater interface)
  • Test for UID monotonic increase
  • Test for UIDVALIDITY/UIDNEXT change on mailbox rename
  • APPENDLIMIT extension tests (optional, see [appendlimit.go][appendlimit.go] for interfaces)
  • CHILDREN extension tests (optional, see [children/server.go][children/server.go] for interfaces)
  • MOVE extension tests (optional) (MoveMessages)

Blacklist/whitelist tests

You can disable some tests by setting Whitelist or Blacklist slices before calling RunTests.

If Whitelistis not nil, only tests that have name starting with any listed string will be run.

If Blacklistis not nil, tests that have name starting with any listed string will not be run. Blacklist is still checked if Whitelistis set.

Excluded tests will be skipped using testing/T.SkipNow function.

For strings, use full name of test, as printed by go test -v, but unescaped.

Incomplete RFC 3501 conformance

As this suite reflects state of go-imap-sql implementation, it may not test for all requirements of IMAP specification. There are known ignored cases:

  • /NoSelect attribute and removal of mailboxes with children

How to use

Tested backend must implement IMAPUsersDB interface.

Just call testsuite.RunTests(t, newBackend, closeBackend) from your backend (or backend_test) package. Each invocation of newBackend callback should provide clean instance of backend (e.g. with empty storage, etc). closeBackend will be called for backend after usage. New instance is created for each test.

# Packages

No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
RunTests runs all tests against backend created using passed callback functions.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author

# Interfaces

AppendLimitBackend is extension for main backend interface (backend.Backend) which allows to set append limit value for testing and administration purposes.
AppendLimitMbox is extension for backend.Mailbox interface which allows to set append limit value for testing and administration purposes.
AppendLimitUser is extension for backend.User interface which allows to set append limit value for testing and administration purposes.
No description provided by the author

# Type aliases

CloseBackFunc should clean up Backend object after testing.
NewBackFunc should create new Backend object configured for testing.