Regression Tests for Sztab Backend (JUnit 5 with Optional Ansible Automation) (SZ-31)
rk@tigase.net opened 3 weeks ago

Description

The Sztab backend is now functionally complete for core domain operations (User, GitRepo, Project, Issue), with unit tests validating service and controller logic.

However, we currently lack end-to-end regression tests that:

  • Exercise real application flows across the HTTP layer
  • Verify controller/service/repository integration
  • Validate JSON (de)serialization and enum mapping
  • Ensure cascading deletes, timestamps, and validation rules behave correctly

This issue proposes the implementation of a JUnit 5-based regression test suite, written as integration tests (@SpringBootTest) that run against an in-memory or test PostgreSQL instance.

Note: While these tests can be executed via mvn test, we optionally support automation using a lightweight Ansible playbook to run the backend and execute tests in containerized or remote environments.


Scope

This work includes:

  • Creating folder: src/test/java/com/sztab/integration/
  • Implementing integration tests for:
    • User creation and update
    • GitRepo creation and update
    • Project creation, update, and deletion (cascading)
    • Issue creation, update, deletion, and search
  • Using real JSON payloads, enums, and timestamps
  • Validating error cases (e.g., blank fields, missing enums)
  • [Optional, time-permitting] Creating ansible/test/integration-playbook.yml to:
    • Bring up backend + test DB
    • Run mvn test
    • Collect test results/logs
    • Seed data (JSON or SQL)

Estimated Time

TaskEst. Hours
Project + test env scaffolding1.0h
UserIntegrationTest.java0.75h
GitRepoIntegrationTest.java0.75h
ProjectIntegrationTest.java0.75h
IssueIntegrationTest.java1.5h
Validation + enum tests1.0h
Final cleanup + docs0.5h
[Optional] Basic Ansible runner0.5h
Total Estimate6.75h → 7h

Actual Work Log

DateTaskDuration
Oct 30Opened defect, planned scope, clarified Ansible vs JUnit50.5h
(TBD)User integration test scaffolding
(TBD)GitRepo integration test
(TBD)Project + cascading delete validation
(TBD)Issue flows
(TBD)Edge case validation (blank, enum mismatch, etc.)
(TBD)Optional: Basic Ansible test runner
(TBD)Cleanup and push to remote

Notes

  • The goal is not full coverage, but UI-critical backend stability
  • Ansible is optional and will only be used if time permits
  • Tests should prioritize reproducibility and traceability across environments
  • rk@tigase.net commented 3 weeks ago
     % git checkout -b feature/sz-31-regression-tests
    Switched to a new branch 'feature/sz-31-regression-tests'
     %
    
  • rk@tigase.net changed state to 'In Progress' 3 weeks ago
    Previous Value Current Value
    Open
    In Progress
  • rk@tigase.net commented 2 weeks ago

    Merge Summary

    Branch: feature/sz-31-regression-testswolnosc
    Type: Refactor / Regression / Temporal migration
    Status: Verified (All tests passing)


    Summary

    This merge consolidates the full migration of temporal fields across all entities, DTOs, and test code from LocalDateTime to Instant.
    All affected layers (persistence, service, controller, serialization) have been updated for UTC-based, ISO-8601-compliant JSON serialization.

    The regression test suite (PullRequestRegressionTest, ProjectControllerTest, etc.) has been fully realigned to this format and verified green.


    Key Changes

    • Replaced all uses of LocalDateTime with Instant for consistent UTC storage and transfer.
    • Added new JacksonConfig with JavaTimeModule for correct JSON serialization/deserialization.
    • Updated DTOs, service logic, and tests to match Instant semantics.
    • Fixed Role/User deserialization mismatch by converting entities to DTOs before serialization.
    • Regression test suite now runs cleanly — all 2/2 tests passing without errors.

    Verification

    • mvn clean test — all builds green
    • Regression suite executed end-to-end
    • Entity/DTO round-trip validated through controller layer

    Impact

    No breaking API changes (existing clients using ISO-8601 timestamps remain compatible).
    Improved time-zone consistency, simplified serialization, and reduced code footprint (−1323 lines).


    Next Steps

    • Confirm merged build on wolnosc
    • Close issue SZ-31: Regression tests & Instant migration as Resolved → Fixed
  • rk@tigase.net changed state to 'Closed' 2 weeks ago
    Previous Value Current Value
    In Progress
    Closed
  • rk@tigase.net commented 2 weeks ago

    Worklog Update (Final)

    Estimated: 8h
    Actual: ~14h (non-billable overrun)


    Notes

    Refactor required deeper alignment than anticipated:

    • Replaced all LocalDateTime fields with Instant across ~20+ files.
    • Adjusted DTOs, controllers, and test cases for UTC serialization.
    • Resolved Jackson deserialization edge cases (Role enum, Instant parsing).
    • Validated through full regression flow (PullRequestRegressionTest) — all green.

    Extra time was spent diagnosing JSON parsing and Hibernate relationship issues; retained as learning effort, not charged to project.


    Outcome

    • All temporal migrations complete
    • Regression suite verified clean
    • No regressions introduced
  • rk@tigase.net commented 1 week ago

    Post-Closure Confirmation

    The branch feature/sz-31-regression-tests was successfully merged into wolnosc and deleted locally and remotely.

    • Commit: 59bd9c8
    • Build: Successful (mvn clean install)
    • Tests: 129 run, 0 failed, 17 skipped (intentional)
    • Included FIXIT SZ-35 (disabled PullRequestControllerTest pending context bootstrap fix)

    No further action required for SZ-31; regression layer is stable and integrated.

  • rk@tigase.net referenced from other issue 7 days ago
issue 1 of 1
Type
Improvement
Priority
Normal
Assignee
Version
1.0
Sprints
n/a
Customer
n/a
Issue Votes (0)
Watchers (3)
Reference
SZ-31
Please wait...
Page is in error, reload to recover