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

[GitHub] [pulsar-client-node] XXXMrG commented on a diff in pull request #322: [feat]: Support client.getPartitionsForTopic (#320)

XXXMrG commented on code in PR #322:
URL: https://github.com/apache/pulsar-client-node/pull/322#discussion_r1188071929


##########
tests/client.test.js:
##########
@@ -49,5 +74,54 @@ const Pulsar = require('../index.js');
         })).toThrow('Service URL is required and must be specified as a string');
       });
     });
+    describe('test getPartitionsForTopic', () => {
+      test('GetPartitions for empty topic', async () => {
+        const client = new Pulsar.Client({
+          serviceUrl: 'pulsar://localhost:6650',
+          operationTimeoutSeconds: 30,
+        });
+
+        await expect(client.getPartitionsForTopic(''))
+          .rejects.toThrow('Failed to GetPartitionsForTopic: InvalidTopicName');
+        await client.close();
+      });
+
+      test('Client/getPartitionsForTopic', async () => {
+        const client = new Pulsar.Client({
+          serviceUrl: 'pulsar://localhost:6650',
+          operationTimeoutSeconds: 30,
+        });
+
+        // test on nonPartitionedTopic
+        const nonPartitionedTopicName = 'test-non-partitioned-topic';
+        const nonPartitionedTopic = `persistent://public/default/${nonPartitionedTopicName}`;
+        await requestAdminApi(`${baseUrl}/admin/v2/persistent/public/default/${nonPartitionedTopicName}`, {
+          headers: {
+            'Content-Type': 'application/json',
+          },
+        });
+        const nonPartitionedTopicList = await client.getPartitionsForTopic(nonPartitionedTopic);

Review Comment:
   Got it, let me try again.



-- 
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