One-Command Test Execution
Start Services & Run All Tests
cd /home/gz/clickgraph
# Terminal 1: Start servers
docker-compose up -d # ClickHouse
cargo run --bin clickgraph # ClickGraph
# Terminal 2: Wait 5 seconds, then run tests
sleep 5
./scripts/test/run_with_cte_tests.sh
Test Commands Cheat Sheet
cd /home/gz/clickgraph/tests/integration
pytest test_with_cte_node_expansion.py -v
# Example: Basic expansion tests only
pytest test_with_cte_node_expansion.py::TestWithBasicNodeExpansion -v
# Scenario 1: Basic
pytest test_with_cte_node_expansion.py::TestWithBasicNodeExpansion -v
# Scenario 2: Multi-variable
pytest test_with_cte_node_expansion.py::TestWithMultipleVariableExport -v
# Scenario 3: Chaining
pytest test_with_cte_node_expansion.py::TestWithChaining -v
# Scenario 4: Scalars
pytest test_with_cte_node_expansion.py::TestWithScalarExport -v
# Scenario 5: Renames
pytest test_with_cte_node_expansion.py::TestWithPropertyRename -v
# Scenario 6: Cross-table
pytest test_with_cte_node_expansion.py::TestWithCrossTable -v
# Scenario 7: Optional match
pytest test_with_cte_node_expansion.py::TestWithOptionalMatch -v
# Scenario 8: Polymorphic
pytest test_with_cte_node_expansion.py::TestWithPolymorphicLabels -v
# Scenario 9: Denormalized
pytest test_with_cte_node_expansion.py::TestWithDenormalizedEdges -v
# Regression tests
pytest test_with_cte_node_expansion.py::TestWithRegressionCases -v
# Example
pytest test_with_cte_node_expansion.py::TestWithBasicNodeExpansion::test_with_single_node_export -v
pytest test_with_cte_node_expansion.py -vv
Run with Debug Output (shows stdout)
pytest test_with_cte_node_expansion.py -v -s
Run with Long Traceback on Failure
pytest test_with_cte_node_expansion.py -v --tb=long
./scripts/test/run_with_cte_tests.sh
./scripts/test/run_with_cte_tests.sh --verbose
./scripts/test/run_with_cte_tests.sh --show-sql
./scripts/test/run_with_cte_tests.sh --test TestWithChaining
./scripts/test/run_with_cte_tests.sh --test test_with_single_node_export
./scripts/test/run_with_cte_tests.sh --help
====== test session starts ======
test_with_cte_node_expansion.py::TestWithBasicNodeExpansion::test_with_single_node_export PASSED
test_with_cte_node_expansion.py::TestWithMultipleVariableExport::test_with_two_node_export PASSED
test_with_cte_node_expansion.py::TestWithMultipleVariableExport::test_with_three_node_export PASSED
... (all tests)
====== 15 passed in 8.32s ======
AssertionError: Expected multiple a.* columns, got: ['with_a_cte_0.a']
This indicates CTE expansion is not working - the variable is returned as a single alias instead of expanding to properties.
curl http://localhost:8080/health
curl http://localhost:8123/ping
curl -X POST http://localhost:8080/query \
-H " Content-Type: application/json" \
-d ' {"query": "USE social_benchmark MATCH (n:User) RETURN COUNT(n) LIMIT 1"}'
curl -X POST http://localhost:8080/query \
-H " Content-Type: application/json" \
-d ' {"query": "USE social_benchmark MATCH (a:User) WITH a RETURN a LIMIT 1"}'
curl -X POST http://localhost:8080/query \
-H " Content-Type: application/json" \
-d ' {"query": "USE social_benchmark MATCH (a:User) WITH a RETURN a LIMIT 1", "sql_only": true}'
Test Scenarios at a Glance
#
Scenario
Test Class
Key Test
1
Basic expansion
TestWithBasicNodeExpansion
test_with_single_node_export
2
Multi-variable
TestWithMultipleVariableExport
test_with_two_node_export
3
Chaining
TestWithChaining
test_with_chaining_two_levels
4
Scalars
TestWithScalarExport
test_with_scalar_count
5
Rename
TestWithPropertyRename
test_with_node_rename
6
Cross-table
TestWithCrossTable
test_with_cross_table_multi_hop
7
Optional
TestWithOptionalMatch
test_optional_match_with_export
8
Polymorphic
TestWithPolymorphicLabels
test_with_multi_label_node
9
Denormalized
TestWithDenormalizedEdges
test_with_denormalized_properties
Tests verify the fix is working
Ready for documentation update
Ready for merge to main
Can add to changelog
Check which scenario fails
Review test error message
Check generated SQL (use sql_only)
Debug with print statements or breakpoints
See TEST_WITH_CTE_DOCUMENTATION.md for troubleshooting
Check servers are running
Verify schema is loaded
Check CLICKGRAPH_URL environment variable
Review server logs: docker logs clickhouse or console output
Common Issues & Solutions
Issue
Solution
ConnectionError: Cannot connect to http://localhost:8080
Start ClickGraph: cargo run --bin clickgraph
ConnectionError: Cannot connect to http://localhost:8123
Start ClickHouse: docker-compose up -d
AssertionError: Expected multiple a.* columns
CTE expansion not working - check TypedVariable registration
KeyError: 'results'
API response format issue - check server logs
AssertionError: status_code = 500
Query execution failed - check schema and data
Timeout waiting for server
Wait longer or check logs for errors
Scenario 1 (Basic): ~0.5 sec
Single node expansion
Simplest case
Scenario 2-7 (Core): ~1.5 sec each
9 sec total for 6 scenarios
Covers main use cases
Scenario 8-9 (Edge Cases): ~1 sec each
2 sec total
May gracefully fail if schemas unavailable
Total Time: ~15 seconds for all tests
File
Purpose
test_with_cte_node_expansion.py
Test suite (~600 lines)
run_with_cte_tests.sh
Test runner script
TEST_WITH_CTE_DOCUMENTATION.md
Detailed documentation
TEST_CREATION_SUMMARY.md
Creation summary
DESIGN_REVIEW_WITH_CTE_FIX.md
Design review
PRE_MERGE_VERIFICATION_CHECKLIST.md
Verification steps
Ready to run tests! 🚀