Skip to content

Commit

Permalink
Dont count test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
MTRNord committed Nov 1, 2023
1 parent 0e4a5ff commit ac888b5
Show file tree
Hide file tree
Showing 19 changed files with 48 additions and 16 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:

- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Install Rust
run: rustup toolchain install stable --component llvm-tools-preview
run: rustup toolchain install nightly --component llvm-tools-preview
- uses: Swatinem/rust-cache@81d053bdb0871dcd3f10763c8cc60d0adc41762b
- name: Install opendkim
run: apt update && apt install -y opendkim-tools
Expand Down Expand Up @@ -105,9 +105,9 @@ jobs:
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: |
cargo llvm-cov --no-report --workspace
cargo llvm-cov --no-report --features "jaeger" --workspace
cargo llvm-cov report --html
cargo +nightly llvm-cov --no-report --workspace
cargo +nightly llvm-cov --no-report --features "jaeger" --workspace
cargo +nightly llvm-cov report --html
env:
RUST_BACKTRACE: "1"
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
Expand All @@ -116,9 +116,9 @@ jobs:
path: target/llvm-cov/html/
- name: Generate code coverage for codecov
run: |
cargo llvm-cov --no-report --workspace
cargo llvm-cov --no-report --features "jaeger" --workspace
cargo llvm-cov report --lcov --output-path lcov.info
cargo +nightly llvm-cov --no-report --workspace
cargo +nightly llvm-cov --no-report --features "jaeger" --workspace
cargo +nightly llvm-cov report --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand All @@ -140,7 +140,7 @@ jobs:

- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Install Rust
run: rustup toolchain install stable --component llvm-tools-preview
run: rustup toolchain install nightly --component llvm-tools-preview
- uses: Swatinem/rust-cache@81d053bdb0871dcd3f10763c8cc60d0adc41762b
- name: Install opendkim and sqlite
run: apt update && apt install -y opendkim-tools sqlite3
Expand Down Expand Up @@ -171,9 +171,9 @@ jobs:
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: |
cargo llvm-cov --no-report --workspace --features sqlite --no-default-features
cargo llvm-cov --no-report --features "jaeger" --workspace --features sqlite --no-default-features
cargo llvm-cov report --html
cargo +nightly llvm-cov --no-report --workspace --features sqlite --no-default-features
cargo +nightly llvm-cov --no-report --features "jaeger" --workspace --features sqlite --no-default-features
cargo +nightly llvm-cov report --html
env:
RUST_BACKTRACE: "1"
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
Expand All @@ -182,9 +182,9 @@ jobs:
path: target/llvm-cov/html/
- name: Generate code coverage for codecov
run: |
cargo llvm-cov --no-report --workspace --features sqlite --no-default-features
cargo llvm-cov --no-report --features "jaeger" --workspace --features sqlite --no-default-features
cargo llvm-cov report --lcov --output-path lcov.info
cargo +nightly llvm-cov --no-report --workspace --features sqlite --no-default-features
cargo +nightly llvm-cov --no-report --features "jaeger" --workspace --features sqlite --no-default-features
cargo +nightly llvm-cov report --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
1 change: 1 addition & 0 deletions crates/erooster/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//! while being also fast and efficient.
//!
#![feature(string_remove_matches)]
#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
#![deny(unsafe_code, clippy::unwrap_used)]
#![warn(
clippy::cognitive_complexity,
Expand Down
1 change: 1 addition & 0 deletions crates/erooster_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//! Core logic for the erooster mail server
//!
#![feature(string_remove_matches)]
#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
#![deny(unsafe_code, clippy::unwrap_used)]
#![warn(
clippy::cognitive_complexity,
Expand Down
2 changes: 2 additions & 0 deletions crates/erooster_deps/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//
// SPDX-License-Identifier: Apache-2.0

#![cfg_attr(coverage_nightly, feature(coverage_attribute))]

