@@ -56,9 +56,9 @@ python setup.py develop
5656
5757### Add /etc/hosts entry
5858
59- Required for TLS tests.
59+ Required for TLS and Kerberos tests.
6060The generated certificates assume TLS requests use ` server1.clickhouse.test ` as the hostname.
61- See [ test_tls.py] ( tests/integration_tests/test_tls.py ) for more details.
61+ See [ test_tls.py] ( tests/integration_tests/test_tls.py ) and [ test_kerberos.py ] ( tests/integration_tests/test_kerberos.py ) for more details.
6262
6363``` bash
6464sudo -- sh -c " echo 127.0.0.1 server1.clickhouse.test >> /etc/hosts"
@@ -120,6 +120,50 @@ Additionally, the TLS ClickHouse instance should be running (see [docker-compose
120120CLICKHOUSE_CONNECT_TEST_TLS=1 pytest tests/integration_tests/test_tls.py
121121```
122122
123+ ### Run the Kerberos integration tests
124+
125+ These tests require the ` CLICKHOUSE_CONNECT_TEST_KERBEROS ` environment variable to be set to ` 1 ` ; otherwise, they will be skipped.
126+ Unlike the other test instances, the Kerberos KDC and ClickHouse instance (the ` kerberos_kdc ` and ` kerberos_clickhouse ` services in
127+ [ docker-compose.yml] ( docker-compose.yml ) ) are behind a ` kerberos ` Compose profile rather than started by a plain ` docker compose up -d ` ,
128+ since they also need an extra host-side step (obtaining a real Kerberos ticket) that Docker Compose cannot do for you. This walks
129+ through setting them up from scratch.
130+
131+ Install the system Kerberos client and development packages (needed to build the ` gssapi ` /` krb5 ` Python packages):
132+
133+ ``` bash
134+ # Debian/Ubuntu
135+ sudo apt-get install gcc python3-dev libkrb5-dev krb5-user
136+
137+ # CentOS/RHEL/Fedora
138+ sudo dnf install gcc python3-devel krb5-devel krb5-workstation
139+
140+ # Arch Linux
141+ sudo pacman -S gcc krb5
142+ ```
143+
144+ Make sure you've added the ` server1.clickhouse.test ` ` /etc/hosts ` entry from
145+ [ "Add /etc/hosts entry"] ( #add-etchosts-entry ) above.
146+
147+ The rest (starting a KDC and a Kerberos-configured ClickHouse instance, obtaining a ticket, and tearing it all
148+ back down afterward) is handled automatically by a fixture in
149+ [ ` test_kerberos.py ` ] ( tests/integration_tests/test_kerberos.py ) , via
150+ [ ` kerberos_manage.py ` ] ( tests/integration_tests/kerberos_manage.py ) , which uses the fixtures vendored under
151+ [ ` tests/integration_tests/kerberos_conf ` ] ( tests/integration_tests/kerberos_conf ) .
152+
153+ Run from the repo root:
154+
155+ ``` bash
156+ CLICKHOUSE_CONNECT_TEST_KERBEROS=1 pytest tests/integration_tests/test_kerberos.py
157+ ```
158+
159+ To stand up (or tear down) the same environment by hand, outside of pytest -- for example, to poke at it manually
160+ with ` curl --negotiate ` -- run:
161+
162+ ``` bash
163+ python -m tests.integration_tests.kerberos_manage setup
164+ python -m tests.integration_tests.kerberos_manage teardown
165+ ```
166+
123167### Running the integration tests with ClickHouse Cloud
124168
125169If you want to run the tests using your ClickHouse Cloud instance instead of the local ClickHouse instance running in Docker, you will need a few additional environment variables.
0 commit comments