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

test(rpc): rpc unit tests with db snapshot #5034

Closed
wants to merge 5 commits into from

Conversation

hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented Dec 4, 2024

Summary of changes

Part of #5046

Changes introduced in this pull request:

  • RPC unit-testing framework with database snapshots that are stored on a DigitalOcean space
  • forest-tool api test [RPC_SNAPSHOTS]

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

@hanabi1224 hanabi1224 force-pushed the hm/rpc-snaphsot-unittest branch from 4a2bd96 to 2936e3d Compare December 4, 2024 10:07
@@ -0,0 +1,2 @@
f3_gettipsetbyepoch_1730952732441851.json.zst
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The list is to be expanded.

@hanabi1224 hanabi1224 marked this pull request as ready for review December 4, 2024 10:15
@hanabi1224 hanabi1224 requested a review from a team as a code owner December 4, 2024 10:15
@hanabi1224 hanabi1224 requested review from lemmih and sudo-shashank and removed request for a team December 4, 2024 10:15
};
let snapshot: RpcCallSnapshot = serde_json::from_slice(snapshot_bytes.as_slice())?;
let db_bytes = BASE64_STANDARD.decode(&snapshot.db)?;
let db = Arc::new(match MemoryDB::deserialize_from(db_bytes.as_slice()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use CAR files rather than serialized memory-dbs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's doable. The only downside is that CAR DB is not capable of storing non-content-addressable data(e.g. HEAD -> head_tsk) thus at least 2 files(CAR db, and setting DB+request+desired response) are required for a test case, while with the current solution a single test-snap file is sufficient.

@hanabi1224 hanabi1224 force-pushed the hm/rpc-snaphsot-unittest branch 2 times, most recently from 9ae33bd to 5a74d49 Compare December 4, 2024 15:07
@hanabi1224 hanabi1224 force-pushed the hm/rpc-snaphsot-unittest branch from 5a74d49 to f5d98d7 Compare December 4, 2024 15:15
@hanabi1224 hanabi1224 marked this pull request as draft December 9, 2024 06:25
@hanabi1224
Copy link
Contributor Author

hanabi1224 commented Dec 12, 2024

Superseded by #5074 (Keep open for now just for referencing review comments)

@hanabi1224 hanabi1224 closed this Dec 16, 2024
@hanabi1224 hanabi1224 deleted the hm/rpc-snaphsot-unittest branch December 16, 2024 14:26
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.

3 participants