-
Notifications
You must be signed in to change notification settings - Fork 0
Rework ipfs tests to tear up and down ephemeral kubo daemons #42
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
Conversation
WalkthroughThe updates include enhancements to the IPFS-related test suite. The workflow now installs a newer version of IPFS. The test suite is refactored to use an in-memory xarray Dataset fixture and introduces a new fixture to launch a temporary IPFS daemon with randomized ports for testing. Test functions are updated to utilize these fixtures, ensuring isolated and robust testing by connecting to dynamically configured IPFS environments. Changes
Poem
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
a452f0a to
68c4257
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #42 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 5 5
Lines 561 561
=========================================
Hits 561 561 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (5)
tests/test_zarr_ipfs.py (5)
63-66: Consider ephemeral port race conditions.
find_free_port()is a convenient helper but can introduce a subtle race condition if another process binds the port just after it’s discovered. Typically fine for local test scenarios, but in high concurrency usage you might consider letting IPFS auto-assign ports or parse them from logs.
135-137: InstantiatingIPFSStorewith ephemeral ports is consistent.The repeated pattern for creating an
IPFSStorewithdebug=Trueis acceptable. Consider extracting a small helper if you foresee customizing this instantiation often, reducing boilerplate.Also applies to: 155-157
294-294: Minor type ignore.
# type: ignorecan hide real issues if the types ever change. Consider explicitly typingtemp.sum()or clarifying any type mismatch to avoid masking potential problems in the future.
308-310: Redundant store instantiation.Repeated code could be refactored into a small helper function that returns an
IPFSStore, especially since you’re applying the same or similar params.
322-323: Consider consistency with ephemeral fixture.
test_authenticated_gatewayreferences a hard-coded port (5002) set by Nginx in the workflow. If feasible, unifying this with the ephemeral approach could reduce reliance on fixed ports and produce a fully ephemeral setup.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/run-checks.yaml(2 hunks)tests/test_zarr_ipfs.py(10 hunks)
🔇 Additional comments (8)
.github/workflows/run-checks.yaml (2)
24-24: Confirm compatibility of the upgraded IPFS version.You've upgraded IPFS from a presumably older version to
"0.34.1". Ensure that this version remains compatible with the test suite and that no breaking changes exist between IPFS 0.32.x and 0.34.x series, especially when interacting with ephemeral daemons.Would you like to verify this upgrade in a broader environment or add a note in the documentation regarding any expected changes in IPFS behavior?
80-80: Thanks for cleaning up trailing whitespace!Removing extraneous whitespace improves cleanliness and avoids false positives in linters.
tests/test_zarr_ipfs.py (6)
1-12: Imports for ephemeral IPFS testing look good.Bringing in
json,socket,subprocess,requests, and usingPathwill support ephemeral IPFS setup. This appears consistent with the goals of programmatically managing a daemon.
22-61: Fixture simplification is clear.Yielding the dataset (
ds) directly avoids unnecessary temporary storage on disk. The docstring changes are accurate, and the usage ofyieldcontinues to fit well for a test fixture that returns a dataset.
69-84:create_ipfsfixture design is well-structured.
- Initializing IPFS in a temporary directory and editing its config for random ports is a neat approach.
- The loop polling
rpc_uri_stem + "/api/v0/id"is a straightforward readiness probe.No major concerns here.
129-130: Good usage of the ephemeral IPFS fixture.The test captures the ephemeral RPC and gateway URIs for the in-memory dataset test, ensuring isolation from any local IPFS daemon.
243-245: Encryption test hooking into ephemeral IPFS.This is a solid approach, ensuring full coverage of ephemeral IPFS behaviors with encryption.
260-262: Consistent store creation within encryption logic.Storing the encryption and decryption transformers in the
HAMTconstructor is clean. Both the legitimate key approach and the “bad key” scenario are tested thoroughly.Also applies to: 283-285
Summary by CodeRabbit