A Python script to compare HTTP response codes across multiple eKuiper versions by running automated tests against Docker containers.
This tool helps you compare how different versions of eKuiper respond to the same set of HTTP requests. It automatically:
- Starts Docker containers for each eKuiper version
- Runs HTTP tests using httpyac
- Collects detailed response information
- Generates a comparison table in Markdown format
- Docker: Must be installed and running
- httpyac: HTTP client for testing
- Python 3: With required modules (requests, subprocess, etc.)
npm install -g httpyac
.
├── compare_response_codes.py # Main script
├── request.http # HTTP test definitions
├── http_responses/ # Directory for response files (auto-created)
│ ├── output_1_1_1_alpine.txt
│ ├── output_2_0_0_alpine.txt
│ └── ...
├── response_codes_comparison.md # Generated comparison table
└── README.md # This file
python3 compare_response_codes.py
The script will:
- Create the
http_responses/
directory if it doesn't exist - Test each eKuiper version defined in the script
- Save detailed HTTP responses to individual files
- Generate a comparison table
The script tests the following eKuiper versions:
- 1.1.1-alpine through 1.14.0-alpine
- 2.0.0-alpine, 2.1.0-alpine, 2.2.0-alpine
Each version is tested against the HTTP requests defined in request.http
.
Located in http_responses/
directory:
output_1_1_1_alpine.txt
- Detailed responses for eKuiper 1.1.1output_2_0_0_alpine.txt
- Detailed responses for eKuiper 2.0.0- etc.
Each file contains:
- Request headers
- Response status lines
- Response headers
- Response bodies (JSON data)
Example response format:
=== Getting information ===
GET http://localhost:9081/
accept-encoding: gzip, deflate, br
accept: */*
user-agent: httpyac
HTTP/1.1 200 - OK
connection: close
content-length: 50
content-type: text/plain; charset=utf-8
date: Thu, 10 Jul 2025 17:00:02 GMT
{"version":"1.1.1","os":"linux","upTimeSeconds":1}
The script generates response_codes_comparison.md
with a table comparing response codes across all tested versions.
Edit the EKUIPER_VERSIONS
list in compare_response_codes.py
:
EKUIPER_VERSIONS = [
"1.1.1-alpine",
"2.0.0-alpine",
# Add or remove versions as needed
]
Edit request.http
to define your test scenarios:
### Getting information
GET http://localhost:9081/
### Another test
POST http://localhost:9081/streams
Content-Type: application/json
{
"sql": "CREATE STREAM demo () WITH (FORMAT=\"JSON\", DATASOURCE=\"demo\")"
}
- Incremental Testing: Skips versions that have already been tested (existing output files)
- Detailed Logging: Colored console output showing progress
- Error Handling: Continues testing other versions if one fails
- Flexible Parser: Handles both short and detailed HTTP response formats
- Automatic Cleanup: Stops and removes Docker containers after each test
-
Docker not running
ERROR: Docker is not running or not accessible
Solution: Start Docker service
-
httpyac not found
ERROR: httpyac is not installed
Solution:
npm install -g httpyac
-
eKuiper container fails to start
- Check if the version exists on Docker Hub
- Ensure port 9081 is not already in use
- Check Docker logs for more details
-
No response codes extracted
- Verify
request.http
format is correct - Check if eKuiper is responding on the expected endpoints
- Verify
Enable verbose logging by modifying the logging level in the script:
logger.setLevel(logging.DEBUG)
This project is licensed under the MIT License - see the LICENSE file for details.