Skip to content

Conversation

@mpaya5
Copy link
Contributor

@mpaya5 mpaya5 commented Sep 30, 2025

Fixes https://linear.app/genlayer-labs/issue/DXP-684/separate-and-regroup-integration-tests
Fixes https://linear.app/genlayer-labs/issue/DXP-685/separate-and-group-infrastructure-tests

Summary

This PR reorganizes the integration test suite to follow Clean Architecture principles and improve maintainability. Tests are now properly grouped by functional domain using git mv to preserve file history.

Changes

📁 New Test Structure

Organized integration tests under tests/integration/contracts/ by domain:

tests/integration/contracts/
├── tokens/             # ERC20 token functionality (3 tests)
├── storage/            # Storage patterns (3 tests)  
├── oracle/             # Oracle implementations (1 test)
├── prediction_markets/ # Prediction market contracts (1 test)
├── analytics/          # Analytics and search (2 tests)
├── gaming/             # Gaming/AI assistants (1 test)
├── errors/             # Error handling (3 tests)
└── deployment/         # Multi-file deployments (1 test)

✅ Files Moved (using git mv)

  • 15 test files moved from icontracts/tests/ to categorized folders
  • 8 schema files moved to fixtures/schemas/
  • 1 conftest.py moved to fixtures/
  • All moves preserve git history for better traceability

🔧 Bug Fixes

  1. Fixed circular imports in error tests:

    • Updated imports in test_error_llm.py and test_error_web.py to reference new locations
  2. Added FastAPI skip conditions for RPC tests:

    • Tests now skip gracefully when FastAPI is not installed (CI environment)

📊 Impact

Metric Before After
Test Organization Flat structure in icontracts/tests/ Domain-driven categories
Import Errors 2 files with wrong imports Fixed ✅
CI Compatibility 3 tests failing without FastAPI Conditional skip added ✅
File History Would be lost with copy Preserved with git mv

Testing

Run integration tests with:

# All integration tests
gltest --contracts-dir ./icontracts/contracts tests/integration/contracts/ -svv

# Specific category
gltest --contracts-dir ./icontracts/contracts tests/integration/contracts/tokens/ -svv

Technical Details

  • Git History: Used git mv to preserve file history and blame information
  • Import Paths: Updated 3 files to use new import paths (fixtures.schemas instead of icontracts.schemas)
  • Backwards Compatibility: Original location cleaned up, no duplicate files
  • Python Packages: Added __init__.py files for proper Python package structure

Breaking Changes

None. Tests maintain their original functionality with only organizational changes.

Summary by CodeRabbit

  • Tests

    • Standardized import paths across integration tests to improve consistency and reduce resolution issues.
    • Introduced shared test configuration to ensure fixtures and schemas are reliably discoverable.
    • Improved setup for contract-related error and storage test suites for clearer organization and stability.
  • Chores

    • Minor restructuring of test utilities and paths to streamline maintenance and enhance developer experience during test runs.

kstroobants and others added 28 commits October 9, 2025 15:46
…so consensus sees updated validators snapshot
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
23.4% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants