Skip to content

CLOUDSTACK-8656: tests ignoring exceptions#850

Merged
asfgit merged 1 commit into
apache:masterfrom
DaanHoogland:CLOUDSTACK-8656
Dec 6, 2015
Merged

CLOUDSTACK-8656: tests ignoring exceptions#850
asfgit merged 1 commit into
apache:masterfrom
DaanHoogland:CLOUDSTACK-8656

Conversation

@DaanHoogland
Copy link
Copy Markdown
Contributor

final few ignored exceptions supplied with log messages.

@asfbot
Copy link
Copy Markdown

asfbot commented Sep 18, 2015

cloudstack-pull-rats #654 SUCCESS
This pull request looks good

@asfbot
Copy link
Copy Markdown

asfbot commented Sep 18, 2015

cloudstack-pull-analysis #603 SUCCESS
This pull request looks good

@koushik-das
Copy link
Copy Markdown
Contributor

LGTM

@borisroman
Copy link
Copy Markdown
Contributor

@DaanHoogland Why log when an exception is thrown? In a test when an exception is thrown it should either fail, or when @test(expected = --exception.class--) is defined succeed.

Right?

@DaanHoogland
Copy link
Copy Markdown
Contributor Author

@borisroman the expeted attribute is not there and as I understand with reason. The exceptions are part of the contract and need to be handled by the client. The test needs to verify the result irrespectively. @koushik-das Do I formulate this correct?

@koushik-das
Copy link
Copy Markdown
Contributor

@DaanHoogland @borisroman The test needs to invoke a protected method from a class and so is done using reflection. The test case already asserts for the method not being null. Now reflection methods throws some standard exceptions which either needs to be handled or thrown as per Java method contract. Since the null check is already there, the exceptions can be safely ignored.

@ustcweizhou
Copy link
Copy Markdown
Contributor

LGTM

@rafaelweingartner
Copy link
Copy Markdown
Member

Do you guys really think that is a good idea to log exceptions in a test case?
If the case is just to ignore them, it could be done without logging.

@DaanHoogland
Copy link
Copy Markdown
Contributor Author

the reason for ignoring should be made more explicit in one way or the other. I'm not hellbound on logging but I see no problem in it. A caught and ignored exception without any action is a bad code snippit I want to be dealt with, even in tests.

@rafaelweingartner
Copy link
Copy Markdown
Member

If an exception occurs, is the test still going to pass?
If that is not the case, I would use "throws Exception" on each one of those tests.

@DaanHoogland
Copy link
Copy Markdown
Contributor Author

not "throws Exception" but a more specific throws. In this case the exceptions are silently ignored as part of a happy flow. I don't like that but I'm not going to waste much more time on it

@rafaelweingartner
Copy link
Copy Markdown
Member

Sure, I think that a more specific “throws” clause has to be used. Throws exception, was just an expression.

@asfgit asfgit merged commit 52037e8 into apache:master Dec 6, 2015
asfgit pushed a commit that referenced this pull request Dec 6, 2015
CLOUDSTACK-8656: tests ignoring exceptionsfinal few ignored exceptions supplied with log messages.

* pr/850:
  CLOUDSTACK-8656: tests ignoring exceptions

Signed-off-by: Daan Hoogland <daan@onecht.net>
yadvr pushed a commit that referenced this pull request Jan 20, 2021
* Adding message to deleteKubernetesSupportedVersion

* Apply suggestions from code review

Co-authored-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

Co-authored-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
JoaoJandre pushed a commit to scclouds/cloudstack that referenced this pull request Nov 24, 2022
…les' into '4.16.0.0-scclouds'

Suporte ao parametro `cidrlist` adicionado à UI de criação de regras de _load balancer_

Closes apache#850

See merge request scclouds/scclouds!357
@DaanHoogland DaanHoogland deleted the CLOUDSTACK-8656 branch August 16, 2023 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants