Skip to content

Commit 593a82f

Browse files
committed
docs tests
1 parent 987a1db commit 593a82f

File tree

2 files changed

+348
-22
lines changed

2 files changed

+348
-22
lines changed

tests/unit/test_cluster.py

Lines changed: 95 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,25 @@ def test_protocol_version_validation_v2(self, mock_cluster):
591591
"""
592592
Test that protocol version 2 is rejected.
593593
594-
Protocol v2 was used in Cassandra 2.0.
595-
Too old for async operations.
594+
What this tests:
595+
---------------
596+
1. Protocol version 2 validation and rejection
597+
2. Clear error message for unsupported version
598+
3. Guidance on minimum required version
599+
4. Early validation before cluster creation
600+
601+
Why this matters:
602+
----------------
603+
- Protocol v2 lacks async-friendly features
604+
- Prevents runtime failures from missing capabilities
605+
- Helps users upgrade to supported Cassandra versions
606+
- Clear error messages reduce debugging time
607+
608+
Additional context:
609+
---------------------------------
610+
- Protocol v2 was used in Cassandra 2.0
611+
- Lacks continuous paging and other v5+ features
612+
- Common when migrating from old clusters
596613
"""
597614
with pytest.raises(ConfigurationError) as exc_info:
598615
AsyncCluster(protocol_version=2)
@@ -604,8 +621,25 @@ def test_protocol_version_validation_v3(self, mock_cluster):
604621
"""
605622
Test that protocol version 3 is rejected.
606623
607-
Protocol v3 was used in Cassandra 2.1-2.2.
608-
Still lacks features needed for optimal async.
624+
What this tests:
625+
---------------
626+
1. Protocol version 3 validation and rejection
627+
2. Proper error handling for intermediate versions
628+
3. Consistent error messaging across versions
629+
4. Configuration validation at initialization
630+
631+
Why this matters:
632+
----------------
633+
- Protocol v3 still lacks critical async features
634+
- Common version in legacy deployments
635+
- Users need clear upgrade path guidance
636+
- Prevents subtle bugs from missing features
637+
638+
Additional context:
639+
---------------------------------
640+
- Protocol v3 was used in Cassandra 2.1-2.2
641+
- Added some features but not enough for async
642+
- Many production clusters still use this
609643
"""
610644
with pytest.raises(ConfigurationError) as exc_info:
611645
AsyncCluster(protocol_version=3)
@@ -617,9 +651,25 @@ def test_protocol_version_validation_v4(self, mock_cluster):
617651
"""
618652
Test that protocol version 4 is rejected.
619653
620-
Protocol v4 was used in Cassandra 3.x.
621-
Close but still missing v5 improvements.
622-
Most common version users might try.
654+
What this tests:
655+
---------------
656+
1. Protocol version 4 validation and rejection
657+
2. Handling of most common incompatible version
658+
3. Clear upgrade guidance in error message
659+
4. Protection against near-miss configurations
660+
661+
Why this matters:
662+
----------------
663+
- Protocol v4 is extremely common (Cassandra 3.x)
664+
- Users often assume v4 is "good enough"
665+
- Missing v5 features cause subtle async issues
666+
- Most frequent configuration error
667+
668+
Additional context:
669+
---------------------------------
670+
- Protocol v4 was standard in Cassandra 3.x
671+
- Very close to v5 but missing key improvements
672+
- Requires Cassandra 4.0+ upgrade for v5
623673
"""
624674
with pytest.raises(ConfigurationError) as exc_info:
625675
AsyncCluster(protocol_version=4)
@@ -631,8 +681,25 @@ def test_protocol_version_validation_v5(self, mock_cluster):
631681
"""
632682
Test that protocol version 5 is accepted.
633683
634-
Protocol v5 (Cassandra 4.0+) is our minimum.
635-
This is the first version we fully support.
684+
What this tests:
685+
---------------
686+
1. Protocol version 5 is accepted without error
687+
2. Minimum supported version works correctly
688+
3. Version is properly passed to underlying driver
689+
4. No warnings for supported versions
690+
691+
Why this matters:
692+
----------------
693+
- Protocol v5 is our minimum requirement
694+
- First version with all async-friendly features
695+
- Baseline for production deployments
696+
- Must work flawlessly as the default
697+
698+
Additional context:
699+
---------------------------------
700+
- Protocol v5 introduced in Cassandra 4.0
701+
- Adds continuous paging and duration type
702+
- Required for optimal async performance
636703
"""
637704
# Should not raise
638705
AsyncCluster(protocol_version=5)
@@ -646,8 +713,25 @@ def test_protocol_version_validation_v6(self, mock_cluster):
646713
"""
647714
Test that protocol version 6 is accepted.
648715
649-
Protocol v6 (Cassandra 4.1+) adds more features.
650-
We support it for future compatibility.
716+
What this tests:
717+
---------------
718+
1. Protocol version 6 is accepted without error
719+
2. Future protocol versions are supported
720+
3. Version is correctly propagated to driver
721+
4. Forward compatibility is maintained
722+
723+
Why this matters:
724+
----------------
725+
- Users on latest Cassandra need v6 support
726+
- Future-proofing for new deployments
727+
- Enables access to latest features
728+
- Prevents forced downgrades
729+
730+
Additional context:
731+
---------------------------------
732+
- Protocol v6 introduced in Cassandra 4.1
733+
- Adds vector types and other improvements
734+
- Backward compatible with v5 features
651735
"""
652736
# Should not raise
653737
AsyncCluster(protocol_version=6)

0 commit comments

Comments
 (0)