@@ -147,6 +147,21 @@ TEST(AuthPluginTest, testTlsDetectPulsarSslWithHostNameValidation) {
147147 Client client (serviceUrlTls, config);
148148 std::string topicName = " persistent://private/auth/testTlsDetectPulsarSslWithHostNameValidation" ;
149149
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+
150165 Producer producer;
151166 Result res = client.createProducer (topicName, producer);
152167 ASSERT_EQ (ResultConnectError, res);
@@ -183,6 +198,23 @@ TEST(AuthPluginTest, testTlsDetectHttpsWithHostNameValidation) {
183198
184199 std::string topicName = " persistent://private/auth/test-tls-detect-https-with-hostname-validation" ;
185200
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+
186218 Producer producer;
187219 Result res = client.createProducer (topicName, producer);
188220 ASSERT_NE (ResultOk, res);
0 commit comments