Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

ci: update test for celestia-da #39

Merged
merged 6 commits into from
Jan 9, 2024
Merged

ci: update test for celestia-da #39

merged 6 commits into from
Jan 9, 2024

Conversation

tuxcanfly
Copy link
Collaborator

@tuxcanfly tuxcanfly commented Jan 4, 2024

Overview

This PR fixes an issue with the test suite where the auth token was not being passed correctly, also updates test suite to use celestia-da instead of celestia.

The tests were failing due to:

header: given height is from the future: networkHeight: 1, requestedHeight: 4

so replaced the /balance check with /header/10

Checklist

  • New and updated code has appropriate documentation
  • New and updated code has new and/or updated testing
  • Required CI checks are passing
  • Visual proof for any user facing features like CLI or documentation updates
  • Linked issues closed with keywords

Summary by CodeRabbit

Summary by CodeRabbit

  • Refactor
    • Updated the setup process for test suites to use celestia-da command, ensuring cleaner token handling.
    • Modified the commands for starting a container, retrieving data, and executing commands within the container.

Copy link

coderabbitai bot commented Jan 4, 2024

Walkthrough

The code changes involve modifications to the commands used to start a container, retrieve data from a specific endpoint, and execute a command within the container. Additionally, there's a change in handling the retrieved token. These alterations reflect adjustments in the logic and functionality of the code.

Changes

File Path Change Summary
celestia_test.go Modified container start command, data retrieval from an endpoint, command execution, and token handling logic.

Poem

Among the code's branches, I hop and play,
🐇 Changing commands in a whimsical way.
celestia-da now leads the dance,
Trimming tokens with a meticulous glance.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit-tests for this file.
  • 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 tests 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 generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between f9b3e63 and 34069f6.
Files selected for processing (1)
  • celestia_test.go (1 hunks)
Additional comments: 4
celestia_test.go (4)
  • 78-78: The command executed has been changed from celestia to celestia-da. Ensure that the celestia-da binary exists and is correctly placed in the expected directory.

  • 83-83: Trimming the token to remove leading and trailing whitespace is a good practice to avoid authentication errors due to formatting issues.

  • 86-86: The TearDownSuite method is responsible for cleaning up the Docker resources. Ensure that the Purge method is robust and handles potential errors gracefully.

Verification successful

The usage of the Purge method within the celestia_test.go file has been identified. It is used as follows:

if err := t.pool.Purge(t.resource); err != nil {

This indicates that the Purge method is called on a pool object with resource as an argument, and error handling is implemented to check if the Purge method returns an error.

Based on this information, the TearDownSuite method appears to handle potential errors from the Purge method gracefully by checking for an error return value.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify the behavior of the Purge method in the dockertest library.
rg --type go 'func \(.*Pool\) Purge'

Length of output: 38



Script:

#!/bin/bash
# Search for usage of the Purge method within the repository to understand how it's being handled.
rg --type go '(\.Purge)'

Length of output: 93

* 86-86: The `getRPCAddress` method constructs the RPC address using the port from the Docker resource. Verify that the port number corresponds to the correct service and that there are no hard-coded values that could conflict with dynamic port assignment.
Verification successful

The output from the rg command shows two instances where GetPort is used in celestia_test.go:

  1. http.Get(fmt.Sprintf("http://localhost:%s/balance", resource.GetPort("26659/tcp")))
  2. fmt.Sprintf("http://localhost:%s", t.resource.GetPort("26658/tcp"))

Both lines are using dynamic port assignment with the GetPort method, which retrieves the mapped port for a given service specified by the "port/tcp" string. The ports 26659/tcp and 26658/tcp are used, which suggests that these are the correct services being referenced, and there are no hard-coded values that could conflict with dynamic port assignment.

Based on this information, the getRPCAddress method correctly constructs the RPC address using the port from the Docker resource, and there are no issues with hard-coded values.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the port number used in getRPCAddress corresponds to the correct service.
rg --type go 'GetPort'

Length of output: 231

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 34069f6 and df2bcd6.
Files selected for processing (1)
  • celestia_test.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • celestia_test.go

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between df2bcd6 and 95018b1.
Files selected for processing (1)
  • celestia_test.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • celestia_test.go

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 0f605e9 and 2b28416.
Files selected for processing (1)
  • celestia_test.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • celestia_test.go

Copy link

codecov bot commented Jan 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5b2fc0b) 71.52% compared to head (51973dc) 71.52%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #39   +/-   ##
=======================================
  Coverage   71.52%   71.52%           
=======================================
  Files           2        2           
  Lines         144      144           
=======================================
  Hits          103      103           
  Misses         28       28           
  Partials       13       13           

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2b28416 and 32f0ea1.
Files selected for processing (1)
  • celestia_test.go (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • celestia_test.go

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 32f0ea1 and 8a2d574.
Files selected for processing (1)
  • celestia_test.go (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • celestia_test.go

@gupadhyaya gupadhyaya self-requested a review January 5, 2024 03:29
celestia_test.go Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 8a2d574 and ec49367.
Files selected for processing (1)
  • celestia_test.go (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • celestia_test.go

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 339de43 and 4f5d8f3.
Files selected for processing (1)
  • celestia_test.go (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • celestia_test.go

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5b2fc0b and 51973dc.
Files selected for processing (1)
  • celestia_test.go (4 hunks)
Additional comments: 5
celestia_test.go (5)
  • 48-48: The container version has been updated from "4ecd750" to "v0.12.5". Ensure that this version is compatible with the rest of the test suite and the expected environment.

  • 57-57: The endpoint for retrieving data has been changed from /balance to /header/10. Confirm that this endpoint is correctly implemented and that the test is now aligned with the current state of the network.

  • 66-66: The error message check for "header: given height is from the future" has been added. This seems to be a specific error handling case. Ensure that this is the correct and only error message that should be handled here, and that it's properly documented.

  • 78-78: The command executed within the container has been changed from using celestia to celestia-da. This change should be verified to ensure that the celestia-da binary exists and functions as expected within the container.

Verification successful

The Dockerfile confirms that the celestia-da binary is included in the container image, as it is copied to /bin/celestia-da during the build process. This supports the change made in the celestia_test.go file to execute the celestia-da command within the container.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the `celestia-da` binary exists within the container and functions as expected.
# This might involve checking the container's filesystem or running a command within the container.
# Example pseudo-command:
# docker exec <container-id> ls /bin/celestia-da

Length of output: 0



Script:

#!/bin/bash
# Search for Dockerfile or scripts that might be used to build the container image.
# This will help us verify if the `celestia-da` binary is included in the container.

# Find Dockerfile or relevant build scripts
fd 'Dockerfile|build.*\.(sh|bash)' --exec cat {}

Length of output: 1437

* 83-83: The token is now being trimmed of any white spaces before use. This is a good practice to avoid issues with extra white spaces in tokens. Ensure that this change does not affect any other parts of the system that may expect the token in its previous form.

@tuxcanfly tuxcanfly closed this Jan 9, 2024
@tuxcanfly tuxcanfly reopened this Jan 9, 2024
@tuxcanfly tuxcanfly merged commit bec96db into main Jan 9, 2024
26 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants