-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add SDK getCache method #172
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #172 +/- ##
==========================================
+ Coverage 93.62% 93.81% +0.18%
==========================================
Files 74 75 +1
Lines 753 776 +23
Branches 41 45 +4
==========================================
+ Hits 705 728 +23
Misses 48 48 ☔ View full report in Codecov by Sentry. |
f17635b
to
96512f1
Compare
519e608
to
85531d9
Compare
Signed-off-by: Andrew Twydell <[email protected]>
Signed-off-by: Andrew Twydell <[email protected]>
Signed-off-by: Andrew Twydell <[email protected]>
85531d9
to
d3b74e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 😋
For these new set of APIs, (as well as SUMMONLY, NODISCARD, OVERRIDEWARNINGCOUNT), Could we add some system tests?
Depending on people's environment, having system tests might help determine whether the APIs work as expected, or if there are edge cases to consider 😋
We could handle system tests in a follow up PR (for both, cache, and the new query params) if you'd like to get this one merged sooner rather than later 🙏
Update: Created the issue below:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The functionality works great!
I like the pagination use case.
I was playing around, but I could not properly test the OVERRIDEWARNINGCOUNT
queryParm (likely because the DEFAULTWARNCNT
was never specified during the WUI configuration) 😢
I say "Let's keep moving forward" and let's handle the system tests in a separate PR 🙏
For those testing...
Feel free to use this script
/* Save this file as `test.mjs` and run `node test.mjs` */
import { ProfileInfo } from "@zowe/imperative";
import * as sdk from "@zowe/cics-for-zowe-sdk";
(async () => {
const profInfo = new ProfileInfo("zowe");
await profInfo.readProfilesFromDisk();
const profAttrs = profInfo.getDefaultProfile("cics");
const mergedArgs = profInfo.mergeArgsForProfile(profAttrs, { getSecureVals: true });
const session = ProfileInfo.createSession(mergedArgs.knownArgs);
let response;
response = (await sdk.getResource(session, {name: "CICSCSDResource", queryParams: {summonly: true, nodiscard: true}}));
const cacheToken = response.response.resultsummary.cachetoken;
console.log("Cache token: ", cacheToken);
// Use the above cache token and play around with the `startIndex` and `count` values
response = (await sdk.getCache(session, {cacheToken, startIndex:1, count:100})).response.records.cicscsdresource.map(x => x.defname);
console.log(response);
})().catch((err) => {
console.error(err);
process.exit(1);
});
Requires #171 - Merged!
What It Does
Resolves #169
Adds getCache method to the SDK to retrieve a cached result from CMCI using a cache token returned by getResource.
This will allow the VSCE to paginate large result sets using the SDK rather than axios HTTP requests.
Review Checklist
I certify that I have: