Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test for malformed websocket #1271

Merged
merged 19 commits into from
Feb 22, 2024
Merged

Conversation

cjrkoa
Copy link
Contributor

@cjrkoa cjrkoa commented Jan 26, 2024

closes #1206

Copy link
Contributor

coderabbitai bot commented Jan 26, 2024

Important

Auto Review Skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

Walkthrough

In this update, a new method is_alive has been added to the TestRunner struct to asynchronously check the balancer process's status. This enhancement ensures the balancer process is running successfully, contributing to system stability and reliability.

Changes

File Path Change Summary
.../harness/src/test_runner.rs Added a new method is_alive to the TestRunner struct to verify the balancer process's health.

Poem

In the code's domain, a new method to ascertain,
The balancer's pulse, in a world so convulse.
🐇 With checks so keen, our system's serene,
As we hop and we test, in our code quest.

Through bytes and lines, our confidence shines,
Ensuring all's well, in this coding spell.
Let's leap and verify, as our code does fly!
🌟🐰 #CodeBalancer, in harmony we aspire.

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.

@cjrkoa cjrkoa changed the title add test for malformed web socket add test for malformed websocket Jan 26, 2024
Copy link

codecov bot commented Jan 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (78cb7c3) 54.1446% compared to head (f573dd3) 54.1663%.
Report is 24 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master      #1271        +/-   ##
================================================
+ Coverage   54.1446%   54.1663%   +0.0216%     
================================================
  Files           157        158         +1     
  Lines         24634      24650        +16     
  Branches       1439       1437         -2     
================================================
+ Hits          13338      13352        +14     
- Misses        11240      11241         +1     
- Partials         56         57         +1     

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

I think I should be able to finish this up tomorrow
crates/harness-tests/Cargo.toml Outdated Show resolved Hide resolved
crates/harness-tests/src/routing.rs Outdated Show resolved Hide resolved
crates/harness-tests/src/routing.rs Outdated Show resolved Hide resolved
crates/harness/src/test_runner.rs Outdated Show resolved Hide resolved
@dyc3 dyc3 added the balancer Improvements or additions to the load balancer label Jan 27, 2024
compiler says header and payload fields for Frame are private and don't know how to send the constructed dataframe
@cjrkoa cjrkoa marked this pull request as ready for review February 11, 2024 17:32
Copy link
Contributor

@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: 4

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 8571ff9 and 864ad57.
Files ignored due to path filters (2)
  • Cargo.lock is excluded by: !**/*.lock
  • crates/harness-tests/Cargo.toml is excluded by: !**/*.toml
Files selected for processing (2)
  • crates/harness-tests/src/routing.rs (2 hunks)
  • crates/harness/src/test_runner.rs (2 hunks)

crates/harness/src/test_runner.rs Outdated Show resolved Hide resolved
crates/harness/src/test_runner.rs Outdated Show resolved Hide resolved
crates/harness/src/test_runner.rs Outdated Show resolved Hide resolved
crates/harness-tests/src/routing.rs Outdated Show resolved Hide resolved
Copy link
Owner

@dyc3 dyc3 left a comment

Choose a reason for hiding this comment

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

Did you even run this? The test doesn't even pass.

crates/harness-tests/Cargo.toml Outdated Show resolved Hide resolved
crates/harness/src/test_runner.rs Outdated Show resolved Hide resolved
crates/harness/src/test_runner.rs Outdated Show resolved Hide resolved
crates/harness/src/test_runner.rs Outdated Show resolved Hide resolved
crates/harness/src/test_runner.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@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 864ad57 and 570515a.
Files ignored due to path filters (2)
  • Cargo.lock is excluded by: !**/*.lock
  • crates/harness-tests/Cargo.toml is excluded by: !**/*.toml
Files selected for processing (1)
  • crates/harness/src/test_runner.rs (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • crates/harness/src/test_runner.rs

@dyc3
Copy link
Owner

dyc3 commented Feb 12, 2024

I'm not reviewing this again until the CI passes.

@dyc3
Copy link
Owner

dyc3 commented Feb 20, 2024

Took a quick look at the failure. this is why it's failing

balancer stdout: 2024-02-20T19:34:13.675631Z DEBUG ott_balancer::service: no monoliths request_id=2 room=test
failed to connect: Http(Response { status: 503, version: HTTP/1.1, headers: {"content-length": "41", "date": "Tue, 20 Feb 2024 19:34:13 GMT"}, body: Some([78, 111, 32, 109, 111, 110, 111, 108, 105, 116, 104, 115, 32, 97, 118, 97, 105, 108, 97, 98, 108, 101, 32, 116, 111, 32, 104, 97, 110, 100, 108, 101, 32, 114, 101, 113, 117, 101, 115, 116, 46]) })

The connection is being rejected by the balancer because there's no monoliths. The balancer no longer blindly accepts all websocket connections.

@cjrkoa
Copy link
Contributor Author

cjrkoa commented Feb 22, 2024

Took a quick look at the failure. this is why it's failing

balancer stdout: 2024-02-20T19:34:13.675631Z DEBUG ott_balancer::service: no monoliths request_id=2 room=test
failed to connect: Http(Response { status: 503, version: HTTP/1.1, headers: {"content-length": "41", "date": "Tue, 20 Feb 2024 19:34:13 GMT"}, body: Some([78, 111, 32, 109, 111, 110, 111, 108, 105, 116, 104, 115, 32, 97, 118, 97, 105, 108, 97, 98, 108, 101, 32, 116, 111, 32, 104, 97, 110, 100, 108, 101, 32, 114, 101, 113, 117, 101, 115, 116, 46]) })

The connection is being rejected by the balancer because there's no monoliths. The balancer no longer blindly accepts all websocket connections.

Thank you for looking into this. I tried running the test again with active monolith instance and it still failed. Do I need to have this client connect to a monolith in code?

@dyc3
Copy link
Owner

dyc3 commented Feb 22, 2024

create a monolith like in all the other harness tests

@cjrkoa cjrkoa requested a review from dyc3 February 22, 2024 18:21
@dyc3
Copy link
Owner

dyc3 commented Feb 22, 2024

CI failures are unrelated. merging

@dyc3 dyc3 merged commit 66e5cf3 into dyc3:master Feb 22, 2024
18 of 20 checks passed
Copy link

cypress bot commented Feb 22, 2024

Passing run #1077 ↗︎

0 52 1 0 Flakiness 0

Details:

add test for malformed websocket (#1271)
Project: OpenTogetherTube Commit: 66e5cf3fbe
Status: Passed Duration: 02:09 💡
Started: Feb 22, 2024 6:33 PM Ended: Feb 22, 2024 6:35 PM

Review all test suite changes for PR #1271 ↗︎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
balancer Improvements or additions to the load balancer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

balancer: add tests for malformed websocket packets
2 participants