Skip to content

Commit 3114f7e

Browse files
committed
Fix tests to replicate signature error
1 parent a94da09 commit 3114f7e

File tree

3 files changed

+1
-70
lines changed

3 files changed

+1
-70
lines changed

tests/functional/attempt_replicate_signature_errors_using_session.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@
77
import time
88
import threading
99
import boto3
10-
<<<<<<< HEAD
11-
=======
1210
import os
1311
import urllib.request
14-
>>>>>>> ca15ae9 (Add test to reproduce connection errors)
1512
from datetime import datetime
1613
from cassandra.cluster import Cluster
1714
from cassandra_sigv4.auth import SigV4AuthProvider
@@ -43,9 +40,6 @@ def create_short_lived_session(role_arn, region, role_session_duration=900):
4340
region_name=region
4441
)
4542

46-
<<<<<<< HEAD
47-
def worker_thread(thread_id, session, endpoint, role_session_duration, results):
48-
=======
4943
def download_starfield_certificate():
5044
"""Download the Starfield certificate at runtime."""
5145
cert_url = "https://certs.secureserver.net/repository/sf-class2-root.crt"
@@ -59,7 +53,6 @@ def download_starfield_certificate():
5953
return cert_file
6054

6155
def worker_thread(thread_id, session, endpoint, role_session_duration, results, cert_file):
62-
>>>>>>> ca15ae9 (Add test to reproduce connection errors)
6356
"""Worker thread that connects and queries Keyspaces."""
6457
print(f"[{datetime.now()}] Thread {thread_id}: Starting")
6558

@@ -69,11 +62,7 @@ def worker_thread(thread_id, session, endpoint, role_session_duration, results,
6962

7063
# Create SSL context
7164
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
72-
<<<<<<< HEAD
73-
ssl_context.load_verify_locations('sf-class2-root.crt')
74-
=======
7565
ssl_context.load_verify_locations(cert_file)
76-
>>>>>>> ca15ae9 (Add test to reproduce connection errors)
7766
ssl_context.verify_mode = ssl.CERT_REQUIRED
7867

7968
# Create cluster
@@ -240,8 +229,6 @@ def run_multithreaded_test(region, endpoint, account_id, role_name, num_threads=
240229
return True
241230

242231
if __name__ == "__main__":
243-
<<<<<<< HEAD
244-
=======
245232
# Create .gitignore if it doesn't exist to ensure cert files aren't committed
246233
gitignore_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), ".gitignore")
247234
if not os.path.exists(gitignore_path):
@@ -265,33 +252,5 @@ def run_multithreaded_test(region, endpoint, account_id, role_name, num_threads=
265252

266253
args = parser.parse_args()
267254

268-
success = run_multithreaded_test(args.region, args.endpoint, args.account_id, args.role_name, args.threads, args.duration)
269-
sys.exit(0 if success else 1)
270-
271-
if __name__ == "__main__":
272-
# Create .gitignore if it doesn't exist to ensure cert files aren't committed
273-
gitignore_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), ".gitignore")
274-
if not os.path.exists(gitignore_path):
275-
with open(gitignore_path, "w") as f:
276-
f.write("# Ignore certificate files\n*.crt\n*.crt.temp\n")
277-
else:
278-
# Ensure certificate patterns are in .gitignore
279-
with open(gitignore_path, "r") as f:
280-
content = f.read()
281-
if "*.crt" not in content:
282-
with open(gitignore_path, "a") as f:
283-
f.write("\n# Ignore certificate files\n*.crt\n*.crt.temp\n")
284-
285-
>>>>>>> ca15ae9 (Add test to reproduce connection errors)
286-
parser = argparse.ArgumentParser(description="Multi-threaded test for SigV4 signature errors")
287-
parser.add_argument("--region", required=True, help="AWS region")
288-
parser.add_argument("--endpoint", required=True, help="Keyspaces endpoint")
289-
parser.add_argument("--account-id", required=True, help="AWS account ID for the role")
290-
parser.add_argument("--role-name", required=True, help="IAM role name to assume")
291-
parser.add_argument("--threads", type=int, default=5, help="Number of threads")
292-
parser.add_argument("--duration", type=int, default=10, help="Test duration in minutes")
293-
294-
args = parser.parse_args()
295-
296255
success = run_multithreaded_test(args.region, args.endpoint, args.account_id, args.role_name, args.threads, args.duration)
297256
sys.exit(0 if success else 1)

tests/functional/run_replicate_signature_errors_test.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Check if required arguments are provided
55
if [ "$#" -lt 4 ]; then
66
echo "Usage: $0 <region> <endpoint> <account-id> <role-name> [threads] [duration_minutes]"
7-
echo "Example: $0 us-east-1 cassandra.us-east-1.amazonaws.com 768726360020 KeyspacesIntegrationTestRole 10 15"
7+
echo "Example: $0 us-east-1 cassandra.us-east-1.amazonaws.com <> KeyspacesIntegrationTestRole 10 15"
88
exit 1
99
fi
1010

@@ -38,17 +38,13 @@ echo "Running multi-threaded test for signature errors..."
3838
echo "Threads: ${THREADS}"
3939
echo "Duration: ${DURATION} minutes"
4040

41-
<<<<<<< HEAD
42-
python attempt_replicate_signature_errors.py --region "$REGION" --endpoint "$ENDPOINT" --account-id "$ACCOUNT_ID" --role-name "$ROLE_NAME" --threads "$THREADS" --duration "$DURATION"
43-
=======
4441
# Determine the correct path to the Python script
4542
SCRIPT_PATH="attempt_replicate_signature_errors_using_session.py"
4643
if [ ! -f "$SCRIPT_PATH" ] && [ -f "tests/functional/$SCRIPT_PATH" ]; then
4744
SCRIPT_PATH="tests/functional/$SCRIPT_PATH"
4845
fi
4946

5047
python "$SCRIPT_PATH" --region "$REGION" --endpoint "$ENDPOINT" --account-id "$ACCOUNT_ID" --role-name "$ROLE_NAME" --threads "$THREADS" --duration "$DURATION"
51-
>>>>>>> ca15ae9 (Add test to reproduce connection errors)
5248

5349
# Check the exit code
5450
if [ $? -eq 0 ]; then

tests/functional/sf-class2-root.crt

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)