IBM-Cloud / ibm-developer-extension-vscode

Extension for VS Code editor to enable IBM Cloud CLI capabilities from within the editing environment.
https://marketplace.visualstudio.com/items?itemName=IBM.ibm-developer
Apache License 2.0
13 stars 10 forks source link

feat: Added additional resource commands #48

Closed Aerex closed 2 years ago

Aerex commented 2 years ago

Context

This PR will add a few new VSCode commands from the resource namespace in the IBM Cloud CLI. The following commands will be added:

Callouts

Steps to Test

Run integration tests

  1. Generate API key from IBM Cloud
  2. Set and export the IBMCLOUD_API_KEY environment variable to the key generated in step 1
  3. Login into IBM Cloud using CLI
  4. Change directory to the root of your local ibm-developer-vscode repo
  5. Run the command npm test
  6. Verify that all tests pass

Test service-bindings command

  1. Make sure to follow the steps in the Setup section in previous PRs
  2. Open the Command Palette
    • To enter Command Palette press Ctrl+Shift+P or F1 or navigate to View-> Command Palette
  3. Type and enter in ibmcloud login --sso in the Command Palette
  4. Follow the instructions to login into IBM Cloud
  5. Repeat step 2 (command palette)
  6. Enter the command: ibmcloud iam service-bindings
  7. Verify that the command ibmcloud --cf target is printed in the Output Channel
    • Since service-bindings is a cf command, the extension will try to target the account to cf it is not currently
  8. Verify that an input box is shown to specify the service alias
    • There is a concurrency when using the terminal to target cf and fetching a list of service-aliases. So an input box is shown
  9. Enter in a valid service-alias
  10. Verify that a list of service-bindings is printed in the Output Channel
  11. Repeat steps 6-10 except...
    • Verify that step 7-8 does not occur
    • Verify that a dropdown list is shown in the Command Palette with a list of service-aliases to choose from
    • Type or select the service-alias from the dropdown list

Test service-binding command

  1. Make sure to follow the steps 1-4 in Test resource service-bindings section
  2. Open the Command Palette
  3. Type and enter the command: ibmcloud resource service-binding
  4. Verify that the dropdown from step 11 is shown
  5. Type or select the service-alias from the dropdown list
  6. Verify that a input box is show to specify the cloud foundry app.
    • Due to the limitations of the CLI the user will need to enter the name of the app manually
  7. Enter a valid cloud foundry app name bound to the service
  8. Verify that the details of the service-binding is printed in the Output Channel

Test service-aliases command

  1. Make sure to follow the steps 1-4 in Test resource service-bindings section
  2. Open the Command Palette
  3. Type and enter the command: ibmcloud resource service-aliases
  4. Verify that a list of service-aliases are printed in the Output Channel

Test service-alias command

  1. Make sure to follow the steps 1-4 in Test resource service-bindings section
  2. Open the Command Palette
  3. Type and enter the command: ibmcloud resource service-alias
  4. Verify that a dropdown list with a list of service aliases to choose from
  5. Type or select the service alias from the list
  6. Verify that the details of the service alias selected in step 5 is printed in the Output Channel

Test warning message for no service-alias

  1. Open the terminal from VSCode
  2. Change the target of the account to a space or org with no service alias
  3. Open the Command Palette
  4. Enter the command ibmcloud resource service-bindings or ibmcloud resource service-bindings
  5. Verify that the warning message No service alias could be found. Please create a service alias and try again

Videos

resource service-bindings vscode_resource_service_bindings

resource service-binding vscode_resource_service_binding

resource service-aliases vscode_resource_service_aliases

resource service-alias vscode_resource_service_alias

Warning popup message when no service aliases (service-binding/service-bindings commands only) vscode_no_service_aliases

steveclay commented 2 years ago

Warning message is good but seems a little hidden, but I suppose this is what VS Code offers.