From 38a4030ff9ece9e3cbfaf654eddf112db450fea4 Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Fri, 15 Jul 2022 22:43:51 -0400 Subject: [PATCH] update github actions to test against cyrus-imapd as well as greenmail --- .github/workflows/test.yml | 27 ++++++++++++++++++++++++++- README.md | 9 ++++++++- tests/imap_integration.rs | 5 +++-- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6df1579..5ccf4a5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ name: cargo test jobs: test: runs-on: ubuntu-latest - name: ${{ matrix.toolchain }} + name: greenmail/${{ matrix.toolchain }} strategy: matrix: toolchain: [stable, beta, nightly] @@ -32,3 +32,28 @@ jobs: - 3995:3995 env: GREENMAIL_OPTS: "-Dgreenmail.setup.test.all -Dgreenmail.hostname=0.0.0.0 -Dgreenmail.auth.disabled -Dgreenmail.verbose" + test_cyrus: + runs-on: ubuntu-latest + name: cyrus/${{ matrix.toolchain }} + strategy: + matrix: + toolchain: [stable, beta, nightly] + steps: + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.toolchain }} + - uses: actions/checkout@v2 + - name: cargo test + uses: actions-rs/cargo@v1 + with: + command: test + args: -- --ignored + services: + cyrus_imapd: + image: outoforder/cyrus-imapd-tester:latest + ports: + - 3025:25 + - 3143:143 + - 3465:465 + - 3993:993 diff --git a/README.md b/README.md index 3b2d745..0a0d30e 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,14 @@ easiest way to do that is with Docker: ```console $ docker pull greenmail/standalone:1.6.8 -$ docker run -t -i -e GREENMAIL_OPTS='-Dgreenmail.setup.test.all -Dgreenmail.hostname=0.0.0.0 -Dgreenmail.auth.disabled -Dgreenmail.verbose' -p 3025:3025 -p 3110:3110 -p 3143:3143 -p 3465:3465 -p 3993:3993 -p 3995:3995 greenmail/standalone:1.6.3 +$ docker run -it --rm -e GREENMAIL_OPTS='-Dgreenmail.setup.test.all -Dgreenmail.hostname=0.0.0.0 -Dgreenmail.auth.disabled -Dgreenmail.verbose' -p 3025:3025 -p 3110:3110 -p 3143:3143 -p 3465:3465 -p 3993:3993 -p 3995:3995 greenmail/standalone:1.6.3 +``` + +Another alternative is to test against cyrus imapd which is a more complete IMAP implementation that greenmail (supporting quotas and ACLs). + +``` +$ docker pull outoforder/cyrus-imapd-tester +$ docker run -it --rm -p 3025:25 -p 3110:110 -p 3143:143 -p 3465:465 -p 3993:993 outoforder/cyrus-imapd-tester:latest ``` ## License diff --git a/tests/imap_integration.rs b/tests/imap_integration.rs index 30d2687..ec455b1 100644 --- a/tests/imap_integration.rs +++ b/tests/imap_integration.rs @@ -25,7 +25,7 @@ fn test_host() -> String { fn test_smtp_host() -> String { std::env::var("TEST_SMTP_HOST") - .unwrap_or_else(|| std::env::var("TEST_HOST").unwrap_or("127.0.0.1".to_string())) + .unwrap_or_else(|_| std::env::var("TEST_HOST").unwrap_or("127.0.0.1".to_string())) } fn test_imap_port() -> u16 { @@ -101,6 +101,7 @@ fn smtp(user: &str) -> lettre::SmtpTransport { } #[test] +#[ignore] fn connect_insecure_then_secure() { let host = test_host(); // ignored because of https://github.com/greenmail-mail-test/greenmail/issues/135 @@ -342,7 +343,7 @@ fn list() { let mut s = session("readonly-test@localhost"); s.select("INBOX").unwrap(); let subdirs = s.list(None, Some("%")).unwrap(); - assert_eq!(subdirs.len(), 0); + assert_eq!(subdirs.len(), 1); // TODO: make a subdir }