Skip to content

feat(topograph): Integration Test Support#205

Open
ravisoundar wants to merge 4 commits intomainfrom
rs-func-test
Open

feat(topograph): Integration Test Support#205
ravisoundar wants to merge 4 commits intomainfrom
rs-func-test

Conversation

@ravisoundar
Copy link
Collaborator

No description provided.

@ravisoundar ravisoundar requested a review from dmitsh as a code owner February 4, 2026 01:17
@ravisoundar ravisoundar marked this pull request as draft February 4, 2026 01:19
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 4, 2026

Greptile Overview

Greptile Summary

This PR adds comprehensive integration test support for the test provider, enabling simulation of various HTTP response codes and error conditions for both generate and topology endpoints.

Key Changes:

  • Added HandleTestProviderRequest() to short-circuit generate requests for test provider with simulated error responses
  • Extended test provider parameters to support generateResponseCode, topologyResponseCode, modelFileName, and errorMessage
  • Refactored models.NewModelFromFile() to extract NewModelFromData() for loading models from embedded files
  • Added tests/model.go with embedded model files support using go:embed
  • Created comprehensive integration test suite covering 6 test scenarios (valid topology, error responses, invalid input, retries, etc.)
  • Updated documentation with new test provider parameters

Review Notes:

  • All previously identified issues have been addressed (typo fixed, documentation corrected, logic bugs resolved)
  • The implementation follows good practices with clear separation of concerns
  • Integration tests provide good coverage of both success and error scenarios

Confidence Score: 5/5

  • This PR is safe to merge with no critical issues identified
  • All previously identified issues from review threads have been addressed. The implementation is clean, well-structured, and includes comprehensive test coverage. The refactoring is minimal and focused on enabling integration testing without affecting production code paths.
  • No files require special attention

Important Files Changed

Filename Overview
pkg/models/model.go Refactored to support loading models from byte data for embedded files
tests/model.go Added helper to read embedded model files from tests/models/ directory
pkg/providers/test/test.go Extended test provider with response code simulation and embedded model file support
pkg/server/integration_test.go Added comprehensive integration tests covering error cases and valid topology generation

Sequence Diagram

sequenceDiagram
    participant Client
    participant HTTPServer
    participant TestProvider
    participant AsyncQueue
    participant ModelLoader
    
    Client->>HTTPServer: POST /v1/generate (with test provider params)
    HTTPServer->>TestProvider: HandleTestProviderRequest()
    
    alt Generate error simulation (4xx/5xx)
        TestProvider->>TestProvider: Check generateResponseCode
        TestProvider-->>HTTPServer: Return error immediately
        HTTPServer-->>Client: HTTP error (4xx/5xx)
    else Normal flow (202)
        TestProvider-->>HTTPServer: Return false (continue normal flow)
        HTTPServer->>AsyncQueue: Submit(request)
        AsyncQueue-->>HTTPServer: uid
        HTTPServer-->>Client: HTTP 202 + uid
        
        Client->>HTTPServer: GET /v1/topology?uid=<uid>
        HTTPServer->>AsyncQueue: Get topology result
        
        alt Topology error simulation (4xx/5xx)
            AsyncQueue->>TestProvider: Loader()
            TestProvider->>TestProvider: Check topologyResponseCode
            TestProvider-->>AsyncQueue: Return httperr (4xx/5xx/202)
            AsyncQueue-->>HTTPServer: Error response
            HTTPServer-->>Client: HTTP error
        else Success (200)
            AsyncQueue->>TestProvider: Loader()
            TestProvider->>TestProvider: Check modelFileName or modelPath
            alt Embedded model file
                TestProvider->>ModelLoader: GetModelFileData(modelFileName)
                ModelLoader-->>TestProvider: Model data
                TestProvider->>TestProvider: NewModelFromData()
            else File path
                TestProvider->>TestProvider: NewModelFromFile(modelPath)
            else Default
                TestProvider->>TestProvider: GetTreeTestSet()
            end
            TestProvider->>TestProvider: Generate topology tree
            TestProvider-->>AsyncQueue: Provider instance
            AsyncQueue->>TestProvider: GenerateTopologyConfig()
            TestProvider-->>AsyncQueue: Topology vertex
            AsyncQueue-->>HTTPServer: Topology config
            HTTPServer-->>Client: HTTP 200 + topology config
        end
    end
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 69.76744% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.15%. Comparing base (3abaae8) to head (2467531).

Files with missing lines Patch % Lines
pkg/providers/test/test.go 63.88% 7 Missing and 6 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #205      +/-   ##
==========================================
+ Coverage   65.83%   66.15%   +0.32%     
==========================================
  Files          81       82       +1     
  Lines        4484     4524      +40     
==========================================
+ Hits         2952     2993      +41     
+ Misses       1419     1417       -2     
- Partials      113      114       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Ravi Shankar <ravish@nvidia.com>
Signed-off-by: Ravi Shankar <ravish@nvidia.com>
@ravisoundar ravisoundar marked this pull request as ready for review February 5, 2026 05:23
Signed-off-by: Ravi Shankar <ravish@nvidia.com>
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

Signed-off-by: Ravi Shankar <ravish@nvidia.com>
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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.

1 participant