Skip to content

Conversation

@Khushboo-Sharma-110597
Copy link
Contributor

@Khushboo-Sharma-110597 Khushboo-Sharma-110597 commented Oct 29, 2025

What It Does
#474

Review Checklist
I certify that I have:

  • tested my changes

  • added/updated automated tests

  • updated the changelog

  • considered whether the docs need updating

  • followed the contribution guidelines

Screenshot 2025-10-30 at 2 56 03 PM

Signed-off-by: Khushboo <[email protected]>
@Khushboo-Sharma-110597 Khushboo-Sharma-110597 force-pushed the navigate-bundle-from-resource-to-USS branch from cb24f53 to fe8e7ae Compare October 29, 2025 05:25
@codecov-commenter
Copy link

codecov-commenter commented Oct 29, 2025

Codecov Report

❌ Patch coverage is 78.37838% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.47%. Comparing base (e94e9ec) to head (01ea643).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/vsce/src/utils/commandUtils.ts 79.03% 13 Missing ⚠️
...es/vsce/src/commands/showBundleDirectoryCommand.ts 76.59% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #473      +/-   ##
==========================================
+ Coverage   68.24%   68.47%   +0.22%     
==========================================
  Files         165      166       +1     
  Lines        3883     3949      +66     
  Branches      549      562      +13     
==========================================
+ Hits         2650     2704      +54     
- Misses       1233     1245      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Khushboo <[email protected]>
Signed-off-by: Khushboo <[email protected]>
Signed-off-by: Khushboo <[email protected]>
Removed a problematic test case that was causing issues.

Signed-off-by: Khushboo Sharma <[email protected]>
@Khushboo-Sharma-110597
Copy link
Contributor Author

I was considering writing an end-to-end test for this, but since the USS tree isn’t part of our extension, I couldn’t find the API calls related to it. I don’t think it’s feasible for us to write an e2e test in this case. From what I observed, they seem to be using environment variables to load data and possibly relying on real test data. Let me know your thoughts.@AndrewTwydell @davenice

@Khushboo-Sharma-110597 Khushboo-Sharma-110597 marked this pull request as ready for review October 31, 2025 06:13
@zowe-robot zowe-robot moved this from In Progress to Review/QA in Zowe Explorer for VS Code Oct 31, 2025
@davenice
Copy link
Contributor

I was considering writing an end-to-end test for this, but since the USS tree isn’t part of our extension, I couldn’t find the API calls related to it. I don’t think it’s feasible for us to write an e2e test in this case. From what I observed, they seem to be using environment variables to load data and possibly relying on real test data. Let me know your thoughts.@AndrewTwydell @davenice

Hi Khushboo, for an e2e test we'd be mocking exactly what happens on the wire, using wiremock.

So we'd look at which URLs were requested from wiremock, and then mock those using httpie or similar to get the date. We'd want to mock the minimum of their REST API that we could get away with!

You could investigate by adding localhost:8080, or wherever your wiremock is listening, as a zosmf connection and seeing which zosmf calls wiremock complains it doesn't have a mock for. You might need to start wiremock in verbose mode to see full details, I can't quite remember!

@Khushboo-Sharma-110597
Copy link
Contributor Author

Khushboo-Sharma-110597 commented Oct 31, 2025

I was considering writing an end-to-end test for this, but since the USS tree isn’t part of our extension, I couldn’t find the API calls related to it. I don’t think it’s feasible for us to write an e2e test in this case. From what I observed, they seem to be using environment variables to load data and possibly relying on real test data. Let me know your thoughts.@AndrewTwydell @davenice

Hi Khushboo, for an e2e test we'd be mocking exactly what happens on the wire, using wiremock.

So we'd look at which URLs were requested from wiremock, and then mock those using httpie or similar to get the date. We'd want to mock the minimum of their REST API that we could get away with!

