Skip to content

test: add more tests to types#2352

Merged
Manav-Aggarwal merged 3 commits into
mainfrom
marko/type_tests
Jun 9, 2025
Merged

test: add more tests to types#2352
Manav-Aggarwal merged 3 commits into
mainfrom
marko/type_tests

Conversation

@tac0turtle

@tac0turtle tac0turtle commented Jun 8, 2025

Copy link
Copy Markdown
Contributor

Overview

ref #2256

Summary by CodeRabbit

  • Tests
    • Added comprehensive unit tests for helper functions related to data submission and retrieval, covering various success and error scenarios.

@coderabbitai

coderabbitai Bot commented Jun 8, 2025

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@Manav-Aggarwal has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 10 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 2a73aa5 and ccc1691.

⛔ Files ignored due to path filters (1)
  • sequencers/based/go.sum is excluded by !**/*.sum
📒 Files selected for processing (2)
  • types/da.go (3 hunks)
  • types/da_test.go (1 hunks)

Walkthrough

A variable representing a namespace placeholder has been renamed and exported in the types/da.go file. Additionally, a new test file, types/da_test.go, introduces comprehensive unit tests for the SubmitWithHelpers and RetrieveWithHelpers functions, covering multiple success and error scenarios using mocks.

Changes

File(s) Change Summary
types/da.go Renamed and exported nameSpacePlaceholder to NameSpacePlaceholder; updated all internal usages.
types/da_test.go Added unit tests for SubmitWithHelpers and RetrieveWithHelpers with various mocked scenarios.

Suggested labels

T:testing

Suggested reviewers

  • julienrbrt

Poem

In the warren, code is neat,
Placeholders now take a public seat.
Tests hop in, both wide and deep,
Ensuring helpers never sleep.
With every byte and every test,
This code is ready—rabbit-approved and blessed! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

@github-actions

github-actions Bot commented Jun 8, 2025

Copy link
Copy Markdown
Contributor

The latest Buf updates on your PR. Results from workflow CI and Release / buf-check (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped✅ passed✅ passedJun 9, 2025, 1:59 PM

@codecov

codecov Bot commented Jun 8, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.61%. Comparing base (8b2f23a) to head (ab915fc).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2352      +/-   ##
==========================================
+ Coverage   65.94%   67.61%   +1.67%     
==========================================
  Files          66       66              
  Lines        6155     6155              
==========================================
+ Hits         4059     4162     +103     
+ Misses       1728     1624     -104     
- Partials      368      369       +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.

@tac0turtle
tac0turtle marked this pull request as ready for review June 8, 2025 13:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

Adds comprehensive unit tests for the DA helper functions and makes the namespace placeholder constant public.

  • Introduces new test cases in types/da_test.go for SubmitWithHelpers (success and multiple error mappings) and RetrieveWithHelpers (ID lookup and blob retrieval scenarios).
  • Exports the nameSpacePlaceholder constant as NameSpacePlaceholder and updates its usage in both submit and ID‐lookup calls.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
types/da_test.go New test table entries for SubmitWithHelpers and RetrieveWithHelpers covering success paths and error conditions.
types/da.go Renamed nameSpacePlaceholder to NameSpacePlaceholder and updated SubmitWithHelpers/GetIDs calls to use it.
Comments suppressed due to low confidence (3)

types/da.go:116

  • Replace the inline placeholder literal with the exported NameSpacePlaceholder constant to ensure consistency and avoid duplication.
blobs, err := da.Get(ctx, idsResult.IDs, []byte("placeholder"))

types/da.go:14

  • [nitpick] Consider renaming NameSpacePlaceholder to NamespacePlaceholder (single word) to align with common terminology and improve readability.
var NameSpacePlaceholder = []byte("placeholder")

types/da_test.go:163

  • Add an expectedTimestamp field to the test case and assert that result.Timestamp matches the original GetIDsResult.Timestamp in the successful retrieval scenario.
expectedHeight:   dataLayerHeight,

@Manav-Aggarwal
Manav-Aggarwal added this pull request to the merge queue Jun 9, 2025
Merged via the queue into main with commit 844e4d5 Jun 9, 2025
@Manav-Aggarwal
Manav-Aggarwal deleted the marko/type_tests branch June 9, 2025 14:10
@github-project-automation github-project-automation Bot moved this to Done in Evolve Jun 9, 2025

@alpe alpe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 I added some minor comments and personal preferences

Comment thread types/da_test.go
logger := log.NewNopLogger()

testCases := []struct {
name string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

personal preference: no need for name field when you use map[string]struct{} for test cases with name as key

Comment thread types/da_test.go
testCases := []struct {
name string
data [][]byte
gasPrice float64

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: gasPrices and options are always the same and can be defined in the test body

Comment thread types/da_test.go
if tc.expectedIDs != nil {
assert.Equal(t, tc.expectedIDs, result.IDs)
}
if tc.expectedCount != 0 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

no need for this if condition. You can always check.
it is actually len(ids) for the happy path

Comment thread types/da_test.go
if tc.expectedIDs != nil {
assert.Equal(t, tc.expectedIDs, result.IDs)
}
if tc.expectedData != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: you can remove the if conditions here and L229

Manav-Aggarwal pushed a commit that referenced this pull request Jun 10, 2025
<!--
Please read and fill out this form before submitting your PR.

Please make sure you have reviewed our contributors guide before
submitting your
first PR.

NOTE: PR titles should follow semantic commits:
https://www.conventionalcommits.org/en/v1.0.0/
-->

## Overview

ref #2256 


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Tests**
- Added comprehensive unit tests for helper functions related to data
submission and retrieval, covering various success and error scenarios.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: tac0turtle <you@example.com>
Manav-Aggarwal pushed a commit that referenced this pull request Jun 10, 2025
<!--
Please read and fill out this form before submitting your PR.

Please make sure you have reviewed our contributors guide before
submitting your
first PR.

NOTE: PR titles should follow semantic commits:
https://www.conventionalcommits.org/en/v1.0.0/
-->

## Overview

ref #2256 


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Tests**
- Added comprehensive unit tests for helper functions related to data
submission and retrieval, covering various success and error scenarios.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: tac0turtle <you@example.com>
@tac0turtle tac0turtle removed this from Evolve Aug 25, 2025
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.

4 participants