Skip to content

Conversation

@Shrinath-O2
Copy link
Contributor

No description provided.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

Failed to generate code suggestions for PR

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 3, 2025

Greptile Overview

Greptile Summary

This PR adds saved view cleanup functionality to the test cleanup process. The implementation adds three new methods to apiCleanup.js that fetch, filter, and delete saved views matching test patterns (streamslog* and multistream_view_*), and integrates this cleanup into the pre-test cleanup sequence in cleanup.spec.js.

Key changes:

  • Added fetchSavedViews() to retrieve all saved views via GET API
  • Added deleteSavedView(viewId) to delete individual saved views via DELETE API
  • Added cleanupSavedViews() to orchestrate the cleanup process with pattern matching and logging
  • Integrated the cleanup call into the existing cleanup test sequence

The implementation follows the established patterns in the codebase for cleanup methods, includes proper error handling, uses the logging framework consistently, and matches the test data patterns found in the codebase.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is straightforward, follows existing patterns in the codebase, includes proper error handling, and only adds cleanup functionality for test data without modifying any production code or existing test logic
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
tests/ui-testing/pages/apiCleanup.js 5/5 Added three new methods (fetchSavedViews, deleteSavedView, cleanupSavedViews) for cleaning up test saved views matching patterns "streamslog" and "multistream_view_" - implementation is consistent with existing cleanup patterns
tests/ui-testing/playwright-tests/cleanup.spec.js 5/5 Added call to cleanupSavedViews() in the pre-test cleanup sequence to remove test saved views

Sequence Diagram

sequenceDiagram
    participant Test as cleanup.spec.js
    participant PM as PageManager
    participant API as APICleanup
    participant Server as OpenObserve API
    
    Test->>PM: pm.apiCleanup.cleanupSavedViews()
    PM->>API: cleanupSavedViews()
    
    API->>API: Log "Starting saved views cleanup"
    
    API->>Server: GET /api/{org}/savedviews
    Server-->>API: Return {views: [...]}
    API->>API: Log "Fetched saved views"
    
    API->>API: Filter views matching patterns:<br/>"streamslog*" or "multistream_view_*"
    API->>API: Log "Found saved views matching cleanup patterns"
    
    alt No matching views
        API->>API: Log "No saved views to clean up"
        API-->>Test: Return
    else Has matching views
        loop For each matching view
            API->>Server: DELETE /api/{org}/savedviews/{view_id}
            Server-->>API: Return deletion result
            alt Deletion successful (200)
                API->>API: deletedCount++
                API->>API: Log "Deleted saved view"
            else Deletion failed
                API->>API: failedCount++
                API->>API: Log "Failed to delete saved view"
            end
        end
        
        API->>API: Log "Saved views cleanup completed"<br/>(total, deleted, failed counts)
        API-->>Test: Return
    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.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@Shrinath-O2 Shrinath-O2 force-pushed the e2e-fixSavedViewTests branch from 6d06e93 to de7b2ec Compare December 3, 2025 05:39
@Shrinath-O2 Shrinath-O2 force-pushed the e2e-fixSavedViewTests branch from f686e45 to c5e906a Compare December 3, 2025 07:15
@Shrinath-O2 Shrinath-O2 force-pushed the e2e-fixSavedViewTests branch from c5e906a to a057eb5 Compare December 3, 2025 07:53
@Shrinath-O2 Shrinath-O2 merged commit 7c3ed15 into main Dec 3, 2025
51 of 54 checks passed
@Shrinath-O2 Shrinath-O2 deleted the e2e-fixSavedViewTests branch December 3, 2025 15:44
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.

2 participants