Testing & Verification
Testing & Verification
To ensure the eKuiper Manager is correctly communicating with your eKuiper instances and that the API client is stable, the project provides a suite of verification scripts and automated tests.
API Verification Scripts
The project includes specialized TypeScript scripts located in the scripts/ directory. These are designed to verify the compatibility between the Manager's client and the target eKuiper server.
1. Full API Functional Check
The verify-api.ts script performs an end-to-end check of the core eKuiper operations. It validates:
- System Connectivity: Fetches system information and version.
- Stream Management: Creates, fetches, and deletes a test stream.
- Rule Management: Creates a rule, checks its status, and performs cleanup.
- Plugins & UDFs: Lists available plugins and User Defined Functions.
To run the verification:
# Ensure you have ts-node installed
npx ts-node scripts/verify-api.ts
[!IMPORTANT] The script defaults to a test instance. To test against your local instance, update the
EKuiperClientconstructor URL within the script to your eKuiper server address.
2. OpenAPI Spec Discovery
Because different versions of eKuiper may serve the OpenAPI (Swagger) specification at different paths, the check-openapi.ts script attempts to auto-discover the JSON schema location.
Run this script if you are having trouble loading the "API Playground" feature:
npx ts-node scripts/check-openapi.ts
Automated Testing with Jest
The project uses Jest for unit and integration testing of components and library logic. These tests ensure that data transformations, UI components, and internal state management function as expected without requiring a live eKuiper connection.
Running Tests
# Run all tests
npm test
# Run tests in watch mode during development
npm test -- --watch
AI Feature Verification
The eKuiper Manager includes advanced AI-powered tools (Rule Generation, Analysis, etc.). These rely on OpenRouter and specific model availability.
To verify AI functionality:
- Model Availability: Check the
/api/ai/modelsendpoint to ensure your configured AI provider is returning a list of supported models. - Log Tracing: Verify that the
capture-logsAPI is working by initiating a "Rule Trace" in the UI. This tests the bridge between the eKuiper rule engine and the Next.js server-side capture logic.
Manual Verification via Swagger
For manual inspection of the raw API responses:
- Navigate to the Swagger API Playground within the Manager UI.
- Select a specific endpoint (e.g.,
GET /nodes). - Click "Try it out" to see the real-time response from your connected eKuiper instance.
Troubleshooting Connectivity
If verification fails, check the following:
- CORS Settings: Ensure your eKuiper server allows requests from the Manager's domain.
- Proxy Configuration: The Manager uses a server-side proxy (
/api/connections/[id]/ekuiper/...) to bypass browser cross-origin restrictions. Ensure theserverUrlprovided in the Connection settings is reachable from the Manager's host machine. - Logs: Check the Next.js server logs for "Proxying to eKuiper" errors, which indicate network-level issues between the Manager and the edge engine.