epam / hub-extensions

Hub CLI extensions
Mozilla Public License 2.0
0 stars 2 forks source link

Unit test for ask tool stucks #96

Closed TheRealSpaceShip closed 1 year ago

TheRealSpaceShip commented 1 year ago

This test has two issues:

First, a simple, wrong directory is used for helpers. This leads to this error:

 ./tests/bats/bin/bats ./tests/ask.bats
ask.bats
 ✗ ask contains -e: should error code without correct parameter
   (from function `setup' in test file tests/ask.bats, line 26)
     `setup() {' failed
   bats_load_safe: Could not find '/home/igor_lysak/hub-extensions/tests/test_helper/bats-support/load'[.bash]
 ✗ ask env: should print messages if parameters need to set for different component discriminators
   (from function `setup' in test file tests/ask.bats, line 26)
     `setup() {' failed
   bats_load_safe: Could not find '/home/igor_lysak/hub-extensions/tests/test_helper/bats-support/load'[.bash]
 ✗ ask env: should success if env exist
   (from function `setup' in test file tests/ask.bats, line 26)
     `setup() {' failed
   bats_load_safe: Could not find '/home/igor_lysak/hub-extensions/tests/test_helper/bats-support/load'[.bash]
 ✗ ask env: should print messages if parameters already set for different component discriminators
   (from function `setup' in test file tests/ask.bats, line 26)
     `setup() {' failed
   bats_load_safe: Could not find '/home/igor_lysak/hub-extensions/tests/test_helper/bats-support/load'[.bash]
 ✗ ask env: should print messages if parameter need to set without different component discriminators
   (from function `setup' in test file tests/ask.bats, line 26)
     `setup() {' failed
   bats_load_safe: Could not find '/home/igor_lysak/hub-extensions/tests/test_helper/bats-support/load'[.bash]
 ✗ ask env: should print messages if parameter already set without different component discriminators
 ✗ teardown_file failed                                                                                                                                                                                                                          `setup() {' failed
   bats_load_safe: Could not find '/home/igor_lysak/hub-extensions/tests/test_helper/bats-support/load'[.bash]
   (from function `teardown_file' in test file tests/ask.bats, line 90)
     `rm .env .ask.env' failed
   removed '.ask.env'
   removed 'ask.params-component.yaml'
   rm: cannot remove '.env': No such file or directory
   rm: cannot remove '.ask.env': No such file or directory

Second. After fixing the name of helpers directory test was stuck on the second test case.

 ./tests/bats/bin/bats ./tests/ask.bats
ask.bats
 ✓ ask contains -e: should error code without correct parameter
   ask env: should print messages if parameters need to set for different component discriminators  
NellyHargeliya commented 1 year ago

Create PR: https://github.com/epam/hub-extensions/pull/98

akranga commented 1 year ago

@NellyHargeliya please be advised: rm "$HUB_FILES" "$DOTENV_FILE" will not delete "$HUB_FILES" if more than one, because of "". There is no needs, then shellfcheck can be disabled for this as well