Skip to content

Commit 41cfb91

Browse files
committed
test: Fix SNI validation failures with Druid 35.0.1
1 parent e324ed4 commit 41cfb91

9 files changed

Lines changed: 33 additions & 20 deletions

File tree

tests/templates/kuttl/authorizer/06-assert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
apiVersion: kuttl.dev/v1beta1
33
kind: TestAssert
44
commands:
5-
- script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/authcheck.py derby-druid
5+
- script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/authcheck.py derby-druid $NAMESPACE
66
timeout: 600

tests/templates/kuttl/authorizer/authcheck.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
import sys
33
import logging
44

5-
coordinator_host = "derby-druid-coordinator-default-headless"
65
coordinator_port = "8281"
76
authenticator_name = "MyBasicMetadataAuthenticator"
87

98

10-
def create_user(user_name):
9+
def create_user(user_name, coordinator_host):
1110
requests.post(
1211
f"https://{coordinator_host}:{coordinator_port}/druid-ext/basic-security/authentication/db/{authenticator_name}/users/{user_name}",
1312
auth=("admin", "password1"),
@@ -36,13 +35,17 @@ def create_user(user_name):
3635
stream=sys.stdout,
3736
)
3837

38+
druid_cluster_name = sys.argv[1]
39+
namespace = sys.argv[2]
40+
41+
# Build FQDN for coordinator for TLS/SNI validation
42+
coordinator_host = f"derby-druid-coordinator-default-headless.{namespace}.svc.cluster.local"
43+
3944
print("CREATING USERS")
40-
create_user("alice")
41-
create_user("eve")
45+
create_user("alice", coordinator_host)
46+
create_user("eve", coordinator_host)
4247
print("USERS CREATED!")
4348

44-
druid_cluster_name = sys.argv[1]
45-
4649
druid_role_ports = {
4750
"broker": 8282,
4851
"coordinator": 8281,
@@ -52,7 +55,9 @@ def create_user(user_name):
5255
}
5356

5457
for role, port in druid_role_ports.items():
55-
url = f"https://{druid_cluster_name}-{role}-default-headless:{port}/status"
58+
# Build FQDN for TLS/SNI validation
59+
host = f"{druid_cluster_name}-{role}-default-headless.{namespace}.svc.cluster.local"
60+
url = f"https://{host}:{port}/status"
5661
# make an authorized request -> return 401 expected
5762
print("Checking Unauthorized")
5863
res = requests.get(url, verify=False)

tests/templates/kuttl/commons/ingestioncheck.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,18 @@ def query_datasource(self, url, sql, expected, iterations):
4949

5050

5151
druid_cluster_name = sys.argv[1]
52+
namespace = sys.argv[2]
5253
druid = DruidClient()
5354

