Skip to content

(PTFE-3084) Improve tests coverage#210

Merged
matthiasL-scality merged 1 commit intomainfrom
PTFE-3070-improve-tests
Mar 13, 2026
Merged

(PTFE-3084) Improve tests coverage#210
matthiasL-scality merged 1 commit intomainfrom
PTFE-3070-improve-tests

Conversation

@matthiasL-scality
Copy link
Copy Markdown
Contributor

@matthiasL-scality matthiasL-scality commented Mar 13, 2026

This pull request introduces a comprehensive and robust end-to-end test suite for the artifacts service, covering authentication, health checks, build copying, build listings, and build discovery endpoints. It establishes reusable test fixtures and helpers for efficient setup and teardown of S3 buckets, HTTP sessions with various authentication levels, and common test operations. Shared constants are centralized for consistency across tests. The suite ensures correctness and security of key API endpoints and behaviors.

Test infrastructure and fixtures:

  • Major refactor of conftest.py to provide session-scoped and function-scoped pytest fixtures for S3 client setup, bucket management, HTTP sessions with different authentication levels, and common test operations (uploading files, finishing builds). Includes robust S3 health check and cleanup logic.
  • Shared constants for bucket names and canonical build names are defined in a new constants.py file, promoting reuse and consistency across the test suite.

Authentication and authorization coverage:

  • Adds test_auth.py to verify access control: tests that authenticated users, restricted users, bots, failing users, and unauthenticated requests are all handled correctly with appropriate HTTP status codes for uploads, downloads, and metadata operations.

Endpoint-specific tests:

  • Introduces test_healthcheck.py to validate that health check and nginx status endpoints respond as expected, including method restrictions and connection reporting.
  • Implements test_copy.py to exercise the build copy endpoint, checking correct behavior for missing status files, duplicate copies, and cache/ingress scenarios.
  • Adds test_listing.py to verify build and root listings, including pagination, format variations, and aggregation across buckets.
  • Provides test_find_build.py to test "find latest build" endpoints (/last_success/, /last_failure/, /latest/), ensuring correct redirect and error behaviors for various build states and prefixes.

@matthiasL-scality matthiasL-scality force-pushed the PTFE-3070-improve-tests branch from d3be213 to 3f22a7b Compare March 13, 2026 09:32
@matthiasL-scality matthiasL-scality marked this pull request as ready for review March 13, 2026 09:38
@matthiasL-scality matthiasL-scality requested a review from a team as a code owner March 13, 2026 09:38
Copy link
Copy Markdown
Contributor

@bertranddemiddelaer bertranddemiddelaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matthiasL-scality matthiasL-scality merged commit 7f66404 into main Mar 13, 2026
4 checks passed
@matthiasL-scality matthiasL-scality deleted the PTFE-3070-improve-tests branch March 13, 2026 13:39
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