Skip to content

Conversation

@hironow
Copy link
Owner

@hironow hironow commented Nov 19, 2025

  • fail tests exists
  • Ignoring the fail

@hironow hironow force-pushed the hironow/refact-tests branch from 8582a13 to 194f732 Compare November 20, 2025 05:27
hironow and others added 10 commits November 20, 2025 14:31
- Add pipefail to E2E test step to properly detect test failures in CI
- Remove pytest-xdist parallel execution (causes Docker API 404 errors)
- Enhance Elasticsearch wait to verify shard initialization (prevents 503 errors)
- All 36 E2E tests now pass reliably in 4m10s

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Behavioral Change:
- Wait for index shards to be ready after PUT (index creation)
- Call /_cluster/health/{index}?wait_for_status=yellow&timeout=30s
- Prevents HTTP 503 errors when accessing newly created indices

Problem:
- E2E tests were failing with "503 Service Unavailable" errors
- Elasticsearch returned "NoShardAvailableActionException"
- Tests created indices and immediately queried them before shards were ready

Solution:
- Add waitForIndexReady() function to wait for yellow status
- Automatically called after successful PUT requests for index creation
- 30s timeout to prevent indefinite waiting

Test Results:
- All 7 Elasticsearch E2E tests now pass (previously 5 failed)
- All 36 E2E tests pass with no regressions
- Execution time: 4m09s (sequential)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
This commit upgrades Elasticsearch from 8.19.5 to 9.2.1 and adds
a dedicated test step to verify Elasticsearch functionality before
running E2E tests.

Changes:
- Upgrade Elasticsearch image to 9.2.1 in docker-compose.yaml
- Add scripts/test-elasticsearch.sh to verify cluster health,
  index creation, document insertion, and search functionality
- Add "Test Elasticsearch separately" step in GitHub Actions
  workflow before E2E tests to catch Elasticsearch issues early

The new test script performs comprehensive checks:
1. Cluster health status (green/yellow)
2. Shard initialization status
3. Index creation and readiness
4. Document insertion
5. Search functionality
6. Index deletion

This helps debug Elasticsearch issues independently from E2E tests.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
This commit optimizes Elasticsearch v9.2.1 configuration and waiting
logic to improve performance in CI environments while maintaining
local development compatibility.

Changes:

docker-compose.yaml:
- Add bootstrap.memory_lock=false to prevent memory lock issues
- Disable cluster.routing.allocation.disk.threshold_enabled for CI
- Set action.destructive_requires_name=false for testing

elasticsearch-cli/main.go:
- Improve waitForIndexReady() with polling mechanism (60 sec max)
- Check both cluster status and initializing_shards count
- Replace single wait_for_status request with polling loop
- Add detailed warnings for timeout scenarios

These optimizations address CI-specific issues where Elasticsearch v9
initialization and shard allocation are slower than in local
environments. The polling approach ensures tests wait appropriately
for index readiness rather than timing out prematurely.

Local test results: 36 passed, 7 skipped in 254.80s

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Change `containers.run()` to detached mode for both `run_cli` and `run_shell`
- Add explicit `container.wait(timeout=300)` (5-minute timeout)
- Get logs after container completion
- Check exit code and fail test if non-zero
- Proper container cleanup on both success and error
- Prevent indefinite hangs in CI when containers don't exit

Fixes issue where E2E tests hung in GitHub Actions when Elasticsearch
CLI operations took too long, causing 20-minute workflow timeouts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Add `verbose` bool variable and ES_CLI_VERBOSE env var
- Enhanced waitForIndexReady() with detailed retry logging
  - Shows attempt number, status, shard counts, and timing
  - Logs start/end of wait operations
- Enhanced makeRequest() with request/response logging
  - Shows HTTP method, path, body preview
  - Logs response status, timing, and size
  - Logs errors with context
- Add pytest allow permission to settings.local.json

Helps diagnose Elasticsearch v9 performance issues in CI by providing
detailed timing and status information for each operation.

Enable with: ES_CLI_VERBOSE=1 or ES_CLI_VERBOSE=true

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@hironow hironow merged commit 63b0a73 into main Nov 20, 2025
1 check passed
@hironow hironow deleted the hironow/refact-tests branch November 20, 2025 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants