Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ds): Pass correct DS name in stat when doing remote lookup #3407

Merged
merged 4 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- Removed "Delete Profile" action from the "Manage Profile" menu since this action is currently not supported in Zowe Explorer. [#3037](https://github.com/zowe/zowe-explorer-vscode/issues/3037)
- Fixed an issue where the filesystem continued to use a profile with invalid credentials to fetch resources. Now, after an authentication error occurs for a profile, it cannot be used again in the filesystem until the authentication error is resolved. [#3329](https://github.com/zowe/zowe-explorer-vscode/issues/3329)
- Resolved user interface bug with tables that caused an inconsistent table height within the VS Code Panel. [#3389](https://github.com/zowe/zowe-explorer-vscode/pull/3389)
- Fixed an issue where opening a data set with the same starting pattern as an archived data set caused a REST API error (code 500) to appear in the editor. [#3407](https://github.com/zowe/zowe-explorer-vscode/pull/3407)

## `3.0.3`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { MockedProperty } from "../../../__mocks__/mockUtils";
import { DatasetFSProvider } from "../../../../src/trees/dataset/DatasetFSProvider";
import { ZoweExplorerApiRegister } from "../../../../src/extending/ZoweExplorerApiRegister";
import { AuthUtils } from "../../../../src/utils/AuthUtils";
import * as path from "path";
const dayjs = require("dayjs");

const testProfile = createIProfile();
Expand Down Expand Up @@ -686,6 +687,31 @@ describe("stat", () => {
remoteLookupForResourceMock.mockRestore();
getInfoForUriMock.mockRestore();
});

it("calls dataSet for PS and invalidates its data if mtime is newer", async () => {
const fakePs = Object.assign(Object.create(Object.getPrototypeOf(testEntries.ps)), testEntries.ps);
const lookupMock = jest.spyOn(DatasetFSProvider.instance as any, "lookup").mockReturnValue(fakePs);
const lookupParentDirMock = jest.spyOn(DatasetFSProvider.instance as any, "_lookupParentDirectory").mockReturnValue(testEntries.session);
const dataSetMock = jest.fn().mockResolvedValue({
success: true,
apiResponse: {
items: [{ name: "USER.DATA.PS", dsorg: "PS" }],
},
commandResponse: "",
});
const mvsApiMock = jest.spyOn(ZoweExplorerApiRegister, "getMvsApi").mockReturnValue({
dataSet: dataSetMock,
} as any);
const res = await DatasetFSProvider.instance.stat(testUris.ps);
expect(lookupMock).toHaveBeenCalledWith(testUris.ps, false);
expect(dataSetMock).toHaveBeenCalledWith(path.posix.basename(testEntries.ps.metadata.extensionRemovedFromPath()), { attributes: true });
expect(res).toStrictEqual({ ...fakePs });
expect(fakePs.wasAccessed).toBe(false);
lookupMock.mockRestore();
lookupParentDirMock.mockRestore();
mvsApiMock.mockRestore();
});

it("calls allMembers for a PDS member and invalidates its data if mtime is newer", async () => {
const fakePdsMember = Object.assign(Object.create(Object.getPrototypeOf(testEntries.pdsMember)), testEntries.pdsMember);
const lookupMock = jest.spyOn(DatasetFSProvider.instance as any, "lookup").mockReturnValue(fakePdsMember);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ export class DatasetFSProvider extends BaseProvider implements vscode.FileSystem
resp = await ZoweExplorerApiRegister.getMvsApi(uriInfo.profile).allMembers(pds.name, { attributes: true });
} else {
// Data Set
resp = await ZoweExplorerApiRegister.getMvsApi(uriInfo.profile).dataSet(path.parse(uri.path).name, { attributes: true });
const dsPath = (entry.metadata as DsEntryMetadata).extensionRemovedFromPath();
resp = await ZoweExplorerApiRegister.getMvsApi(uriInfo.profile).dataSet(path.posix.basename(dsPath), {
attributes: true,
});
}
} catch (err) {
if (err instanceof Error) {
Expand Down