55+
# Build FQDNs for TLS/SNI validation
56+
coordinator_host = f"{druid_cluster_name}-coordinator-default-headless.{namespace}.svc.cluster.local"
57+
broker_host = f"{druid_cluster_name}-broker-default-headless.{namespace}.svc.cluster.local"
58+
5459
print("""
5560
Query tasks
5661
===========""")
5762
tasks = druid.get_tasks(
58-
url=f"https://{druid_cluster_name}-coordinator-default-headless:8281/druid/indexer/v1/tasks",
63+
url=f"https://{coordinator_host}:8281/druid/indexer/v1/tasks",
5964
)
6065
task_count = len(json.loads(tasks))
6166
print(f"existing tasks: {task_count}")
@@ -64,7 +69,7 @@ def query_datasource(self, url, sql, expected, iterations):
6469
Start ingestion task
6570
====================""")
6671
ingestion = druid.post_task(
67-
url=f"https://{druid_cluster_name}-coordinator-default-headless:8281/druid/indexer/v1/task",
72+
url=f"https://{coordinator_host}:8281/druid/indexer/v1/task",
6873
input="/tmp/druid-quickstartimport.json",
6974
)
7075
task_id = json.loads(ingestion)["task"]
@@ -74,7 +79,7 @@ def query_datasource(self, url, sql, expected, iterations):
7479
Re-query tasks
7580
==============""")
7681
tasks = druid.get_tasks(
77-
url=f"https://{druid_cluster_name}-coordinator-default-headless:8281/druid/indexer/v1/tasks",
82+
url=f"https://{coordinator_host}:8281/druid/indexer/v1/tasks",
7883
)
7984
new_task_count = len(json.loads(tasks))
8085
print(f"new tasks: {new_task_count}")
@@ -88,7 +93,7 @@ def query_datasource(self, url, sql, expected, iterations):
8893
while not job_finished:
8994
time.sleep(5)
9095
task = druid.get(
91-
url=f"https://{druid_cluster_name}-coordinator-default-headless:8281/druid/indexer/v1/task/{url_encoded_taskid}/status",
96+
url=f"https://{coordinator_host}:8281/druid/indexer/v1/task/{url_encoded_taskid}/status",
9297
)
9398
task_status = json.loads(task)["status"]["statusCode"]
9499
print(f"Current task status: [{task_status}]")
@@ -104,7 +109,7 @@ def query_datasource(self, url, sql, expected, iterations):
104109
while not broker_ready:
105110
time.sleep(2)
106111
broker_ready_rc = druid.check_rc(
107-
f"https://{druid_cluster_name}-broker-default-headless:8282/druid/broker/v1/readiness"
112+
f"https://{broker_host}:8282/druid/broker/v1/readiness"
108113
)
109114
broker_ready = broker_ready_rc == 200
110115
print(f"Broker respondend with [{broker_ready_rc}] to readiness check")
@@ -114,7 +119,7 @@ def query_datasource(self, url, sql, expected, iterations):
114119
==============""")
115120
sample_data_size = 39244
116121
result = druid.query_datasource(
117-
url=f"https://{druid_cluster_name}-broker-default-headless:8282/druid/v2/sql",
122+
url=f"https://{broker_host}:8282/druid/v2/sql",
118123
sql={"query": 'select count(*) as c from "wikipedia-2015-09-12"'},
119124
expected=sample_data_size,
120125
iterations=12,

tests/templates/kuttl/hdfs-deep-storage/06-assert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
apiVersion: kuttl.dev/v1beta1
33
kind: TestAssert
44
commands:
5-
- script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/ingestioncheck.py derby-druid
5+
- script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/ingestioncheck.py derby-druid $NAMESPACE
66
timeout: 300

tests/templates/kuttl/ingestion-no-s3-ext/06-assert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
apiVersion: kuttl.dev/v1beta1
33
kind: TestAssert
44
commands:
5-
- script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/ingestioncheck.py derby-druid
5+
- script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/ingestioncheck.py derby-druid $NAMESPACE
66
timeout: 300

tests/templates/kuttl/ingestion-s3-ext/06-assert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
apiVersion: kuttl.dev/v1beta1
33
kind: TestAssert
44
commands:
5-
- script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/ingestioncheck.py derby-druid
5+
- script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/ingestioncheck.py derby-druid $NAMESPACE
66
timeout: 300

tests/templates/kuttl/ldap/20-assert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
apiVersion: kuttl.dev/v1beta1
33
kind: TestAssert
44
commands:
5-
- script: kubectl exec -n $NAMESPACE test-druid-0 -- python /tmp/authcheck.py
5+
- script: kubectl exec -n $NAMESPACE test-druid-0 -- python /tmp/authcheck.py $NAMESPACE
66
timeout: 180

tests/templates/kuttl/ldap/authcheck.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def main():
1010
result = 0
1111

1212
druid_cluster_name = "derby-druid"
13+
namespace = sys.argv[1]
1314

1415
druid_role_ports = {
1516
"broker": 8282,
@@ -26,7 +27,9 @@ def main():
2627
)
2728

2829
for role, port in druid_role_ports.items():
29-
url = f"https://{druid_cluster_name}-{role}-default-headless:{port}/status"
30+
# Build FQDN for TLS/SNI validation
31+
host = f"{druid_cluster_name}-{role}-default-headless.{namespace}.svc.cluster.local"
32+
url = f"https://{host}:{port}/status"
3033
# make an authorized request -> return 401 expected
3134
logging.info(f"making unauthorized request to {role}.")
3235
res = requests.get(url, verify=False)

tests/templates/kuttl/s3-deep-storage/12-assert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
apiVersion: kuttl.dev/v1beta1
33
kind: TestAssert
44
commands:
5-
- script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/ingestioncheck.py druid-s3-deep-storage
5+
- script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/ingestioncheck.py druid-s3-deep-storage $NAMESPACE
66
timeout: 300

0 commit comments

Comments
 (0)