Skip to content

ngclient coverage: SlowRetrievalError testing #1552

Closed

Description

@sechkova

Description of issue or feature request:

Add test for fetcher/requests_fetcher covering the case of urllib3.ReadTimeoutError/tuf.SlowRetrievalError.
This can be achieved by using slow_retrieval_server.py instead of simple_servier.py for serving the test file.

One gotcha is that by default RequestFetcher.socket_timeout is set to 4s and the same value is used both for socket connect and read timeout. It means that the value would have to be modified to speed up the test case.
For example:

    # Read timeout
    def test_read_timeout(self):
        self.fetcher.socket_timeout = (4, 0.1) # connect timeout: 4s, read timeout: 0.1s
        # Launch a new "slow retrieval" server sending one byte each 40s
        slow_server_process_handler = utils.TestServerProcess(log=logger, server='slow_retrieval_server.py')
        ...

Activity

  1. self-assigned this
    on Sep 1, 2021
  2. added
    backlog
    on Sep 1, 2021
  3. added this to the Sprint 7 milestone on Sep 1, 2021
  4. linked a pull request that will close this issueAdd ngclient to coverage report #1564on Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

backlogngclienttesting

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions