Skip to content

Speed up slow tests #1892

@thomas-zahner

Description

@thomas-zahner

The following slow tests have been bugging me for a while now.

PASS [   7.266s] lychee::cli cli::test_lycheecache_exclude_custom_status_codes
PASS [   7.138s] lychee-lib client::tests::test_timeout
PASS [  12.799s] lychee::cli cli::test_compact_output_format_contains_status
SLOW [> 60.000s] lychee::cli cli::test_url_inputs_always_get_checked_no_matter_their_extension
PASS [ 117.764s] lychee::cli cli::test_url_inputs_always_get_checked_no_matter_their_extension
SLOW [> 60.000s] lychee-lib client::tests::test_require_https

Speed up these tests without changing the functionality of the tests.
Without looking at the code, I assume these tests do network calls.
If this is the case, a solution is to set up local mock servers for testing with wiremock::MockServer to replace external network calls.
For inspiration see

macro_rules! mock_server {

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions