Skip to content

Make GitHubTagProvider server URL configurable to enable mock testing #1119

@LalatenduMohanty

Description

@LalatenduMohanty

Problem

GitHubTagProvider hardcodes its API endpoint as a class variable:

host = "github.com:443"
api_url = "https://api.{self.host}/repos/{self.organization}/{self.repo}/tags"

This can't be overridden per-instance, so every use hits the real GitHub API. In CI, fork PRs can't use GITHUB_TOKEN (GitHub security restriction), leaving tests subject to the shared 60 req/hr unauthenticated rate limit.

GitLabTagProvider already supports this — it accepts a server_url constructor parameter.

Proposed Solution

  1. Add a server_url parameter to GitHubTagProvider.__init__(), defaulting to https://api.github.com. Derive api_url from it, matching the GitLab pattern.

  2. Update the stevedore_github.py e2e plugin to accept a mock URL (e.g. via env var).

  3. Update test_bootstrap_cooldown_github.sh to start a local HTTP server serving static tag JSON, using the existing local server pattern from e2e/common.sh.

This eliminates ~16 GitHub API calls per CI run (4 paginated pages × 4 parallel ci_bootstrap_suite jobs) and makes the test deterministic regardless of GitHub API availability.

Context

Files

  • src/fromager/resolver.pyGitHubTagProvider
  • e2e/github_override_example/src/package_plugins/stevedore_github.py
  • e2e/test_bootstrap_cooldown_github.sh

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions