microsoft / azure-devops-node-api

Azure DevOps Client for Node.js
Other
466 stars 231 forks source link

The method getTestSuitesForPlan() doest not return continuationToken when it's needed #609

Open Luzhmf opened 2 months ago

Luzhmf commented 2 months ago

Environment

Node version: v21.6.1 Npm version: 10.4.0 OS and version: Windows 11 azure-devops-node-api version: 14.0.2

Issue Description

I'm trying to retrieve test suites from a test plan which have 280 test suites. I need to use the continuationToken as described at the code, but the method getTestSuitesForPlan() always returning the propertie undefined. I took a look at the headers from the api response and the continuation token is there,

Expected behaviour

If the response for getTestSuites have "x-ms-continuationtoken" header, the PagedList.continuationToken should be set with this value to allow continue to get the test suites.

Actual behaviour

The property continuationToken is always being received as 'undefined'.

Steps to reproduce

  1. Try to get test suites from a test plan with more than 200 test suites inside.
  2. Try to continue retrieving the test suites using the continuationToken
adelisle commented 1 month ago

This is easy to fix, however it must be fixed on the side of the code generation as the bug appears to be in the generated code. I haven't found where the upstream is to apply this fix myself.

Here is an example that I have tested, and verified to be working as expected, for ReleaseAPI :

diff --git a/api/ReleaseApi.ts b/api/ReleaseApi.ts
index 7c387e7..8face38 100644
--- a/api/ReleaseApi.ts
+++ b/api/ReleaseApi.ts
@@ -220,6 +220,8 @@ export class ReleaseApi extends basem.ClientApiBase implements IReleaseApi {
                                               ReleaseInterfaces.TypeInfo.ReleaseApproval,
                                               true);

+                ret.continuationToken = res.headers['x-ms-continuationtoken']
+
                 resolve(ret);

             }
@@ -1121,6 +1123,8 @@ export class ReleaseApi extends basem.ClientApiBase implements IReleaseApi {
                                               ReleaseInterfaces.TypeInfo.ReleaseDefinition,
                                               true);

+                ret.continuationToken = res.headers['x-ms-continuationtoken']
+
                 resolve(ret);

             }
@@ -1300,6 +1304,8 @@ export class ReleaseApi extends basem.ClientApiBase implements IReleaseApi {
                                               ReleaseInterfaces.TypeInfo.Deployment,
                                               true);

+                ret.continuationToken = res.headers['x-ms-continuationtoken']
+
                 resolve(ret);

             }
@@ -2999,6 +3005,8 @@ export class ReleaseApi extends basem.ClientApiBase implements IReleaseApi {
                                               ReleaseInterfaces.TypeInfo.Release,
                                               true);

+                ret.continuationToken = res.headers['x-ms-continuationtoken']
+
                 resolve(ret);

             }

Looking forward to a quick resolution to this stagnant and long-standing issue.