You could investigate by adding localhost:8080, or wherever your wiremock is listening, as a zosmf connection and seeing which zosmf calls wiremock complains it doesn't have a mock for. You might need to start wiremock in verbose mode to see full details, I can't quite remember!

I can set up a WireMock server for z/OSMF, but adding REST API mappings is challenging because we can’t trace the z/OSMF calls using a TCP/IP debugger—the connection uses HTTPS.

@davenice
Copy link
Contributor

That does make it a bit harder.

I think we could use the same wiremock server.

If you add your wiremock server as a zosmf connection and then try to use it, you will see from the wiremock output which URL was requested and failed. Then you could request the same kind of URL on a real server to see what comes back to put in your mock.

Another option would be to find a way to add some debug to Zowe explorer to output the request before it's made, but this sounds quite a lot of work for what I suspect will only be a few requests to be mocked.

Remember that we don't need a fully working wiremock, we don't even need the whole scenario to work properly. We just want to make sure that the call we make to Zowe explorer triggers zosmf to look for information correctly. This protects us against them changing their API in the future and breaking us.

Copy link
Contributor

@AndrewTwydell AndrewTwydell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and works well! Couple of suggestions 👍🏼

},
{
"command": "cics-extension-for-zowe.showBundleDirectory",
"when": "config.zowe.cics.showAllCommandsInPalette"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we use this feature toggle anymore...

Suggested change
"when": "config.zowe.cics.showAllCommandsInPalette"
"when": "never"

return;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

* @param connectionType - The type of connection to check for ('uss' or 'jes'), case-insensitive
* @returns True if the profile supports the specified connection type, false otherwise
*/
export function doesProfileSupportConnectionType(profile: IProfileLoaded, connectionType: string): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could strongly type this so the developer calling it can ctrl + space to autocomplete - keeps things type safe 😄

Suggested change
export function doesProfileSupportConnectionType(profile: IProfileLoaded, connectionType: string): boolean {
export function doesProfileSupportConnectionType(profile: IProfileLoaded, connectionType: "JES" | "USS"): boolean {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ZE have a ZoweExplorerApiType enum that we could use in @zowe/zowe-explorer-api...

Suggested change
export function doesProfileSupportConnectionType(profile: IProfileLoaded, connectionType: string): boolean {
export function doesProfileSupportConnectionType(profile: IProfileLoaded, connectionType: ZoweExplorerApiType): boolean {

So the method call would be

doesProfileSupportConnectionType(myProfile, ZoweExplorerApiType.Jes);
doesProfileSupportConnectionType(myProfile, ZoweExplorerApiType.Uss);

...

switch (type) {
      case ZoweExplorerApiType.Uss:
        explorerApi.getUssApi(profile);
        break;
...

window.showErrorMessage(`No Bundle is selected from cics tree`);
return;
}
const bundleDir = selectedBundle.getContainedResource().resource.attributes?.bundledir;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contained Resource is optional, but attributes is not

Suggested change
const bundleDir = selectedBundle.getContainedResource().resource.attributes?.bundledir;
const bundleDir = selectedBundle.getContainedResource()?.resource.attributes.bundledir;

}
const bundleDir = selectedBundle.getContainedResource().resource.attributes?.bundledir;
if (!bundleDir) {
window.showErrorMessage(`Could not find bundle directory for ${selectedBundle.getLabel()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
window.showErrorMessage(`Could not find bundle directory for ${selectedBundle.getLabel()
window.showErrorMessage(`Could not find bundle directory for ${selectedBundle.getContainedResourceName()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The label could have other info in that's not necessary here, status info for example

Comment on lines +80 to +83
if (!chosenProfileName) {
window.showErrorMessage("Could not find any profiles that will access USS (for instance z/OSMF).");
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am prompted for a profile because we went into line 78, and I clicked esc to cancel when choosing, I then get this error message which shouldn't be the case. If a user cancels out of an action, it should just exit quietly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Review/QA

Development

Successfully merging this pull request may close these issues.

5 participants