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

test(clouddriver): Test Suite Refinement: MonitoredDeployTask and getRetrofitLogMessage() Behaviour #4617

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Jan 2, 2024

  1. test(clouddriver): Add tests to verify the failure cases of Montiored…

    …DeployTask and 'getRetrofitLogMessage()'
    
    This commit sets the stage for forthcoming changes currently in progress under PR : spinnaker#4614 . The primary goal is to compare the behaviour before and after enhancements by introducing test cases for the ‘MonitoredDeployTask’ and the ‘getRetrofitLogMessage()’ method.
    
    For ‘MonitoredDeployTask’:
    - Test Case to simulate networkError and observe behaviour
    - Test Case to simulate httpError and observe behaviour
    - Test Case to simulate unexpectedError and observe behaviour
    - Test Case to simulate conversionError and observe behaviour
    
    For ‘getRetrofitLogMessage()’:
    - Test Cases to verify behaviour during HTTP error details parsing when exceptions occur
    
    Additionally, a Mockito dependency ('org.mockito:mockito-inline') has been added to support spying/mocking on the final class 'retrofit.client.Response'. This resolves the issue encountered during testing where Mockito couldn't mock/spy the final class, preventing the following error:  org.mockito.exceptions.base.MockitoException:
    Cannot mock/spy class retrofit.client.Response
    Mockito cannot mock/spy because :
     - final class
    	at com.netflix.spinnaker.orca.clouddriver.tasks.monitoreddeploy.MonitoredDeployBaseTaskTest.shouldReturnOnlyStatusWhenExceptionThrownWhileParsingHttpErrorBody(MonitoredDeployBaseTaskTest.java:217)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
    	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
    	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:131)
    Pranav-b-7 committed Jan 2, 2024
    Configuration menu
    Copy the full SHA
    43964ce View commit details
    Browse the repository at this point in the history