Test if the generated subgraph is compatible with Hive Console composition#8533
Test if the generated subgraph is compatible with Hive Console composition#8533
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe pull request introduces two new files within the pet store subgraph environment. One file establishes a GraphQL Mesh configuration that loads an OpenAPI subgraph using dynamic URL settings derived from command-line options. The other file provides an end-to-end test suite that deploys the pet store service in a Docker container, verifies schema composition (both against snapshots and via hive composition), and executes a GraphQL query to assert the service behavior. Changes
Sequence Diagram(s)sequenceDiagram
participant Runner as Test Runner
participant Container as Petstore Container
participant Config as Mesh Config
participant Loader as OpenAPI Loader
participant GraphQL as GraphQL Engine
Runner->>Container: Start pet store container (Docker)
Container-->>Runner: Service is ready
Runner->>Config: Load composeConfig
Config->>Loader: Call loadOpenAPISubgraph(url)
Loader-->>Config: Return subgraph config
Note right of Config: Compose subgraph schema dynamically
Runner->>Runner: Execute schema composition & snapshot validation
Runner->>GraphQL: Send GraphQL query (e.g., get pet by ID)
GraphQL-->>Runner: Return query result
Runner->>Runner: Validate query response and composition errors
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 ESLint
e2e/petstore-subgraph/petstore-subgraph.test.tsOops! Something went wrong! :( ESLint: 9.22.0 ESLint couldn't find an eslint.config.(js|mjs|cjs) file. From ESLint v9.0.0, the default configuration file is now eslint.config.js. https://eslint.org/docs/latest/use/configure/migration-guide If you still have problems after following the migration guide, please stop by 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (11)
🪧 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 (
|
Apollo Federation Subgraph Compatibility Results
Learn more: |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
e2e/petstore-subgraph/petstore-subgraph.test.ts (1)
38-46: Consider enhancing error reporting for composition failures.While the current error handling logs each error, the thrown error message could be more specific to help with debugging.
if (compositionResult.errors) { for (const error of compositionResult.errors) { console.error(error); } - throw new Error('Composition failed'); + throw new Error(`Composition failed: ${compositionResult.errors.map(e => e.message).join(', ')}`); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
e2e/petstore-subgraph/__snapshots__/petstore-subgraph.test.ts.snapis excluded by!**/*.snap
📒 Files selected for processing (2)
e2e/petstore-subgraph/mesh.config.ts(1 hunks)e2e/petstore-subgraph/petstore-subgraph.test.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (10)
- GitHub Check: e2e / node v22
- GitHub Check: e2e / node v20
- GitHub Check: e2e / node v18
- GitHub Check: check
- GitHub Check: unit / node 22
- GitHub Check: integration / node 20
- GitHub Check: unit / node 20
- GitHub Check: unit / node 18
- GitHub Check: deployment
- GitHub Check: integration / node 18
🔇 Additional comments (3)
e2e/petstore-subgraph/mesh.config.ts (1)
1-17: Configuration looks well-structured for the Petstore subgraph.The mesh configuration correctly sets up an OpenAPI subgraph with appropriate source URL and endpoint construction using the service port. The comment on line 12-13 provides helpful context about why the endpoint needs to be manually specified.
e2e/petstore-subgraph/petstore-subgraph.test.ts (2)
5-15: Container setup looks good.The test environment setup for the Petstore service using Swagger's official Docker image with appropriate health check is a solid approach for testing.
17-24: First test case correctly validates schema generation.Using snapshot testing is an effective way to verify schema generation and detect unintended changes.
mesh-compose -o subgraph.sdl --subgraph=petstorethen compose it with HiveRef GW-226