Add Base Commerce Command#384
Conversation
Codecov Report
@@ Coverage Diff @@
## main #384 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 50 52 +2
Lines 1217 1258 +41
Branches 148 151 +3
=========================================
+ Hits 1217 1258 +41
Continue to review full report at Codecov.
|
|
@thoughtassassin I understand the idea of adding this base command in a PR separate from the implementation of commands that actually use it, but the downside of this is that it isn't tested. Would it be possible to add a unit test that exercises this class? That test could, I suppose, be temporary and removed later. |
|
|
||
| while (result.status === 'RUNNING' || result.status === 'CREATING') { | ||
| await cli.wait(pollingInterval) | ||
| result = await this.callGet(sdk, programId, environmentId, commandId, true) |
There was a problem hiding this comment.
Same comment as above -- presumably this can throw an error. Although in this context, it's a bit stranger since the action wouldn't be stopped. I'm not sure what happens in that case.
There was a problem hiding this comment.
Yes. Will be caught in subclass.
There was a problem hiding this comment.
Summarizing my comments:
- Should have a unit test (that this PR didn't impact coverage is a oddity that I'll need to investigate separately)
- Missing error handling
- Please revisit start/stop pairing
Also, please follow the contributing guide and squash your commits.
Would it be okay if I just submit the code with the command that implements it? I have the test written for that already. Also, you'll be able to see how the error handling works. |
Yes, this is totally fine. |
610eaf5 to
569894d
Compare
569894d to
e022727
Compare
| const { cli } = require('cli-ux') | ||
| const commonFlags = require('../../../../../common-flags') | ||
|
|
||
| class MaintenanceStatusCommand extends BaseCommerceCommand { |
There was a problem hiding this comment.
Obviously not for now, but something to consider in the future is some kind of dynamic generation of these classes since I expect future commands will be very boilerplatey. oclif/oclif#110 suggests there's a way to do this.
also adding base infrastucture for future commands
e022727 to
1c50f89
Compare
…adobe#384 Log warning that commerce CLI commands in general are not fully functional
|
@thoughtassassin I was doing one last manual test and got (the expected) error about the sdk methods not being there. As such, I think there should be a warning which I've added in 7141df7 Also made two other tweaks:
Please let me know if you're OK with these changes and I'll squash and merge. |
|
@justinedelson I am good with the changes. Please proceed. |
…#384 Log warning that commerce CLI commands in general are not fully functional Also includes some base infrastructure for future commands
# [2.2.0](2.1.0...2.2.0) (2021-07-16) ### Features * **commerce:** add initial commerce maintenance:status command. fixes [#384](#384) ([1a5b97b](1a5b97b))
|
🎉 This issue has been resolved in version 2.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
This will add the base class for all Commerce commands. The class encapsulates the logic of calling the POST endpoint to initiate the command and then poll the get endpoint while the command is running.
Related Issue
#383
Motivation and Context
Commerce CLI commands need to be integrated into the Cloud Manager Plugin as the Cloud Manager API will soon have commands for running CLI commands on Cloud Manager hosted Commerce programs.
How Has This Been Tested?
I have added the simplest command maintenance:status in my development environment that extends this base class. I wrote unit tests that match the unit tests in the app. All of the unit tests pass.
Screenshots (if appropriate):
Types of changes
Checklist: