Skip to content
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

[BUG] Unintuitive output of install_cluster_tools/uninstall_cluster_tools within the context of spec tests. #1926

Closed
svteb opened this issue Mar 11, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@svteb
Copy link
Collaborator

svteb commented Mar 11, 2024

Describe the bug
While running the spec tests with LOG_LEVEL=info the cluster_setup_spec.cr tests have quite the jarring output, printing out a caught exception, this output comes from the ./cnf-testsuite install_cluster_tools/uninstall_cluster tools command that is called as part of the tests. Without reading and understanding the code, one might assume that the test is somehow failing.

desc "Install CNF Test Suite Cluster Tools"
task "install_cluster_tools" do |_, args|
  Log.info { "install_cluster_tools" }
  begin
    ClusterTools.install
  rescue e : ClusterTools::NamespaceDoesNotExistException 
    raise "#{e.message}. please run cnf-testsuite setup!"          # <-- offending line
  end
end

To Reproduce

  1. export LOG_LEVEL=info
  2. crystal spec ./spec/cluster_setup_spec.cr
  3. Observe the output.

Expected behavior
It is hard to say what the best code practice here is, but I believe that printing out the exception is quite unnecessary and misleading (especially in the context of spec tests), considering it is followed by the remediation: "please run cnf-testsuite setup!". I am unsure if removing the #{e.message}. part could be detrimental elsewhere, if anyone has better ideas (or thinks this is completely irrelevant 😄) please comment.

Jarring spec test output
image

@svteb svteb added the bug Something isn't working label Mar 11, 2024
@macaktom
Copy link
Contributor

Good catch, I looked into it and think that we should remove #{e.message} from that line and if stack trace is needed, then we could just use Log.debug {"#{e.message}"} to print that for debugging purposes.

svteb added a commit to svteb/testsuite that referenced this issue May 24, 2024
Refs: cnti-testcatalog#1926
- The unnecessary stack trace was not printed through e.message as I suspected
but due to raise itself. That is why I instead used puts to print out the informative
message and the e.message remained in the form of an info log.
- I also made the informative message more explicit as someone not used to the testsuite
might not have understood it.

Signed-off-by: svteb <slavo.valko@tietoevry.com>
svteb added a commit to svteb/testsuite that referenced this issue May 27, 2024
Refs: cnti-testcatalog#1926

Signed-off-by: svteb <slavo.valko@tietoevry.com>
svteb added a commit to svteb/testsuite that referenced this issue Jun 11, 2024
… for new output

Refs: cnti-testcatalog#1926

Signed-off-by: svteb <slavo.valko@tietoevry.com>
svteb added a commit to svteb/testsuite that referenced this issue Jun 20, 2024
… Log.error

Refs: cnti-testcatalog#1926

Signed-off-by: svteb <slavo.valko@tietoevry.com>
svteb added a commit to svteb/testsuite that referenced this issue Jun 26, 2024
Refs: cnti-testcatalog#1926
- The unnecessary stack trace was not printed through e.message as I suspected
but due to raise itself. That is why I instead used puts to print out the informative
message and the e.message remained in the form of an info log.
- I also made the informative message more explicit as someone not used to the testsuite
might not have understood it.

Signed-off-by: svteb <slavo.valko@tietoevry.com>
svteb added a commit to svteb/testsuite that referenced this issue Jun 26, 2024
Refs: cnti-testcatalog#1926

Signed-off-by: svteb <slavo.valko@tietoevry.com>
svteb added a commit to svteb/testsuite that referenced this issue Jun 26, 2024
… for new output

Refs: cnti-testcatalog#1926

Signed-off-by: svteb <slavo.valko@tietoevry.com>
svteb added a commit to svteb/testsuite that referenced this issue Jun 26, 2024
… Log.error

Refs: cnti-testcatalog#1926

Signed-off-by: svteb <slavo.valko@tietoevry.com>
martin-mat pushed a commit that referenced this issue Jul 2, 2024
* Change: Cluster setup exception message shortened
Refs: #1926
- The unnecessary stack trace was not printed through e.message as I suspected
but due to raise itself. That is why I instead used puts to print out the informative
message and the e.message remained in the form of an info log.
- I also made the informative message more explicit as someone not used to the testsuite
might not have understood it.

Signed-off-by: svteb <slavo.valko@tietoevry.com>

* fix: Remediation message made less explicit
Refs: #1926

Signed-off-by: svteb <slavo.valko@tietoevry.com>

* Fix: Task fails with proper exit code and the spec tests are adjusted for new output
Refs: #1926

Signed-off-by: svteb <slavo.valko@tietoevry.com>

* Style: Shortened spec test result checking and updated log message to Log.error
Refs: #1926

Signed-off-by: svteb <slavo.valko@tietoevry.com>

---------

Signed-off-by: svteb <slavo.valko@tietoevry.com>
@svteb svteb closed this as completed Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants