-
Notifications
You must be signed in to change notification settings - Fork 640
fix(jenkins): fix the issue of Retrofit2EncodeCorrectionInterceptor getting added to Jenkins retrofit1 client #1324
fix(jenkins): fix the issue of Retrofit2EncodeCorrectionInterceptor getting added to Jenkins retrofit1 client #1324
Conversation
…CorrectionInterceptor getting added to retrofit1 client of JenkinsClient
…etting added to retrofit1 client of JenkinsClient. More details on this issue: spinnaker/spinnaker#7059
| import retrofit.RestAdapter | ||
| import spock.lang.Specification; | ||
|
|
||
| @SpringBootTest(classes = [JenkinsConfig, RawOkHttpClientConfiguration, OkHttpClientComponents, TestConfiguration, OkHttp3ClientConfiguration], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is RawOkHttpClientConfiguration still required after the fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not needed but it shows the real scenario of two OkHttpClient beans available but JenkinsConfig is using the right one. Let me know if you want me remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm...this is a tough one. Aren't we getting lucky here? RawOkHttpClientConfiguration uses @ConditionalOnMissingBean. What guarantees do we have that JenkinsConfig doesn't pick that up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed RawOkHttpClientConfiguration and converted the test to java.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. What about @ConditionalOnMissingBean though? Aren't we still getting lucky in the main igor code, because Main has:
@SpringBootApplication(
scanBasePackages = [
"",
"com.netflix.spinnaker.igor"
],
exclude = [GroovyTemplateAutoConfiguration]
)
and specifically com.netflix.spinnaker.config because RawOkHttpClientConfiguration is in
package com.netflix.spinnaker.config.okhttp3;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If RawOkHttpClientConfiguration gets processed first, I guess we end up with two OkHttpClient beans, one named okhttp3Client (from RawOkHttpClientConfiguration) and one named okHttpClient (from JenkinsConfig). And since the rest of the code in JenkinsConfig uses the variable name okHttpClient (and not okhttp3Client) perhaps things "just work." We're gonna go ahead ...
igor-web/src/test/groovy/com/netflix/spinnaker/igor/JenkinsClientSpec.groovy
Outdated
Show resolved
Hide resolved
igor-web/src/test/groovy/com/netflix/spinnaker/igor/JenkinsClientSpec.groovy
Outdated
Show resolved
Hide resolved
igor-web/src/test/groovy/com/netflix/spinnaker/igor/JenkinsClientSpec.groovy
Outdated
Show resolved
Hide resolved
igor-web/src/test/groovy/com/netflix/spinnaker/igor/JenkinsClientSpec.groovy
Outdated
Show resolved
Hide resolved
igor-web/src/test/groovy/com/netflix/spinnaker/igor/JenkinsClientSpec.groovy
Outdated
Show resolved
Hide resolved
7fe0d06 to
3ff78ca
Compare
+spinnaker#7059