You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "RobertIndie (via GitHub)" <gi...@apache.org> on 2023/03/21 03:36:35 UTC

[GitHub] [pulsar-client-node] RobertIndie commented on a diff in pull request #307: [Fix] Wrap c++ exception when creating client.

RobertIndie commented on code in PR #307:
URL: https://github.com/apache/pulsar-client-node/pull/307#discussion_r1142860744


##########
tests/client.test.js:
##########
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const Pulsar = require('../index.js');
+
+(() => {
+  describe('Client', () => {
+    describe('CreateFailedByUrlSetIncorrect', () => {
+      test('No Set Url', async () => {
+        await expect(() => new Pulsar.Client({
+          operationTimeoutSeconds: 30,
+        })).toThrow('Service URL is required and must be specified as a string');
+      });
+
+      test('Set empty url', async () => {
+        await expect(() => new Pulsar.Client({
+          serviceUrl: '',
+          operationTimeoutSeconds: 30,
+        })).toThrow('Service URL is required and must be specified as a string');
+      });
+
+      test('Set not string url', async () => {
+        await expect(() => new Pulsar.Client({
+          serviceUrl: -1,
+          operationTimeoutSeconds: 30,
+        })).toThrow('Service URL is required and must be specified as a string');
+      });
+    });

Review Comment:
   Need to add another test it failed to set the service URL with the invalid scheme. It will throw an exception from the C++ client side so that we can test the exception wrapper added by this PR.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org