1
+ # Conventions Used in This Document
2
+ Unless otherwise noted all commands, file and directory references are relative to the * source root* directory.
3
+
4
+ ## Terminology
5
+ - modes: Collection of integration tests to be run; a mode(singular) represents an individual integration testing unit
6
+ - testconf: [ JSON] ( https://tools.ietf.org/html/rfc8259 ) formatted configuration file.
7
+ Example: [ tests/testconf-example.json] ( ./tests/testconf-example.json ) for formatting.
8
+
1
9
Unit tests
2
10
==========
3
-
4
11
From top-level directory run:
5
12
6
13
$ tox
@@ -10,24 +17,47 @@ From top-level directory run:
10
17
Integration tests
11
18
=================
12
19
13
- ** NOTE** : Integration tests require an existing Kafka cluster and a ` testconf.json ` configuration file. Any value provided
14
- in ` testconf.json ` prefixed with '$' will be treated as an environment variable and automatically resolved.
20
+ ## Introduction
21
+ Integration tests, ` tests ` henceforth, are broken up into two distinct categories.
22
+ 1 . Default
23
+ 2 . Ancillary
24
+
25
+ Default modes can be executed against any unsecured cluster with a minimally configured [ testconf] ( #configuration ) .
26
+
27
+ Default Modes: consumer, producer, avro, performance, admin
28
+
29
+ Ancillary modes require additional steps to be taken prior to ` mode ` execution. Per ` mode ` instructions are covered in
30
+ within sections sharing the same name.
31
+
32
+ Ancillary Modes: [ throttle] ( #throttle ) , [ avro-https] ( #avro-https ) , [ avro-basic-auth] ( #avro-basic-auth )
33
+
34
+ ## Prerequisites
35
+ All test modes require access to a running Kafka cluster configured with at least one PLAINTEXT listener.
36
+
37
+ Test modes prefixed with ` avro ` require a running [ Confluent Schema Registry] ( https://docs.confluent.io/current/schema-registry/docs/index.html )
15
38
16
- At a minimum you must specify ` bootstrap.servers ` and ` topic ` within ` testconf.json ` . Please reference [ tests/testconf-example.json ] ( tests/testconf-example.json ) for formatting .
39
+ ** Note ** Test mode ` avro ` is included in the default modes list .
17
40
41
+ In order to keep things contained resources have been provided to deploy a dockerized cluster which developers are encouraged to leverage.
42
+ See the [ Docker] ( #docker ) section below for additional requirements and details.
43
+
44
+ All tests require some degree of configuration to run.
45
+ See [ #Configuration] ( #configuration ) for instructions on configuring tests.
46
+
47
+ ## Running tests
18
48
** WARNING** : These tests will create new topics and consumer groups.
19
49
20
- To run all of the integration test ` modes ` uncomment the following line from ` tox.ini ` and provide the location to your ` testconf.json `
50
+ To run all of the default test ` modes ` uncomment the following line from ` tox.ini ` and provide the location to your ` testconf `
21
51
22
- #python examples/integration_test.py --conf < testconf.json>
52
+ #python examples/integration_test.py --conf testconf.json
23
53
24
- You can also run the integration tests outside of ` tox ` by running this command from the source root directory
54
+ You can also run the integration tests outside of ` tox ` with the command below.
25
55
26
- python examples/integration_test.py --conf < testconf.json>
56
+ python examples/integration_test.py --conf testconf.json
27
57
28
- To run individual integration test ` modes ` use the following syntax
58
+ To specify which ` mode ` or ` modes ` to run use the following syntax
29
59
30
- python examples/integration_test.py --<test mode> --conf <testconf.json >
60
+ python examples/integration_test.py --<test mode 1 > --<test mode n...> -- conf <testconf>
31
61
32
62
For example:
33
63
@@ -37,10 +67,62 @@ To get a list of modes you can run the integration test manually with the `--hel
37
67
38
68
python examples/integration_tests.py --help
39
69
70
+ ## Configuration
71
+ Tests are configured with a JSON encoded file referred to as a ` testconf ` to be provided as an argument upon test execution.
72
+
73
+ Test ` mode ` configuration can be broken up into 3 main categories.
74
+ 1 . Global, minimal client configuration values required by every test mode.
75
+ 1 . bootstrap.servers
76
+ 2 . topic
77
+ 2 . Default, client configurations required to execute schema registry tests.
78
+ 1 . schema.registry.url
79
+ 3 . Ancillary, client configurations required to execute a specific test mode. These are covered in their own sections
80
+ * See the [ Ancillary] ( #ancillary-modes ) section for configuration requirements
81
+
82
+ The following basic conventions should be followed when constructing the ` testconf ` file.
83
+ - Global configuration values should be defined as members of the root json object.
84
+ - Default configuration values should also be defined as members of the root object.
85
+ - Ancillary mode configuration values should be defined as object members named the same as the mode.
86
+
87
+ Values can be defined literally or prefixed with '$'.
88
+ Values prefixed with '$' represent environment variables which will be resolved at runtime.
89
+
90
+ See [ ../tests/testconf-example.json] ( ../tests/testconf-example.json ) for an example.
91
+
92
+ ## Docker
93
+
94
+ A complete docker cluster setup is included within the directory ` ./docker ` .
95
+ This is the preferred method for executing integration tests but standalone cluster will do as well.
96
+
97
+ #### Prerequisites:
98
+
99
+ 1 . docker-compose 3.0 +
100
+ 2 . docker-engine 1.13.0+
101
+
102
+ To set up a cluster with the default settings execute the following commands:
103
+ ``` bash
104
+ source ./docker/.env
105
+ # If running HTTPS enabled tests
106
+ ./docker/bin/certify
107
+ docker-compose -f ./docker/docker-compose.yaml up -d
108
+ ```
109
+
110
+ Use the ` testconf ` provided in the ./docker/conf directory for all tests.
111
+ Unless noted elsewhere the default configuration should suffice.
112
+
113
+ When tests have completed you can destroy the cluster by executing the command
114
+ ``` bash
115
+ docker-compose -f ./docker/docker-compose.yaml down -v --remove-orphans
116
+ ```
117
+
118
+ ## Ancillary Modes
119
+
120
+ ### Throttle
121
+
122
+ The throttle_cb integration test requires aggressive throttling to be configured to simulate heavy load.
123
+
124
+ No cluster or testconf changes are required however the following preliminary steps must be executed prior to test execution.
40
125
41
- Throttle Callback test
42
- ======================
43
- The throttle_cb integration test requires an additional step and as such is not included in the default test modes.
44
126
In order to execute the throttle_cb test you must first set a throttle for the client 'throttled_client' with the command below:
45
127
46
128
kafka-configs --zookeeper <zookeeper host>:<zookeeper port> \
@@ -59,16 +141,51 @@ To remove the throttle you can execute the following
59
141
--entity-name throttled_client --entity-type clients
60
142
61
143
62
- HTTPS Schema Registry test
63
- ==========================
144
+ ### Avro Https
145
+
146
+ #### Cluster Requirements
147
+ 1 . Schema Registry must be configured with a HTTPS listener and optionally TLS mutual auth.
148
+
149
+ For instructions on how to configure the Schema Registry please see the [ Confluent Schema Registry documentation] ( https://docs.confluent.io/current/schema-registry/docs/security.html#configuring-the-rest-api-for-http-or-https )
150
+
151
+ ** Docker:** Prior to starting the cluster you must first generate the certificates by running the following.
152
+
153
+ ./docker/bin/certify
154
+
155
+ #### Testconf Requirements
156
+ 1 . Add ` avro-https ` to the root object with the following members
157
+ 1 . ` schema.registry.url ` ; for the HTTPS listener
158
+ 2 . ` schema.registry.ssl.ca.location ` ; location of the CA certificate used to verify the Schema Registry certificate,
159
+ 2 . ** Optional:** configuring tls client auth:
160
+ 1 . ` schema.registry.ssl.certificate.location ` ; client certificate location
161
+ 2 . ` schema.registry.ssl.key.location ` ; client private key location
162
+
163
+ #### Execute test
164
+ python examples/integration_test.py --avro-https --conf testconf.json
165
+
166
+ ### Avro Basic Auth
167
+
168
+ #### Cluster Requirements
169
+ 1 . A running Schema Registry configured with http basic authentication enabled.
170
+
171
+ ** Docker:** REST_AUTHENTICATION_METHOD=BASIC docker-compose -f ./docker/docker-compose.yaml up -d
172
+
173
+ #### Testconf Requirements
174
+ 1 . schema.registry.url must include user information in the url
175
+ * ` "schema.registry.url" : "http://ckp_tester:test_secret@schema_registry:8081" `
64
176
65
- HTTPS tests require access to a Schema Registry instance configured to with at least one HTTPS listener.
177
+ 2 . add ` avro-basic-auth ` to the root object with the following members
178
+ 1 . ` schema.registry.basic.auth.user.info `
179
+ 2 . ` sasl.username `
180
+ 3 . ` sasl.password `
66
181
67
- For instructions on how to configure the Schema Registry please see the Confluent documentation:
182
+ Configuration details can be found at the following links:
183
+ 1 . [ schema.registry.* ] ( https://docs.confluent.io/current/schema-registry/docs/serializer-formatter.html#basic-auth-security )
184
+ 2 . [ sasl.* ] ( https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md )
68
185
69
- [ Schema Registry documentation ] ( https://docs.confluent.io/current/schema-registry/docs/security.html#configuring-the-rest-api-for-http-or-https )
186
+ The [ Docker testconf ] ( ../docker/conf/testconf.json ) and [ Docker compose file ] ( ../docker/docker-compose.yaml ) can be referenced as an example.
70
187
71
- If client authentication has been enabled you will need to provide both the client certificate, ` schema.registry.ssl.certificate.location ` ,
72
- and the client's private key, ` schema.registry.ssl.key.location `
188
+ ** Note** The userinfo provided in the url and testconf members must have valid credentials as configured with the Schema Registry.
73
189
74
- python examples/integration_test.py --avro-https --conf testconf.json
190
+ #### Execute test
191
+ python examples/integration_test.py --avro-basic-auth --conf testconf.json
0 commit comments