pub use futures;
pub use tokio;
pub use tokio_rustls;
Expand Down
4 changes: 4 additions & 0 deletions crates/erooster_imap/src/commands/append.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ mod tests {
use erooster_deps::tokio;

#[allow(clippy::unwrap_used)]
#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_not_authenticated_state() {
let mut caps = Append {
Expand Down Expand Up @@ -218,6 +219,7 @@ mod tests {
}

#[allow(clippy::unwrap_used)]
#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_not_enough_arguments() {
let mut caps = Append {
Expand Down Expand Up @@ -252,6 +254,7 @@ mod tests {
}

#[allow(clippy::unwrap_used)]
#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_read_only_arguments() {
let mut caps = Append {
Expand Down Expand Up @@ -288,6 +291,7 @@ mod tests {

#[allow(clippy::unwrap_used)]
#[allow(clippy::too_many_lines)]
#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_append() {
let mut caps = Append {
Expand Down
2 changes: 2 additions & 0 deletions crates/erooster_imap/src/commands/capability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ mod tests {
tokio,
};

#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_get_capabilities() {
let caps = Capability {};
Expand All @@ -77,6 +78,7 @@ mod tests {
);
}

#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_get_unencrypted_capabilities() {
let caps = Capability {};
Expand Down
2 changes: 2 additions & 0 deletions crates/erooster_imap/src/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ mod tests {
use erooster_deps::futures::{channel::mpsc, StreamExt};
use erooster_deps::tokio;

#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_successful_check() {
let caps = Check {
Expand Down Expand Up @@ -102,6 +103,7 @@ mod tests {
assert_eq!(rx.next().await, Some(String::from("1 OK CHECK completed")));
}

#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_unsuccessful_check() {
let caps = Check {
Expand Down
3 changes: 3 additions & 0 deletions crates/erooster_imap/src/commands/close.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ mod tests {

// TODO: A test with data to delete is missing

#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_select_rw() {
let mut caps = Close {
Expand Down Expand Up @@ -120,6 +121,7 @@ mod tests {
assert_eq!(rx.next().await, Some(String::from("1 OK CLOSE completed")));
}

#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_selected_ro() {
let mut caps = Close {
Expand Down Expand Up @@ -153,6 +155,7 @@ mod tests {
);
}

#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_no_auth() {
let mut caps = Close {
Expand Down
3 changes: 3 additions & 0 deletions crates/erooster_imap/src/commands/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ mod tests {
tokio,
};

#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_create_trash() {
let caps = Create {
Expand Down Expand Up @@ -142,6 +143,7 @@ mod tests {
}

/// Since the state Authenticated is only required read-only selected is allowed to create rooms!
#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_create_read_only() {
let caps = Create {
Expand Down Expand Up @@ -178,6 +180,7 @@ mod tests {
);
}

#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_create_not_logged_in() {
let caps = Create {
Expand Down
2 changes: 2 additions & 0 deletions crates/erooster_imap/src/commands/enable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ mod tests {
use erooster_deps::tokio;

#[allow(clippy::unwrap_used)]
#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_utf8() {
let state = &mut Data {
Expand Down Expand Up @@ -86,6 +87,7 @@ mod tests {
}

#[allow(clippy::unwrap_used)]
#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_custom() {
let state = &mut Data {
Expand Down
2 changes: 2 additions & 0 deletions crates/erooster_imap/src/commands/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ mod tests {
use erooster_deps::tokio;

#[allow(clippy::unwrap_used)]
#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_not_selected() {
let state = &mut Data {
Expand Down Expand Up @@ -89,6 +90,7 @@ mod tests {
}

#[allow(clippy::unwrap_used)]
#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_selected_empty() {
let state = &mut Data {
Expand Down
5 changes: 5 additions & 0 deletions crates/erooster_imap/src/commands/parsers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,7 @@ mod tests {

use super::*;

#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_section() {
let input = "[HEADER.FIELDS (From To Cc Bcc Subject Date Message-ID Priority X-Priority References Newsgroups In-Reply-To Content-Type Reply-To x-spamd-result x-spam-score x-rspamd-score x-spam-status x-mailscanner-spamcheck X-Spam-Flag x-spam-level)]";
Expand All @@ -1055,6 +1056,7 @@ mod tests {
assert_eq!(unparsed, "");
}

#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_section_text() {
let input = "HEADER.FIELDS (From To Cc Bcc Subject Date Message-ID Priority X-Priority References Newsgroups In-Reply-To Content-Type Reply-To x-spamd-result x-spam-score x-rspamd-score x-spam-status x-mailscanner-spamcheck X-Spam-Flag x-spam-level)";
Expand All @@ -1065,6 +1067,7 @@ mod tests {
assert_eq!(unparsed, "");
}

#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_fetch_attributes() {
let input = "BODY.PEEK[HEADER.FIELDS (From To Cc Bcc Subject Date Message-ID Priority X-Priority References Newsgroups In-Reply-To Content-Type Reply-To x-spamd-result x-spam-score x-rspamd-score x-spam-status x-mailscanner-spamcheck X-Spam-Flag x-spam-level)]";
Expand All @@ -1075,6 +1078,7 @@ mod tests {
assert_eq!(unparsed, "");
}

#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_inner_fetch_arguments() {
let input = "(UID RFC822.SIZE FLAGS BODY.PEEK[HEADER.FIELDS (From To Cc Bcc Subject Date Message-ID Priority X-Priority References Newsgroups In-Reply-To Content-Type Reply-To x-spamd-result x-spam-score x-rspamd-score x-spam-status x-mailscanner-spamcheck X-Spam-Flag x-spam-level)])";
Expand All @@ -1085,6 +1089,7 @@ mod tests {
assert_eq!(unparsed, "");
}

#[cfg_attr(coverage_nightly, coverage(off))]
#[tokio::test]
async fn test_fetch_arguments() {
let input = "UID RFC822.SIZE FLAGS BODY.PEEK[HEADER.FIELDS (From To Cc Bcc Subject Date Message-ID Priority X-Priority References Newsgroups In-Reply-To Content-Type Reply-To x-spamd-result x-spam-score x-rspamd-score x-spam-status x-mailscanner-spamcheck X-Spam-Flag x-spam-level)]";
Expand Down
1 change: 1 addition & 0 deletions crates/erooster_imap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
//!
#![feature(string_remove_matches)]
#![feature(box_into_inner)]
#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
#![deny(unsafe_code, clippy::unwrap_used)]
#![warn(
clippy::cognitive_complexity,
Expand Down
1 change: 1 addition & 0 deletions crates/erooster_smtp/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ mod tests {
use enum_iterator::all;

#[test]
#[cfg_attr(coverage_nightly, coverage(off))]
fn test_parsing_commands() {
for command_variant in all::<Commands>() {
if let Commands::MAILFROM = command_variant {
Expand Down
1 change: 1 addition & 0 deletions crates/erooster_smtp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//! This crate is containing the smtp logic of the erooster mail server.
//!
#![feature(string_remove_matches)]
#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
#![deny(unsafe_code, clippy::unwrap_used)]
#![warn(
clippy::branches_sharing_code,
Expand Down
2 changes: 1 addition & 1 deletion crates/erooster_smtp/src/servers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub(crate) mod encrypted;
pub(crate) mod sending;
pub(crate) mod state;

// TODO make this only pub for benches and tests
// TODO: make this only pub for benches and tests
#[allow(missing_docs)]
pub mod unencrypted;

Expand Down
2 changes: 1 addition & 1 deletion crates/erooster_smtp/src/servers/unencrypted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use std::net::SocketAddr;
pub struct Unencrypted;

impl Unencrypted {
// TODO make this only pub for benches and tests
// TODO: make this only pub for benches and tests
#[allow(missing_docs)]
#[allow(clippy::missing_errors_doc)]
#[instrument(skip(config, database, storage))]
Expand Down
1 change: 1 addition & 0 deletions crates/erooster_web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//! Core logic for the webserver for the erooster mail server
//!
#![feature(string_remove_matches)]
#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
#![deny(unsafe_code, clippy::unwrap_used)]
#![warn(
clippy::cognitive_complexity,
Expand Down
1 change: 1 addition & 0 deletions crates/eroosterctl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//! while being also fast and efficient.
//!
#![feature(string_remove_matches)]
#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
#![deny(unsafe_code, clippy::unwrap_used)]
#![warn(
clippy::cognitive_complexity,
Expand Down

0 comments on commit ac888b5

Please sign in to comment.