Skip to content

LeeShan87/ekuiper-response-codes

Repository files navigation

eKuiper Response Codes Comparison

A Python script to compare HTTP response codes across multiple eKuiper versions by running automated tests against Docker containers.

Overview

This tool helps you compare how different versions of eKuiper respond to the same set of HTTP requests. It automatically:

  1. Starts Docker containers for each eKuiper version
  2. Runs HTTP tests using httpyac
  3. Collects detailed response information
  4. Generates a comparison table in Markdown format

Prerequisites

  • Docker: Must be installed and running
  • httpyac: HTTP client for testing
  • Python 3: With required modules (requests, subprocess, etc.)

Installing httpyac

npm install -g httpyac

Project Structure

.
├── 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

Usage

Basic Usage

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

What Gets Tested

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.

Output Files

Individual Response Files

Located in http_responses/ directory:

  • output_1_1_1_alpine.txt - Detailed responses for eKuiper 1.1.1
  • output_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}

Comparison Table

The script generates response_codes_comparison.md with a table comparing response codes across all tested versions.

Configuration

Modifying Test 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
]

Modifying HTTP Tests

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\")"
}

Features

  • 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

Troubleshooting

Common Issues

  1. Docker not running

    ERROR: Docker is not running or not accessible
    

    Solution: Start Docker service

  2. httpyac not found

    ERROR: httpyac is not installed
    

    Solution: npm install -g httpyac

  3. 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
  4. No response codes extracted

    • Verify request.http format is correct
    • Check if eKuiper is responding on the expected endpoints

Debugging

Enable verbose logging by modifying the logging level in the script:

logger.setLevel(logging.DEBUG)

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages