@@ -147,6 +147,21 @@ TEST(AuthPluginTest, testTlsDetectPulsarSslWithHostNameValidation) {
147
147
Client client (serviceUrlTls, config);
148
148
std::string topicName = " persistent://private/auth/testTlsDetectPulsarSslWithHostNameValidation" ;
149
149
150
+ Producer producer;
151
+ Result res = client.createProducer (topicName, producer);
152
+ ASSERT_EQ (ResultOk, res);
153
+ }
154
+
155
+ TEST (AuthPluginTest, testTlsDetectPulsarSslWithHostNameValidationMissingCertsFile) {
156
+ ClientConfiguration config = ClientConfiguration ();
157
+ config.setTlsAllowInsecureConnection (false );
158
+ config.setValidateHostName (true );
159
+ config.setAuth (pulsar::AuthTls::create (clientPublicKeyPath, clientPrivateKeyPath));
160
+
161
+ Client client (serviceUrlTls, config);
162
+ std::string topicName =
163
+ " persistent://private/auth/testTlsDetectPulsarSslWithHostNameValidationMissingCertsFile" ;
164
+
150
165
Producer producer;
151
166
Result res = client.createProducer (topicName, producer);
152
167
ASSERT_EQ (ResultConnectError, res);
@@ -183,6 +198,23 @@ TEST(AuthPluginTest, testTlsDetectHttpsWithHostNameValidation) {
183
198
184
199
std::string topicName = " persistent://private/auth/test-tls-detect-https-with-hostname-validation" ;
185
200
201
+ Producer producer;
202
+ Result res = client.createProducer (topicName, producer);
203
+ ASSERT_EQ (ResultOk, res);
204
+ }
205
+
206
+ TEST (AuthPluginTest, testTlsDetectHttpsWithHostNameValidationMissingCertsFile) {
207
+ ClientConfiguration config = ClientConfiguration ();
208
+ config.setUseTls (true ); // shouldn't be needed soon
209
+ config.setTlsAllowInsecureConnection (false );
210
+ config.setAuth (pulsar::AuthTls::create (clientPublicKeyPath, clientPrivateKeyPath));
211
+ config.setValidateHostName (true );
212
+
213
+ Client client (serviceUrlHttps, config);
214
+
215
+ std::string topicName =
216
+ " persistent://private/auth/test-tls-detect-https-with-hostname-validation-missing-certs-file" ;
217
+
186
218
Producer producer;
187
219
Result res = client.createProducer (topicName, producer);
188
220
ASSERT_NE (ResultOk, res);
0 commit comments