Skip to content

Run the download tests against a local HTTP server - #152

Merged
fingolfin merged 1 commit into
masterfrom
mh/local-test-server
Aug 7, 2026
Merged

Run the download tests against a local HTTP server#152
fingolfin merged 1 commit into
masterfrom
mh/local-test-server

Conversation

@fingolfin

Copy link
Copy Markdown
Member

Several tests depended on third-party web servers being reachable, which
made them fail spuriously:

  • The tests for the two failure paths of GetPackageURLs pointed
    PKGMAN_PackageInfoURLList at https://www.gap-system.org, purely to get
    back some content that is not a valid package URLs list. Whenever that
    single self-hosted server was unreachable, the test took the "Could not
    contact server" branch instead and failed. This was the cause of every
    recent spurious "packagemanager" failure in the PackageDistro CI. It
    was fragile in a second way too, since the expected output contained
    the first 71 bytes of that page's HTML.

  • The test for updating a package whose directory name does not contain
    a version number installed transgrp 3.6.4 from a personal university
    web page and then updated it to 3.6.5 -- 118MB downloaded from a
    third-party server on every single test run.

Instead start a small local HTTP server for these tests, cribbed from the
utils package, serving a document root prepared from the new tst/data
directory. Files that need to refer back to the server contain an
"@server@" placeholder, since the port is only known at runtime.

The bad package URLs list is now simply a file there. For the update
test, tst/data holds the sources of two versions of a minimal dummy
package "pmdummy", which are packed into tarballs when the tests run, so
that nothing binary needs to be checked in and their contents stay
reviewable; both unpack into a directory without a version number, which
is the situation under test. For "Could not contact server" we use an
unused loopback port rather than an unresponsive server, since wget
retries the latter many times.

Also report the underlying error of a failed download at info level 2,
so that transient network problems can be diagnosed after the fact.

Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 86.79%. Comparing base (2e873fd) to head (780e98c).

Files with missing lines Patch % Lines
gap/download.gi 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #152      +/-   ##
==========================================
+ Coverage   86.56%   86.79%   +0.22%     
==========================================
  Files          22       22              
  Lines        1005     1022      +17     
==========================================
+ Hits          870      887      +17     
  Misses        135      135              
Files with missing lines Coverage Δ
gap/distro.gi 81.66% <100.00%> (+0.76%) ⬆️
gap/download.gd 100.00% <100.00%> (ø)
gap/download.gi 94.91% <92.85%> (-0.65%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fingolfin

Copy link
Copy Markdown
Member Author

The CI failure should be fixed by PR #153.

Several tests depended on third-party web servers being reachable, which
made them fail spuriously:

* The tests for the two failure paths of GetPackageURLs pointed
  PKGMAN_PackageInfoURLList at https://www.gap-system.org, purely to get
  back some content that is not a valid package URLs list.  Whenever that
  single self-hosted server was unreachable, the test took the "Could not
  contact server" branch instead and failed.  This was the cause of every
  recent spurious "packagemanager" failure in the PackageDistro CI.  It
  was fragile in a second way too, since the expected output contained
  the first 71 bytes of that page's HTML.

* The test for updating a package whose directory name does not contain
  a version number installed transgrp 3.6.4 from a personal university
  web page and then updated it to 3.6.5 -- 118MB downloaded from a
  third-party server on every single test run.

Instead start a small local HTTP server for these tests, cribbed from the
utils package, serving a document root prepared from the new tst/data
directory.  Files that need to refer back to the server contain an
"@server@" placeholder, since the port is only known at runtime.

The bad package URLs list is now simply a file there.  For the update
test, tst/data holds the sources of two versions of a minimal dummy
package "pmdummy", which are packed into tarballs when the tests run, so
that nothing binary needs to be checked in and their contents stay
reviewable; both unpack into a directory without a version number, which
is the situation under test.  For "Could not contact server" we use an
unused loopback port rather than an unresponsive server, since wget
retries the latter many times.

Also report the underlying error of a failed download at info level 2,
so that transient network problems can be diagnosed after the fact.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@fingolfin
fingolfin force-pushed the mh/local-test-server branch from d7f83ff to 780e98c Compare August 7, 2026 22:44
@fingolfin
fingolfin merged commit feaa71e into master Aug 7, 2026
8 checks passed
@fingolfin
fingolfin deleted the mh/local-test-server branch August 7, 2026 22:58
@mtorpey

mtorpey commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Thanks for making this work! I was having trouble testing it, but now it's all green and merged it all looks good for me.

And I really like those runtimes!

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.

2 participants