Skip to content

Add in-process HTTP integration tests for webhook-to-metrics flows #53

@darthfork

Description

@darthfork

Parent issue: #52

Summary

Add an integration test suite that boots the real promgithub HTTP server in-process and validates behavior through real HTTP requests and /metrics scrapes.

Scope

  • Start the real router/server with an isolated Prometheus registry.
  • Send signed webhook requests to /webhook.
  • Scrape /metrics and assert exported samples.
  • Cover /health and invalid-signature behavior.

Scenarios

  • workflow_run webhook updates metrics correctly.
  • workflow_job webhook updates metrics correctly.
  • push webhook updates metrics correctly.
  • pull_request webhook updates metrics correctly.
  • Invalid signature returns 401 and does not mutate metrics.
  • Unsupported event type does not crash and does not emit incorrect metrics.

Design notes

  • Prefer scrape-level assertions over direct internal counter inspection.
  • Reuse stable JSON fixtures under test_data/ where possible.
  • Keep the suite self-contained and fast enough for normal PR execution.

Acceptance criteria

  • Tests exercise HTTP request -> handler -> metric scrape end to end.
  • Assertions validate real exported metrics, not just internal state.
  • The suite runs reliably in CI without external dependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions