-
Notifications
You must be signed in to change notification settings - Fork 2
fix: hasura e2e test #1294
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
fix: hasura e2e test #1294
Conversation
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.
Summary of Changes
Hello @janb87, 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 focuses on enhancing the stability and reliability of the end-to-end test suite, particularly for functionalities involving Hasura and project setup. The changes ensure more consistent test outcomes by addressing environment setup, dependency linking, and database synchronization, making the tests more robust against varying initial states.
Highlights
- Test Setup Improvement: Added a step to remove
node_modulesbefore linking local SDK dependencies in e2e tests, ensuring a clean and consistent test environment. - Hasura Test Reliability: Introduced
bun run db:pushbefore Hasura table tracking tests to ensure the database schema is up-to-date, preventing failures due to missing tables. - Robust Hasura E2E Tests: Modified the
hasura.e2e.test.tsto gracefully handle scenarios where no tables are present for tracking, and conditionally execute queries only when tables have been successfully tracked. - Environment Variable Handling: Corrected the processing of
SETTLEMINT_HASURA_DATABASE_URLin standalone project setup to prevent incorrect access token encoding.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
|
To view in Slack, search for: 1757517720.672099 |
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.
Hey there - I've reviewed your changes - here's some feedback:
- The
hasTablesflag and conditional skipping introduces test coupling based on execution order; consider using a dedicated setup (e.g. beforeAll) to ensure tables exist for all relevant tests. - Repeated cleanup (
rm -rf node_modules) andbun run db:pushcommands across tests could be centralized into shared fixtures or before hooks to DRY up and speed up the test suite. - The inline URL token injection logic is duplicated in multiple tests—extract this into a shared helper function to improve maintainability.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `hasTables` flag and conditional skipping introduces test coupling based on execution order; consider using a dedicated setup (e.g. beforeAll) to ensure tables exist for all relevant tests.
- Repeated cleanup (`rm -rf node_modules`) and `bun run db:push` commands across tests could be centralized into shared fixtures or before hooks to DRY up and speed up the test suite.
- The inline URL token injection logic is duplicated in multiple tests—extract this into a shared helper function to improve maintainability.
## Individual Comments
### Comment 1
<location> `test/hasura.e2e.test.ts:55` </location>
<code_context>
});
test("can query users", async () => {
+ if (!hasTables) {
+ // We can only execute this test if there are tables tracked
+ // Depends on the test order, test/create-new-standalone-project.e2e.test.ts and test/create-new-settlemint-project.e2e.test.ts will create the tables
+ return;
+ }
const query = hasuraClient.graphql(`
</code_context>
<issue_to_address>
Test skipping based on state may hide failures; consider using test.skip or test.todo for clarity.
Using conditional returns in tests reduces visibility in CI and reporting. Prefer test.skip or test.todo to explicitly indicate skipped tests, enhancing clarity and maintainability.
</issue_to_address>
### Comment 2
<location> `test/create-new-standalone-project.e2e.test.ts:272` </location>
<code_context>
});
test("hasura - Track tables", async () => {
+ await $`bun run db:push`.cwd(dAppDir);
const { output } = await runCommand(COMMAND_TEST_SCOPE, ["hasura", "track", "--accept-defaults"], {
cwd: projectDir,
}).result;
</code_context>
<issue_to_address>
No assertions on the result of 'bun run db:push'; consider verifying its success.
Consider adding assertions to confirm the migration succeeded, such as checking the command's output or exit code.
</issue_to_address>
### Comment 3
<location> `test/create-new-settlemint-project.e2e.test.ts:253` </location>
<code_context>
});
test("hasura - Track tables", async () => {
+ await $`bun run db:push`.cwd(dAppDir);
const { output } = await runCommand(COMMAND_TEST_SCOPE, ["hasura", "track", "--accept-defaults"], {
cwd: projectDir,
}).result;
</code_context>
<issue_to_address>
No assertions on the result of 'bun run db:push'; consider verifying its success.
Add assertions to confirm the migration succeeded, such as checking the command's output or exit code.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
📦 Packages
|
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 pull request fixes an end-to-end test for Hasura. The changes include ensuring a clean dependency installation, pushing database schema changes before tracking tables, and making the tests more robust when no tables are present. My review focuses on improving the test design in test/hasura.e2e.test.ts. I've pointed out issues with shared state between tests and dependencies between test files, which can lead to fragility. I've suggested combining two tests into one to improve isolation and clarity, and also recommended a more robust long-term solution to make the test suite self-contained.
## Summary by Sourcery Improve reliability of Hasura E2E and project setup tests by handling missing tables, ensuring a clean install, and preventing URL rewriting errors Bug Fixes: - Accept "no-tables" as a valid result in Hasura table tracking and skip the dependent user query test when no tables are present Enhancements: - Remove node_modules before linking SDK dependencies and run `bun run db:push` to apply database migrations prior to Hasura table tracking in standalone and SettleMint project setup tests - Exclude SETTLEMINT_HASURA_DATABASE_URL from access token URL injection logic to avoid incorrect URL rewriting
Summary by Sourcery
Improve reliability of Hasura E2E and project setup tests by handling missing tables, ensuring a clean install, and preventing URL rewriting errors
Bug Fixes:
Enhancements:
bun run db:pushto apply database migrations prior to Hasura table tracking in standalone and SettleMint project setup tests