-
Notifications
You must be signed in to change notification settings - Fork 805
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(MonitoredDeployBaseTask): add tests to verify log message for different types of RetrofitError #4608
Merged
mergify
merged 1 commit into
spinnaker:master
from
Pranav-b-7:deploymentMonitorService-eliminate-RetrofitError
Dec 7, 2023
Merged
test(MonitoredDeployBaseTask): add tests to verify log message for different types of RetrofitError #4608
mergify
merged 1 commit into
spinnaker:master
from
Pranav-b-7:deploymentMonitorService-eliminate-RetrofitError
Dec 7, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pranav-b-7
changed the title
feat(retrofit): set error handler as SpinnakerRetrofitErrorHandler to simplify the exception handling
refactor(retrofit): set error handler as SpinnakerRetrofitErrorHandler to simplify the exception handling
Nov 22, 2023
Pranav-b-7
force-pushed
the
deploymentMonitorService-eliminate-RetrofitError
branch
from
November 22, 2023 12:54
e342423
to
3375c11
Compare
dbyron-sf
reviewed
Nov 22, 2023
...va/com/netflix/spinnaker/orca/clouddriver/tasks/monitoreddeploy/MonitoredDeployBaseTask.java
Outdated
Show resolved
Hide resolved
dbyron-sf
reviewed
Nov 22, 2023
...va/com/netflix/spinnaker/orca/clouddriver/tasks/monitoreddeploy/MonitoredDeployBaseTask.java
Outdated
Show resolved
Hide resolved
dbyron-sf
reviewed
Nov 22, 2023
...va/com/netflix/spinnaker/orca/clouddriver/tasks/monitoreddeploy/MonitoredDeployBaseTask.java
Outdated
Show resolved
Hide resolved
dbyron-sf
reviewed
Nov 22, 2023
...va/com/netflix/spinnaker/orca/clouddriver/tasks/monitoreddeploy/MonitoredDeployBaseTask.java
Outdated
Show resolved
Hide resolved
dbyron-sf
reviewed
Nov 22, 2023
...va/com/netflix/spinnaker/orca/clouddriver/tasks/monitoreddeploy/MonitoredDeployBaseTask.java
Outdated
Show resolved
Hide resolved
Pranav-b-7
force-pushed
the
deploymentMonitorService-eliminate-RetrofitError
branch
from
November 23, 2023 12:39
3375c11
to
fc85e63
Compare
Pranav-b-7
changed the title
refactor(retrofit): set error handler as SpinnakerRetrofitErrorHandler to simplify the exception handling
refactor(deploymentmonitor): add SpinnakerRetrofitErrorHandler to DeploymentMonitorService
Nov 23, 2023
Pranav-b-7
force-pushed
the
deploymentMonitorService-eliminate-RetrofitError
branch
from
November 23, 2023 13:57
fc85e63
to
4c608ef
Compare
dbyron-sf
reviewed
Nov 23, 2023
...va/com/netflix/spinnaker/orca/clouddriver/tasks/monitoreddeploy/MonitoredDeployBaseTask.java
Outdated
Show resolved
Hide resolved
Pranav-b-7
commented
Nov 24, 2023
...va/com/netflix/spinnaker/orca/clouddriver/tasks/monitoreddeploy/MonitoredDeployBaseTask.java
Outdated
Show resolved
Hide resolved
Pranav-b-7
force-pushed
the
deploymentMonitorService-eliminate-RetrofitError
branch
4 times, most recently
from
November 29, 2023 11:01
c17f0c6
to
6dfb59d
Compare
...lix/spinnaker/orca/clouddriver/tasks/monitoreddeploy/EvaluateDeploymentHealthTaskSpec.groovy
Outdated
Show resolved
Hide resolved
Pranav-b-7
force-pushed
the
deploymentMonitorService-eliminate-RetrofitError
branch
4 times, most recently
from
November 30, 2023 10:19
adce656
to
d5c37dc
Compare
Pranav-b-7
changed the title
refactor(deploymentmonitor): add SpinnakerRetrofitErrorHandler to DeploymentMonitorService
feat(deploymentmonitor): add SpinnakerRetrofitErrorHandler to DeploymentMonitorService
Nov 30, 2023
Pranav-b-7
force-pushed
the
deploymentMonitorService-eliminate-RetrofitError
branch
from
December 1, 2023 12:42
d5c37dc
to
88bf108
Compare
dbyron-sf
force-pushed
the
deploymentMonitorService-eliminate-RetrofitError
branch
from
December 1, 2023 16:49
88bf108
to
46ff1f3
Compare
Pranav-b-7
force-pushed
the
deploymentMonitorService-eliminate-RetrofitError
branch
from
December 4, 2023 04:34
46ff1f3
to
1428839
Compare
Pranav-b-7
force-pushed
the
deploymentMonitorService-eliminate-RetrofitError
branch
from
December 5, 2023 10:30
1428839
to
e51c7c9
Compare
Pranav-b-7
force-pushed
the
deploymentMonitorService-eliminate-RetrofitError
branch
from
December 6, 2023 09:44
962e7ab
to
1a10d02
Compare
dbyron-sf
reviewed
Dec 6, 2023
...om/netflix/spinnaker/orca/clouddriver/tasks/monitoreddeploy/MonitoredDeployBaseTaskTest.java
Outdated
Show resolved
Hide resolved
Pranav-b-7
force-pushed
the
deploymentMonitorService-eliminate-RetrofitError
branch
from
December 7, 2023 06:14
1a10d02
to
6611821
Compare
…fferent types of RetrofitError This commit introduces a set of test cases aimed at showcasing the current behavior of the getRetrofitLogMessage() method when different types of RetrofitErrors, such as HTTP Error, Network Error, Unexpected Error, and Conversion Error, are thrown. The purpose of these test cases is to establish a baseline understanding of the method's behavior in handling various RetrofitError scenarios before the upcoming modifications. These tests will serve as a reference point to compare and validate the behavior of the code after enhancements are made, specifically focusing on eliminating the usage of RetrofitError. These test cases provide valuable insight into the existing behavior of the getRetrofitLogMessage() method and will aid in assessing the effectiveness of subsequent modifications.
Pranav-b-7
force-pushed
the
deploymentMonitorService-eliminate-RetrofitError
branch
from
December 7, 2023 06:23
6611821
to
947cf8b
Compare
dbyron-sf
approved these changes
Dec 7, 2023
Pranav-b-7
added a commit
to Pranav-b-7/orca
that referenced
this pull request
Dec 8, 2023
…for DeploymentMonitorService Update the error handler for the retrofit client, DeploymentMonitorService, to use SpinnakerRetrofitErrorHandler. Additionally, modify catch blocks with RetrofitError to use Spinnaker*Exception. Purpose : This commit is foundational work for upgrading the Retrofit version to retrofit2.x Behavioural change : The modification includes updating catch blocks, leading to a change in the format of logger messages. This aligns with the upcoming modifications discussed in the PR: spinnaker#4608
Pranav-b-7
added a commit
to Pranav-b-7/orca
that referenced
this pull request
Dec 8, 2023
…for DeploymentMonitorService Update the error handler for the retrofit client, DeploymentMonitorService, to use SpinnakerRetrofitErrorHandler. Additionally, modify catch blocks with RetrofitError to use Spinnaker*Exception. Purpose : This commit is foundational work for upgrading the Retrofit version to retrofit2.x Behavioural change : The modification includes updating catch blocks, leading to a change in the format of logger messages. This aligns with the upcoming modifications discussed in the PR: spinnaker#4608
Pranav-b-7
added a commit
to Pranav-b-7/orca
that referenced
this pull request
Dec 11, 2023
…for DeploymentMonitorService Update the error handler for the retrofit client, DeploymentMonitorService, to use SpinnakerRetrofitErrorHandler. Additionally, modify catch blocks with RetrofitError to use Spinnaker*Exception. Purpose : This commit is foundational work for upgrading the Retrofit version to retrofit2.x Behavioural change : The modification includes updating catch blocks, leading to a change in the format of logger messages. This aligns with the upcoming modifications discussed in the PR: spinnaker#4608
Pranav-b-7
added a commit
to Pranav-b-7/orca
that referenced
this pull request
Dec 29, 2023
…for DeploymentMonitorService Update the error handler for the retrofit client, DeploymentMonitorService, to use SpinnakerRetrofitErrorHandler. Additionally, modify catch blocks with RetrofitError to use Spinnaker*Exception. Purpose : This commit is foundational work for upgrading the Retrofit version to retrofit2.x Behavioural change : The modification includes updating catch blocks, leading to a change in the format of logger messages. This aligns with the upcoming modifications discussed in the PR: spinnaker#4608
Pranav-b-7
added a commit
to Pranav-b-7/orca
that referenced
this pull request
Jan 2, 2024
…for DeploymentMonitorService Update the error handler for the retrofit client, DeploymentMonitorService, to use SpinnakerRetrofitErrorHandler. Additionally, modify catch blocks with RetrofitError to use Spinnaker*Exception. Purpose : This commit is foundational work for upgrading the Retrofit version to retrofit2.x Behavioural change : The modification includes updating catch blocks, leading to a change in the format of logger messages. This aligns with the upcoming modifications discussed in the PR: spinnaker#4608
Pranav-b-7
added a commit
to Pranav-b-7/orca
that referenced
this pull request
Jan 2, 2024
…for DeploymentMonitorService Update the error handler for the retrofit client, DeploymentMonitorService, to use SpinnakerRetrofitErrorHandler. Additionally, modify catch blocks with RetrofitError to use Spinnaker*Exception. Purpose : This commit is foundational work for upgrading the Retrofit version to retrofit2.x Behavioural change : The modification includes updating catch blocks, leading to a change in the format of logger messages. This aligns with the upcoming modifications discussed in the PR: spinnaker#4608
Pranav-b-7
added a commit
to Pranav-b-7/orca
that referenced
this pull request
Jan 2, 2024
…for DeploymentMonitorService Update the error handler for the retrofit client, DeploymentMonitorService, to use SpinnakerRetrofitErrorHandler. Additionally, modify catch blocks with RetrofitError to use Spinnaker*Exception. Purpose : This commit is foundational work for upgrading the Retrofit version to retrofit2.x Behavioural change : The modification includes updating catch blocks, leading to a change in the format of logger messages. This aligns with the upcoming modifications discussed in the PR: spinnaker#4608
Pranav-b-7
added a commit
to Pranav-b-7/orca
that referenced
this pull request
Jan 2, 2024
…for DeploymentMonitorService Update the error handler for the retrofit client, DeploymentMonitorService, to use SpinnakerRetrofitErrorHandler. Additionally, modify catch blocks with RetrofitError to use Spinnaker*Exception. Purpose : This commit is foundational work for upgrading the Retrofit version to retrofit2.x Behavioural change : The modification includes updating catch blocks, leading to a change in the format of logger messages. This aligns with the upcoming modifications discussed in the PR: spinnaker#4608 Additionally, a new specific exception handler is introduced to manage JsonProcessing during the serialization of the HTTP error body. The impact of these changes should be compared with another related PR: spinnaker#4617
Pranav-b-7
added a commit
to Pranav-b-7/orca
that referenced
this pull request
Jan 2, 2024
…for DeploymentMonitorService Update the error handler for the retrofit client, DeploymentMonitorService, to use SpinnakerRetrofitErrorHandler. Additionally, modify catch blocks with RetrofitError to use Spinnaker*Exception. Purpose : This commit is foundational work for upgrading the Retrofit version to retrofit2.x Behavioural change : The modification includes updating catch blocks, leading to a change in the format of logger messages. This aligns with the upcoming modifications discussed in the PR: spinnaker#4608 Additionally, a new specific exception handler is introduced to manage JsonProcessing during the serialization of the HTTP error body. The impact of these changes should be compared with another related PR: spinnaker#4617
dbyron-sf
pushed a commit
to Pranav-b-7/orca
that referenced
this pull request
Jan 2, 2024
…for DeploymentMonitorService Update the error handler for the retrofit client, DeploymentMonitorService, to use SpinnakerRetrofitErrorHandler. Additionally, modify catch blocks with RetrofitError to use Spinnaker*Exception. Purpose : This commit is foundational work for upgrading the Retrofit version to retrofit2.x Behavioural change : The modification includes updating catch blocks, leading to a change in the format of logger messages. This aligns with the upcoming modifications discussed in the PR: spinnaker#4608 Additionally, a new specific exception handler is introduced to manage JsonProcessing during the serialization of the HTTP error body. The impact of these changes should be compared with another related PR: spinnaker#4617
Pranav-b-7
added a commit
to Pranav-b-7/orca
that referenced
this pull request
Jan 3, 2024
…for DeploymentMonitorService Update the error handler for the retrofit client, DeploymentMonitorService, to use SpinnakerRetrofitErrorHandler. Additionally, modify catch blocks with RetrofitError to use Spinnaker*Exception. Purpose : This commit is foundational work for upgrading the Retrofit version to retrofit2.x Behavioural change : The modification includes updating catch blocks, leading to a change in the format of logger messages. This aligns with the upcoming modifications discussed in the PR: spinnaker#4608 Additionally, a new specific exception handler is introduced to manage JsonProcessing during the serialization of the HTTP error body. The impact of these changes should be compared with another related PR: spinnaker#4617
Pranav-b-7
added a commit
to Pranav-b-7/orca
that referenced
this pull request
Jan 3, 2024
…for DeploymentMonitorService Update the error handler for the retrofit client, DeploymentMonitorService, to use SpinnakerRetrofitErrorHandler. Additionally, modify catch blocks with RetrofitError to use Spinnaker*Exception. Purpose : This commit is foundational work for upgrading the Retrofit version to retrofit2.x Behavioural change : The modification includes updating catch blocks, leading to a change in the format of logger messages. This aligns with the upcoming modifications discussed in the PR: spinnaker#4608 Additionally, when the error response body is null, an appropriate error message will be printed in the logger.
Pranav-b-7
added a commit
to Pranav-b-7/orca
that referenced
this pull request
Jan 3, 2024
…for DeploymentMonitorService Update the error handler for the retrofit client, DeploymentMonitorService, to use SpinnakerRetrofitErrorHandler. Additionally, modify catch blocks with RetrofitError to use Spinnaker*Exception. Purpose : This commit is foundational work for upgrading the Retrofit version to retrofit2.x Behavioural change : The modification includes updating catch blocks, leading to a change in the format of logger messages. This aligns with the upcoming modifications discussed in the PR: spinnaker#4608 Additionally, when the error response body is null, an appropriate error message will be printed in the logger.
Pranav-b-7
added a commit
to Pranav-b-7/orca
that referenced
this pull request
Jan 4, 2024
…for DeploymentMonitorService Update the error handler for the retrofit client, DeploymentMonitorService, to use SpinnakerRetrofitErrorHandler. Additionally, modify catch blocks with RetrofitError to use Spinnaker*Exception. Purpose : This commit is foundational work for upgrading the Retrofit version to retrofit2.x Behavioural change : The modification includes updating catch blocks, leading to a change in the format of logger messages. This aligns with the upcoming modifications discussed in the PR: spinnaker#4608 Additionally, when the error response body is null, an appropriate error message will be printed in the logger.
dbyron-sf
added a commit
to dbyron-sf/orca
that referenced
this pull request
Jan 8, 2024
…e for different types of RetrofitError (spinnaker#4608)" This reverts commit adc81ac. With the addition of EvaluateDeploymentHealthTaskTest, we have equivalent coverage that: - is in java instead of groovy - doesn't increase the visibility of getRetrofitLogMessage - more easily shows behavior changes when adopting SpinnakerRetrofitErrorHandler - is less likely to change when moving from retrofit to retrofit2
mergify bot
pushed a commit
that referenced
this pull request
Jan 8, 2024
…eploymentMonitorService (#4628) * refactor(clouddriver/test): configure logback to log messages to make it possible to add tests that assert on the contents of log messages. orca-test has a logback-test.xml file that disables logging, so add one for orca-clouddriver that takes precedence so log messages actually get generated. Now that logging is enabled, clock.millis() is called an additional time during a test in ServerGroupCacheForceRefreshTaskSpec. * test(clouddriver): demonstrate behavior of EvaluateDeploymentHealthTask to see what changes when moving to SpinnakerRetrofitErrorHandler. Specifically, these tests verify the contents of a log message that's tightly coupled to RetrofitError. * Revert "test(MonitoredDeployBaseTask): Add tests to verify log message for different types of RetrofitError (#4608)" This reverts commit adc81ac. With the addition of EvaluateDeploymentHealthTaskTest, we have equivalent coverage that: - is in java instead of groovy - doesn't increase the visibility of getRetrofitLogMessage - more easily shows behavior changes when adopting SpinnakerRetrofitErrorHandler - is less likely to change when moving from retrofit to retrofit2 * refactor(deploymentmonitor): use SpinnakerRetrofitErrorHandler with DeploymentMonitorService Note, there's a behavior change here when http response bodies aren't json objects. Previously, the log message would, barring an exception processing the response, include the http response body in the log message. With SpinnakerHttpException, response bodies that aren't json objects aren't available, so the body appears to be empty. For example, before: 2024-01-04 12:31:59.640 WARN --- [ Test worker] n.s.o.c.t.m.EvaluateDeploymentHealthTask : [] HTTP Error encountered while talking to monitorName(monitorId)->http://localhost:49179/deployment/evaluateHealth, status: 400 (Bad Request) response body: non-json response} retrofit.RetrofitError: 400 Bad Request at retrofit.RetrofitError.httpError(RetrofitError.java:40) after: 2024-01-04 14:26:13.270 WARN --- [ Test worker] n.s.o.c.t.m.EvaluateDeploymentHealthTask : [] HTTP Error encountered while talking to monitorName(monitorId)->http://localhost:58192/deployment/evaluateHealth, status: 400 (Bad Request) response body: } com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException: Status: 400, URL: http://localhost:58192/deployment/evaluateHealth, Message: Bad Request at com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerRetrofitErrorHandler.handleError(SpinnakerRetrofitErrorHandler.java:55) There's also a behavior change for ConversionException. before: 2024-01-04 16:03:19.363 WARN --- [ Test worker] n.s.o.c.t.m.EvaluateDeploymentHealthTask : [] HTTP Error encountered while talking to monitorName(monitorId)->http://localhost:60051/deployment/evaluateHealth, status: 200 (OK) headers: response body: } retrofit.RetrofitError: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `com.netflix.spinnaker.orca.deploymentmonitor.models.DeploymentStep` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('bogus') at [Source: (retrofit.ExceptionCatchingTypedInput$ExceptionCatchingInputStream); line: 1, column: 13] (through reference chain: com.netflix.spinnaker.orca.deploymentmonitor.models.EvaluateHealthResponse["nextStep"]) at retrofit.RetrofitError.conversionError(RetrofitError.java:33) after: 2024-01-04 16:14:03.540 WARN --- [ Test worker] n.s.o.c.t.m.EvaluateDeploymentHealthTask : [] HTTP Error encountered while talking to monitorName(monitorId)->http://localhost:59402/deployment/evaluateHealth, <NO RESPONSE>} com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerConversionException: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `com.netflix.spinnaker.orca.deploymentmonitor.models.DeploymentStep` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('bogus') at [Source: (retrofit.ExceptionCatchingTypedInput$ExceptionCatchingInputStream); line: 1, column: 13] (through reference chain: com.netflix.spinnaker.orca.deploymentmonitor.models.EvaluateHealthResponse["nextStep"]) at com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerRetrofitErrorHandler.handleError(SpinnakerRetrofitErrorHandler.java:64) at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:242) --------- Co-authored-by: Pranav-b-7 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
auto merged
Merged automatically by a bot
ready to merge
Approved and ready for merge
target-release/1.33
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces test cases designed to assess the current behaviour of the getRetrofitLogMessage() method when faced with diverse RetrofitErrors, including HTTP Error, Network Error, Unexpected Error, and Conversion Error. These tests provide a comprehensive understanding of the existing functionality before upcoming enhancements.
The primary objective of these test cases is to serve as a reference point for the behaviour of getRetrofitLogMessage() prior to planned modifications. The intention is to eliminate the usage of RetrofitError, and the added tests will help validate and compare the code's behaviour after the proposed changes.
Details: