From f5b1ceccd56d590bff4038c5eeee3975fb07b9f7 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Wed, 2 Oct 2024 19:02:43 -0400 Subject: [PATCH] fix(ds): Fix invalid response from DS list API for archived data sets Signed-off-by: Timothy Johnson --- packages/zosfiles/CHANGELOG.md | 4 ++++ .../__tests__/__unit__/methods/list/List.unit.test.ts | 2 +- packages/zosfiles/src/methods/list/List.ts | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index cad4d2a54f..7ffc38ca08 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Zowe z/OS files SDK package will be documented in this file. +## Recent Changes + +- BugFix: Fixed an issue with `List.dataSetsMatchingPattern` method where migrated data sets could break fetching attributes for other data sets. [#2285](https://github.com/zowe/zowe-cli/issues/2285) + ## `8.0.0` - MAJOR: v8.0.0 Release diff --git a/packages/zosfiles/__tests__/__unit__/methods/list/List.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/list/List.unit.test.ts index a8fc17ea6a..b5e8434626 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/list/List.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/list/List.unit.test.ts @@ -1498,7 +1498,7 @@ describe("z/OS Files - List", () => { }); expect(listDataSetSpy).toHaveBeenCalledTimes(3); - expect(listDataSetSpy).toHaveBeenCalledWith(dummySession, dataSetPS.dsname, {attributes: true}); + expect(listDataSetSpy).toHaveBeenLastCalledWith(dummySession, dataSetPS.dsname, {attributes: true, maxLength: 1}); }); it("should handle an error when the exclude pattern is specified", async () => { diff --git a/packages/zosfiles/src/methods/list/List.ts b/packages/zosfiles/src/methods/list/List.ts index 4046d6095f..f7dd71e1ed 100644 --- a/packages/zosfiles/src/methods/list/List.ts +++ b/packages/zosfiles/src/methods/list/List.ts @@ -389,7 +389,7 @@ export class List { listsInitiated++; } - return List.dataSet(session, dataSetObj.dsname, { attributes: true }).then( + return List.dataSet(session, dataSetObj.dsname, { attributes: true, maxLength: 1 }).then( (tempResponse) => { Object.assign(dataSetObj, tempResponse.apiResponse.items[0]); },