Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate remaining tests to pytest-httpserver (no reliance on https://updates.xcp-ng.org) #111

Merged

Conversation

bernhardkaindl
Copy link
Collaborator

Improvements

  • Adds new test cases for xcp.repository which covers 4 additional repository code paths not covered before.
  • Makes the HTTP tests work independent of https://updates.xcp-ng.org and any changes to it
  • Makes it possible to run pytests tests/ run off-line or with spotty internet connection
  • Makes the tests complete in half-time as the overhead of the use https://updates.xcp-ng.org is removed

Other minor improvements

  • The HTTP test base class separates the concerns of HTTP testing in general from specific tests
  • Improves type annotations in HTTP tests

Commits

Add a common base class for HTTP tests using pytest_httpserver:
- tests/test_httpaccessor.py   (self-contained HTTP test for xcp.accessor)
- tests/test_httprepository.py (self-contained HTTP test for xcp.repository)

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
Make use of the common class HTTPServerTestCase: Many imports
and methods are now provided by `tests/httpserver_testcase.py`

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
Add a new self-contained testcase for testing YUM and XenSource repos
with: .treeinfo, repomd.xml, packages, packages.main, .linux and .site

`tests/data/repo` provides all test data, no use of updates.xcp-ng.org,
runs offline (no internet connection) and is therefore very fast.

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
Remove obsolete HTTP test cases using https://updates.xcp-ng.org which
are now replaced by new tests in tests/test_http{accessor,repository}.py

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
@codecov
Copy link

codecov bot commented Jun 30, 2023

Codecov Report

Merging #111 (c300114) into master (c734982) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #111   +/-   ##
=======================================
  Coverage   82.73%   82.73%           
=======================================
  Files          21       21           
  Lines        3371     3371           
=======================================
  Hits         2789     2789           
  Misses        582      582           
Flag Coverage Δ
unittest 82.73% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@bernhardkaindl bernhardkaindl changed the title Use local httpserver for tests Migrate remaining tests to pytest-httpserver (no reliance on https://updates.xcp-ng.org) Jul 4, 2023
@bernhardkaindl bernhardkaindl merged commit b753fd9 into xenserver:master Jul 4, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants