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

Update vNext version of SDKs to 8.0.0-next.202403041352 #2754

Merged
merged 14 commits into from
Mar 13, 2024
Merged
1 change: 1 addition & 0 deletions packages/zowe-explorer-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t
- Fixed issue where `zosmf` profiles did not respect the `protocol` property. [#2703](https://github.com/zowe/vscode-extension-for-zowe/issues/2703)
- **Breaking:** ProfilesCache.getProfileInfo no longer accepts any parameters. [#2744](https://github.com/zowe/vscode-extension-for-zowe/pull/2744)
- Fix to restore accessibility to all profiles when default profile has APIML token authentication. [#2111](https://github.com/zowe/vscode-extension-for-zowe/issues/2111)
- Updated the SDK dependencies to `8.0.0-next.202403041352` for technical currency [#2754](https://github.com/zowe/vscode-extension-for-zowe/pull/2754).

## `3.0.0-next.202402142205`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,11 @@

import * as path from "path";
import * as fs from "fs";
import { getZoweDir } from "@zowe/core-for-zowe-sdk";
import * as imperative from "@zowe/imperative";
import { ProfilesCache } from "../../../src/profiles/ProfilesCache";
import { FileManagement, ZoweExplorerApi } from "../../../src";

jest.mock("fs");
jest.mock("@zowe/core-for-zowe-sdk", () => {
/* eslint-disable @typescript-eslint/no-unsafe-return */
return {
...jest.requireActual("@zowe/core-for-zowe-sdk"),
getZoweDir: jest.fn().mockReturnValue("~/.zowe"),
};
});

const fakeSchema: { properties: object } = {
properties: {
Expand Down Expand Up @@ -129,16 +121,17 @@ function createProfInfoMock(profiles: Partial<imperative.IProfileLoaded>[]): imp
knownArgs: Object.entries(profile.profile as object).map(([k, v]) => ({ argName: k, argValue: v as unknown })),
};
},
usingTeamConfig: true,
getTeamConfig: () => ({ exists: true }),
updateProperty: jest.fn(),
updateKnownProperty: jest.fn(),
isSecured: jest.fn(),
getZoweDir: jest.fn().mockReturnValue("~/.zowe"),
} as any;
}

describe("ProfilesCache", () => {
const fakeLogger = { debug: jest.fn() };
const fakeZoweDir = getZoweDir();
const fakeZoweDir = "~/.zowe";
const readProfilesFromDiskSpy = jest.spyOn(imperative.ProfileInfo.prototype, "readProfilesFromDisk");
const defaultCredMgrWithKeytarSpy = jest.spyOn(imperative.ProfileCredentials, "defaultCredMgrWithKeytar");

Expand Down
18 changes: 9 additions & 9 deletions packages/zowe-explorer-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
},
"dependencies": {
"@types/vscode": "^1.53.2",
"@zowe/core-for-zowe-sdk": "8.0.0-next.202402261705",
"@zowe/imperative": "8.0.0-next.202402261705",
"@zowe/secrets-for-zowe-sdk": "8.0.0-next.202402221834",
"@zowe/zos-console-for-zowe-sdk": "8.0.0-next.202402261705",
"@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202402261705",
"@zowe/zos-jobs-for-zowe-sdk": "8.0.0-next.202402261705",
"@zowe/zos-tso-for-zowe-sdk": "8.0.0-next.202402261705",
"@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202402261705",
"@zowe/zosmf-for-zowe-sdk": "8.0.0-next.202402261705",
"@zowe/core-for-zowe-sdk": "8.0.0-next.202403041352",
"@zowe/imperative": "8.0.0-next.202403041352",
"@zowe/secrets-for-zowe-sdk": "8.0.0-next.202403041352",
"@zowe/zos-console-for-zowe-sdk": "8.0.0-next.202403041352",
"@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202403041352",
"@zowe/zos-jobs-for-zowe-sdk": "8.0.0-next.202403041352",
"@zowe/zos-tso-for-zowe-sdk": "8.0.0-next.202403041352",
"@zowe/zos-uss-for-zowe-sdk": "8.0.0-next.202403041352",
"@zowe/zosmf-for-zowe-sdk": "8.0.0-next.202403041352",
"handlebars": "^4.7.7",
"semver": "^7.5.3"
},
Expand Down
5 changes: 2 additions & 3 deletions packages/zowe-explorer-api/src/profiles/ProfilesCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,9 @@ export class ProfilesCache {
public async refresh(apiRegister?: extend.IRegisterClient): Promise<void> {
this.allProfiles = [];
this.allTypes = [];
let mProfileInfo: imperative.ProfileInfo;
try {
mProfileInfo = await this.getProfileInfo();
if (!mProfileInfo.usingTeamConfig) {
const mProfileInfo = await this.getProfileInfo();
if (!mProfileInfo.getTeamConfig().exists) {
return;
}
const allTypes = this.getAllProfileTypes(apiRegister?.registeredApiTypes() ?? []);
Expand Down
14 changes: 7 additions & 7 deletions packages/zowe-explorer-api/src/utils/FileManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
*
*/

import { getZoweDir } from "@zowe/core-for-zowe-sdk";
import * as fs from "fs";
import * as os from "os";
import { ProfileInfo } from "@zowe/imperative";
import { realpathSync } from "fs";
import { platform } from "os";
zFernand0 marked this conversation as resolved.
Show resolved Hide resolved
import { Constants } from "../globals";

export class FileManagement {
Expand All @@ -34,17 +34,17 @@
}

public static getZoweDir(): string {
return getZoweDir();
return ProfileInfo.getZoweDir();
}

public static getFullPath(anyPath: string): string {
if (os.platform() === "win32") {
if (platform() === "win32") {
try {
return fs.realpathSync.native(anyPath);
return realpathSync.native(anyPath);

Check warning on line 43 in packages/zowe-explorer-api/src/utils/FileManagement.ts

View check run for this annotation

Codecov / codecov/patch

packages/zowe-explorer-api/src/utils/FileManagement.ts#L43

Added line #L43 was not covered by tests
} catch (err) {
// Fallback to realpathSync below
}
}
return fs.realpathSync(anyPath);
return realpathSync(anyPath);
}
}
4 changes: 2 additions & 2 deletions packages/zowe-explorer-ftp-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ All notable changes to the "zowe-explorer-ftp-extension" extension will be docum

### Bug fixes

- Updated the SDK dependencies to `8.0.0-next.202403041352` for technical currency [#2754](https://github.com/zowe/vscode-extension-for-zowe/pull/2754).

## `3.0.0-next.202403051607`

### New features and enhancements
Expand All @@ -16,8 +18,6 @@ All notable changes to the "zowe-explorer-ftp-extension" extension will be docum

## `3.0.0-next.202402142205`

### New features and enhancements

### Bug fixes

- Fix Windows-specific hangs when saving members that contain JCL via the FTP extension. Thanks @tiantn & @std4lqi. [#2533](https://github.com/zowe/vscode-extension-for-zowe/issues/2533)
Expand Down
4 changes: 2 additions & 2 deletions packages/zowe-explorer-ftp-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
"vscode": "^1.79.0"
},
"dependencies": {
"@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202402261705",
"@zowe/zos-files-for-zowe-sdk": "8.0.0-next.202403041352",
"@zowe/zos-ftp-for-zowe-cli": "2.1.8",
"@zowe/zos-jobs-for-zowe-sdk": "8.0.0-next.202402261705",
"@zowe/zos-jobs-for-zowe-sdk": "8.0.0-next.202403041352",
"@zowe/zowe-explorer-api": "3.0.0-next-SNAPSHOT",
"tmp": "0.2.1"
},
Expand Down
1 change: 1 addition & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen

- Fixed default behavior of "Create a new Team Configuration File" to create a Project Config instead of Project User Config. [#2684](https://github.com/zowe/vscode-extension-for-zowe/issues/2684)
- Adjusted order of 'Manage Profile' and 'Edit History' in the jobs tree's context menu to match the other trees. [#2670](https://github.com/zowe/vscode-extension-for-zowe/issues/2670)
- Updated the SDK dependencies to `8.0.0-next.202403041352` for technical currency [#2754](https://github.com/zowe/vscode-extension-for-zowe/pull/2754).

## `3.0.0-next.202402142205`

Expand Down
14 changes: 0 additions & 14 deletions packages/zowe-explorer/__mocks__/@zowe/core-for-zowe-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,8 @@
*
*/

import * as os from "os";
import * as path from "path";
import * as imperative from "@zowe/imperative";

export function getZoweDir(): string {
const defaultHome = path.join(os.homedir(), ".zowe");
if (imperative.ImperativeConfig.instance.loadedConfig?.defaultHome !== defaultHome) {
imperative.ImperativeConfig.instance.loadedConfig = {
name: "zowe",
defaultHome,
envVariablePrefix: "ZOWE",
};
}
return imperative.ImperativeConfig.instance.cliHome;
}

export namespace Login {
export function apimlLogin(session: imperative.Session) {
return "APIMLToken";
Expand Down
15 changes: 15 additions & 0 deletions packages/zowe-explorer/__mocks__/@zowe/imperative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* This interface defines the options that can be sent into the download data set function
*/

import * as os from "os";
import * as path from "path";
const log4js = require("log4js");

/**
Expand Down Expand Up @@ -241,6 +243,7 @@ export class CliProfileManager {
}

export class ProfileInfo {
public static onlyV1ProfilesExist = false;
constructor(appName: string, profInfoOpts?: IProfOpts) {}

public readProfilesFromDisk(teamCfgOpts?: IConfigOpts) {
Expand All @@ -257,6 +260,18 @@ export class ProfileInfo {
): any {
return;
}

public static getZoweDir(): string {
const defaultHome = path.join(os.homedir(), ".zowe");
if (ImperativeConfig.instance.loadedConfig?.defaultHome !== defaultHome) {
ImperativeConfig.instance.loadedConfig = {
name: "zowe",
defaultHome,
envVariablePrefix: "ZOWE",
};
}
return ImperativeConfig.instance.cliHome;
}
}

export class ImperativeError extends Error {
Expand Down
4 changes: 2 additions & 2 deletions packages/zowe-explorer/__mocks__/mockCreators/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,8 @@ export function createInstanceOfProfileInfo() {
],
updateProperty: jest.fn(),
updateKnownProperty: jest.fn(),
getTeamConfig: jest.fn(),
createSession: jest.fn(),
usingTeamConfig: true,
getTeamConfig: () => ({ exists: true }),
mergeArgsForProfile: jest.fn().mockReturnValue({
knownArgs: [
{
Expand All @@ -431,6 +430,7 @@ export function createInstanceOfProfileInfo() {
loadSecureArg: jest.fn(),
initSessCfg: jest.fn(),
getOsLocInfo: jest.fn(),
getZoweDir: jest.fn(),
} as any;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ describe("Profiles Unit Tests - Function createZoweSchema", () => {
};
newMocks.testDatasetSessionNode = createDatasetSessionNode(newMocks.session, globalMocks.mockProfileInstance);
newMocks.testDatasetTree = createDatasetTree(newMocks.testDatasetSessionNode, newMocks.treeView);
Object.defineProperty(core, "getZoweDir", {
Object.defineProperty(imperative.ProfileInfo, "getZoweDir", {
value: jest.fn().mockReturnValue("file://globalPath/.zowe"),
configurable: true,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@
*/

jest.mock("fs");
jest.unmock("@zowe/core-for-zowe-sdk");
jest.unmock("@zowe/imperative");

import { getZoweDir } from "@zowe/core-for-zowe-sdk";
import { imperative, ProfilesCache } from "@zowe/zowe-explorer-api";

describe("ProfilesCache API", () => {
const zoweDir = getZoweDir();
const zoweDir = imperative.ProfileInfo.getZoweDir();

beforeAll(() => {
// Disable loading credential manager in ProfileInfo API
Expand Down
11 changes: 7 additions & 4 deletions packages/zowe-explorer/__tests__/__unit__/extension.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ import * as globals from "../../src/globals";
import * as tempFolderUtils from "../../src/utils/TempFolder";
import * as zosfiles from "@zowe/zos-files-for-zowe-sdk";
import * as zosmf from "@zowe/zosmf-for-zowe-sdk";
import { imperative, Gui, Validation, ProfilesCache } from "@zowe/zowe-explorer-api";
import { imperative, Gui, Validation, ProfilesCache, FileManagement } from "@zowe/zowe-explorer-api";
import { Profiles } from "../../src/Profiles";
import { ZoweDatasetNode } from "../../src/dataset/ZoweDatasetNode";
import { createGetConfigMock, createInstanceOfProfileInfo, createIProfile, createTreeView } from "../../__mocks__/mockCreators/shared";
import { ZoweUSSNode } from "../../src/uss/ZoweUSSNode";
import { getSelectedNodeList } from "../../src/shared/utils";
import { SettingsConfig } from "../../src/utils/SettingsConfig";
import { ZoweExplorerExtender } from "../../src/ZoweExplorerExtender";
import { DatasetTree } from "../../src/dataset/DatasetTree";
Expand Down Expand Up @@ -92,6 +91,7 @@ async function createGlobalMocks() {
mCredentials: {},
mUSingTeamConfig: true,
readProfilesFromDisk: mockReadProfilesFromDisk,
getZoweDir: jest.fn(),
};
}),
mockUpdateCredMgrSetting: jest.fn(),
Expand Down Expand Up @@ -375,7 +375,7 @@ async function createGlobalMocks() {
});
Object.defineProperty(ZoweExplorerExtender, "showZoweConfigError", { value: jest.fn(), configurable: true });
Object.defineProperty(imperative, "ProfileInfo", {
value: globalMocks.mockImperativeProfileInfo,
get: globalMocks.mockImperativeProfileInfo,
configurable: true,
});

Expand Down Expand Up @@ -456,7 +456,7 @@ describe("Extension Unit Tests", () => {
globalMocks = await createGlobalMocks();
jest.spyOn(fs, "readFileSync").mockReturnValue(Buffer.from(JSON.stringify({ overrides: { credentialManager: "@zowe/cli" } }), "utf-8"));
Object.defineProperty(imperative, "ProfileInfo", {
value: globalMocks.mockImperativeProfileInfo,
get: globalMocks.mockImperativeProfileInfo,
configurable: true,
});
globalMocks.mockReadFileSync.mockReturnValueOnce('{ "overrides": { "CredentialManager": "Managed by ANO" }}');
Expand Down Expand Up @@ -495,6 +495,9 @@ describe("Extension Unit Tests", () => {
});

it("Tests that activate() fails when trying to load with an invalid config", async () => {
// Mock the FileManagement.getZoweDir to avoid calling the static method: ProfileInfo.getZoweDir()
jest.spyOn(FileManagement, "getZoweDir").mockImplementation();

Object.defineProperty(imperative, "ProfileInfo", {
value: jest.fn().mockImplementation(() => {
throw new Error("Error in ProfileInfo to break activate function");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { ZoweSaveQueue } from "../../../src/abstract/ZoweSaveQueue";
import { ZoweExplorerApiRegister } from "../../../src/ZoweExplorerApiRegister";
import * as HistoryView from "../../../src/shared/HistoryView";
import { LocalFileManagement } from "../../../src/utils/LocalFileManagement";
import { FileManagement } from "@zowe/zowe-explorer-api";

jest.mock("../../../src/utils/LoggerUtils");
jest.mock("../../../src/utils/ZoweLogger");
Expand Down Expand Up @@ -115,6 +116,7 @@ describe("Test src/shared/extension", () => {
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_TEMP_FOLDER_PATH], ret: false },
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_AUTOMATIC_PROFILE_VALIDATION], ret: false },
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_TEMP_FOLDER_HIDE], ret: true },
{ spy: jest.spyOn(FileManagement, "getZoweDir"), arg: [], ret: test.value },
{ spy: jest.spyOn(tempFolder, "hideTempFolder"), arg: [test.value] },
{ spy: jest.spyOn(test.value, "affectsConfiguration"), arg: [globals.SETTINGS_SECURE_CREDENTIALS_ENABLED], ret: false },
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe("ProfileManagement unit tests", () => {
mockHideProfChosen: ProfileManagement.hideProfileQpItems[ProfileManagement.AuthQpLabels.hide],
mockEnableValidationChosen: ProfileManagement.enableProfileValildationQpItem[ProfileManagement.AuthQpLabels.enable],
mockDisableValidationChosen: ProfileManagement.disableProfileValildationQpItem[ProfileManagement.AuthQpLabels.disable],
mockProfileInfo: { usingTeamConfig: true },
mockProfileInfo: { getTeamConfig: () => ({ exists: true }) },
mockProfileInstance: null as any,
mockTreeProviders: sharedMock.createTreeProviders(),
debugLogSpy: null as any,
Expand Down
Loading
Loading