Skip to content

Added Tinybird tests for remaining single filter test cases - #22845

Merged
cmraible merged 2 commits into
mainfrom
chris-prod-169-automated-tests-for-all-queries-including-every-filter-plus
Apr 8, 2025
Merged

cmraible merged 2 commits into
mainfrom
chris-prod-169-automated-tests-for-all-queries-including-every-filter-plus

Conversation

@cmraible

@cmraible cmraible commented Apr 8, 2025 •

Copy link
Copy Markdown
Collaborator

ref https://linear.app/ghost/issue/PROD-169/automated-tests-for-all-queries-including-every-filter-plus-one-other

  • This commit is part of a general effort to improve out test coverage for our Tinybird endpoints, so we can be more confident making changes quickly in the future.
  • This PR in particular adds the final remaining single-filter test cases for all endpoints, so we now have 1 test per filter per endpoint

@coderabbitai

coderabbitai Bot commented Apr 8, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

This pull request introduces several new test cases and corresponding result files within the ghost web analytics test suite. The new tests use the tb pipe data command to query multiple API endpoints with uniform parameters including a date range from January 1, 2100, to January 7, 2100, a mock site UUID, and output in CSV format. The tests cover endpoints for top sources (filtered by pathname /about/), top devices, top locations, and top operating systems, with each test designed to verify the specific output against expected CSV results. The additions are implemented across multiple test files to ensure that different filtering criteria on analytics data return consistent and correct results.

Possibly related PRs


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7e7719e and 6181804.

📒 Files selected for processing (8)
  • ghost/web-analytics/tests/filter_pathname_about_top_sources.test (1 hunks)
  • ghost/web-analytics/tests/filter_pathname_about_top_sources.test.result (1 hunks)
  • ghost/web-analytics/tests/filter_source_bing_top_devices.test (1 hunks)
  • ghost/web-analytics/tests/filter_source_bing_top_devices.test.result (1 hunks)
  • ghost/web-analytics/tests/filter_source_bing_top_locations.test (1 hunks)
  • ghost/web-analytics/tests/filter_source_bing_top_locations.test.result (1 hunks)
  • ghost/web-analytics/tests/filter_source_bing_top_os.test (1 hunks)
  • ghost/web-analytics/tests/filter_source_bing_top_os.test.result (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Tinybird Tests (Web Analytics)
  • GitHub Check: Unit tests (Node 22.13.1)
  • GitHub Check: Unit tests (Node 20.11.1)
  • GitHub Check: Unit tests (Node 18.12.1)
🔇 Additional comments (8)
ghost/web-analytics/tests/filter_source_bing_top_devices.test.result (1)

1-2: LGTM!
The CSV file correctly defines the header ("device","visits") and contains the expected data row ("desktop",2) for the top_devices filter test case.

ghost/web-analytics/tests/filter_source_bing_top_locations.test.result (1)

1-3: LGTM!
The CSV content for the top_locations filter test—showing the header ("location","visits") and the two rows ("DE",1) and ("GB",1)—is structured correctly and aligns with the expected test outcomes.

ghost/web-analytics/tests/filter_pathname_about_top_sources.test.result (1)

1-5: LGTM with a minor verification note.
The CSV output displays the header ("source","visits") and rows including an empty source with 4 visits along with "bing.com", "google.com", and "wilted-tick.com". The inclusion of an empty source appears intentional to handle edge cases. Please verify that the empty source value is expected as part of the test design.

ghost/web-analytics/tests/filter_source_bing_top_os.test.result (1)

1-2: LGTM!
The CSV file for the top_os filter is concise, with a header ("os","visits") and a single row ("windows",2), matching the test expectations.

ghost/web-analytics/tests/filter_source_bing_top_locations.test (1)

1-1: LGTM!
The test command for fetching data from the api_top_locations endpoint is correctly configured with the required parameters—including the date range, site UUID, CSV format, and --source bing.com. This effectively complements its corresponding result file.

ghost/web-analytics/tests/filter_source_bing_top_os.test (1)

1-1: Looks good! Test correctly implements source filtering for OS data.

This test case appropriately queries the top operating systems endpoint with the --source bing.com filter parameter, which aligns with the PR objective of implementing tests for the source:bing filter across remaining endpoints.

ghost/web-analytics/tests/filter_source_bing_top_devices.test (1)

1-1: Looks good! Test correctly implements source filtering for device data.

This test case maintains consistency with the other new tests by using the same date range, site UUID, and format parameters, while appropriately targeting the devices endpoint with the --source bing.com filter parameter.

ghost/web-analytics/tests/filter_pathname_about_top_sources.test (1)

1-1: Looks good! Test correctly implements pathname filtering for source data.

This test case properly queries the top sources endpoint with the --pathname /about/ filter parameter, which aligns with the PR objective of adding a test for the pathname:about filter specifically targeting the top_sources endpoint.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@cmraible
cmraible merged commit 7304581 into main Apr 8, 2025
@cmraible
cmraible deleted the chris-prod-169-automated-tests-for-all-queries-including-every-filter-plus branch April 8, 2025 21:00
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