Skip to content

Commit

Permalink
Merge branch 'main' into fix/update-credentials-desync2
Browse files Browse the repository at this point in the history
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
  • Loading branch information
t1m0thyj committed Oct 7, 2024
2 parents 23c7fa1 + 785a7ee commit e5db7df
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen

### Bug fixes

- Fixed an issue where opening sequential data sets within favorited searches resulted in an error. [#3163](https://github.com/zowe/zowe-explorer-vscode/pull/3163)
- Fixed an issue where Zowe Explorer displayed a "No Zowe client configurations" prompt when a project user configuration existed but no global configuration was present. [#3168](https://github.com/zowe/zowe-explorer-vscode/issues/3168)
- Fixed an issue where the `ProfilesUtils.getProfileInfo` function returned a new `ProfileInfo` instance that ignored the `ZOWE_CLI_HOME` environment variable and workspace paths. [#3168](https://github.com/zowe/zowe-explorer-vscode/issues/3168)
- Fixed an issue where a 401 error could occur when opening PDS members after updating credentials within the same user session. [#3150](https://github.com/zowe/zowe-explorer-vscode/issues/3150)

## `3.0.0`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as fs from "fs";
import * as path from "path";
import * as util from "util";
import * as vscode from "vscode";
import { Gui, imperative, ProfilesCache, ZoweVsCodeExtension } from "@zowe/zowe-explorer-api";
import { FileManagement, Gui, imperative, ProfilesCache, ZoweVsCodeExtension } from "@zowe/zowe-explorer-api";
import { createAltTypeIProfile, createInstanceOfProfile, createValidIProfile } from "../../__mocks__/mockCreators/shared";
import { MockedProperty } from "../../__mocks__/mockUtils";
import { Constants } from "../../../src/configuration/Constants";
Expand Down Expand Up @@ -248,6 +248,7 @@ describe("ProfilesUtils unit tests", () => {
value: [
{
uri: {
scheme: "file",
fsPath: "./test",
},
},
Expand Down Expand Up @@ -1314,4 +1315,15 @@ describe("ProfilesUtils unit tests", () => {
onlyV1ProfsExistMock[Symbol.dispose]();
});
});

describe("setupDefaultCredentialManager", () => {
it("calls readProfilesFromDisk with homeDir and projectDir", async () => {
const readProfilesFromDiskMock = jest.spyOn(imperative.ProfileInfo.prototype, "readProfilesFromDisk").mockImplementation();
await ProfilesUtils.setupDefaultCredentialManager();
expect(readProfilesFromDiskMock).toHaveBeenCalledWith({
homeDir: FileManagement.getZoweDir(),
projectDir: vscode.workspace.workspaceFolders?.[0].uri.fsPath,
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ export class ZoweDatasetNode extends ZoweTreeNode implements IZoweDatasetTreeNod
parentNode: this,
encoding: cachedEncoding,
profile: cachedProfile,
contextOverride: cachedEncoding?.kind === "binary" ? Constants.DS_DS_BINARY_CONTEXT : Constants.DS_DS_CONTEXT,
});
elementChildren[dsNode.label.toString()] = dsNode;
} else if (item.member) {
Expand Down
7 changes: 6 additions & 1 deletion packages/zowe-explorer/src/utils/ProfilesUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,13 @@ export class ProfilesUtils {
const profileInfo = new imperative.ProfileInfo("zowe", {
credMgrOverride: defaultCredentialManager,
});

const workspacePath = ZoweVsCodeExtension.workspaceRoot?.uri.fsPath;
// Trigger initialize() function of credential manager to throw an error early if failed to load
await profileInfo.readProfilesFromDisk();
await profileInfo.readProfilesFromDisk({
homeDir: FileManagement.getZoweDir(),
projectDir: workspacePath ? FileManagement.getFullPath(workspacePath) : undefined,
});
return profileInfo;
} catch (err) {
if (err instanceof imperative.ProfInfoErr && err.errorCode === imperative.ProfInfoErr.LOAD_CRED_MGR_FAILED) {
Expand Down

0 comments on commit e5db7df

Please sign in to comment.