-
-
Notifications
You must be signed in to change notification settings - Fork 7
Add more tests #260
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 more tests #260
Conversation
Includes: - Setup guidelines for Cursor, Claude, and GEMINI AI tools in `.cursorrules`, `CLAUDE.md`, and `GEMINI.md`. - Testing instructions in `docs/testing.md`. - Planned improvements and missing test coverage in `docs/improvements.md`. - Expanded `.gitignore` to exclude common IDE files. Signed-off-by: llbbl <[email protected]>
…ntent` functions
…es and edge cases
…correct signatures, parameter types, and API consistency
…tensive unit tests to improve modularity and test coverage
…eSQL), including URL validation, query generation, and compatibility
Summary of ChangesHello @llbbl, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request dramatically elevates the quality and reliability of the Geni project by implementing a robust testing framework. It focuses on establishing comprehensive unit and integration test suites, ensuring core functionalities and database interactions are thoroughly validated. Beyond just adding tests, the PR also refines the project's architecture for better testability and provides detailed documentation to streamline future development and maintenance efforts. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
rustrover kept forgetting the signed commits so skipped it 😅 not sure what to do about the "Commits must have verified signatures." check |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
the Refactoring Suggestions in improvements.md are from gemini cli .... It wanted start changing function signatures so i just had it document what it wanted to do. everything else is from me/claude |
it is used for verifying that you created the commit by signing of the commit https://git-scm.com/docs/git-verify-commit but you don't need to think of it as it's not needed |
|
/gemini review |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
/gemini review |
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.
Looks good to me, thank you for contributing :D
I won't make a release as this seems to not include any more changes then adding tests
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
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.
Code Review
This is an excellent pull request that dramatically improves the project's test coverage and developer experience. The addition of 163 tests is a huge step forward for ensuring code quality and stability. The new documentation for testing and AI assistants is also very valuable.
My review includes a few suggestions to improve the new tests and documentation for consistency and robustness. I've identified a high-severity issue regarding unquoted database identifiers in SQL query generation that could lead to errors. I've also made some medium-severity suggestions to improve test clarity, fix inconsistencies in documentation, and strengthen assertions.
| fn test_edge_case_urls() { | ||
| // Test edge cases that might cause issues | ||
| let edge_cases = vec![ | ||
| ("http://", false), // Empty host | ||
| ("https://", false), // Empty host | ||
| ("libsql://", false), // Empty host | ||
| ("http://localhost", true), // No port | ||
| ("https://example.com", true), // Standard HTTPS | ||
| ]; | ||
|
|
||
| for (url, should_be_valid) in edge_cases { | ||
| let result = validate_libsql_url(url); | ||
| if should_be_valid { | ||
| assert!(result.is_ok(), "Edge case URL should be valid: {}", url); | ||
| } else { | ||
| // For these specific edge cases, we still accept them as valid schemes | ||
| // The actual connection validation would happen at runtime | ||
| assert!(result.is_ok(), "Edge case URL with valid scheme should pass validation: {}", url); | ||
| } | ||
| } | ||
| } |
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.
This test case is a bit confusing. The should_be_valid flag is set to false for URLs like http://, but the else block then asserts that the validation is_ok(). While the comment explains the reasoning, it makes the test's intent hard to grasp at a glance.
Consider refactoring this test for clarity. For example, you could rename should_be_valid to something like is_fully_formed_url, or split the test into two: one for URLs that are expected to be valid and parseable, and another for URLs that only have a valid scheme prefix but are not fully formed.
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.
@llbbl this is something we need to look into, we're always testing if result_is_ok()
| #[should_panic] | ||
| fn test_read_file_content_nonexistent_file() { |
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.
Using #[should_panic] is a valid way to test for panics, but it doesn't verify the reason for the panic. A more robust approach would be to have read_file_content return a Result and then assert that an Err is returned for a non-existent file. This makes the function safer for library consumers and the test more specific.
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.
@llbbl this is a good point we should change to
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
it says merging is blocked because commits must have verified signatures. can you change the setting or override it for this PR temporarily? otherwise I think I would have to go back and edit commit messages on these? |
|
Try now |
|
looks like it can be merged now! |
This PR significantly improves the Geni project by adding 157 unit tests and 6 integration tests, plus
essential development infrastructure, increasing test coverage from minimal unit tests to comprehensive
coverage across all major modules.
🎯 Key Achievements
📋 Changes by Category
🧪 Tests Added (163 total)
Unit Tests (157 tests - No DB Required)
Integration Tests (6 tests - Require Docker)
error handling
🚀 Performance & CI/CD Benefits
Fast Unit Tests
Proper Test Separation
Fast unit tests (CI/CD friendly)
cargo test --lib -- --skip integration_test # 157 tests, ~0.5s
Integration tests (require Docker)
docker compose up -d && cargo test dump --lib # 6 tests with real DBs
🔍 Corrected Test Coverage Details
✅ Verification & Clarification