Skip to content

Commit

Permalink
chore(bakery): propagate auth context to bakery for logging (#2916)
Browse files Browse the repository at this point in the history
  • Loading branch information
asher committed May 14, 2019
1 parent cd6b6ca commit 31e09d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.netflix.spinnaker.orca.bakery.config

import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
import retrofit.RequestInterceptor

import java.text.SimpleDateFormat
import com.fasterxml.jackson.databind.ObjectMapper
Expand Down Expand Up @@ -53,6 +54,7 @@ class BakeryConfiguration {

@Autowired Client retrofitClient
@Autowired LogLevel retrofitLogLevel
@Autowired RequestInterceptor spinnakerRequestInterceptor

@Bean
Endpoint bakeryEndpoint(@Value('${bakery.base-url}') String bakeryBaseUrl) {
Expand All @@ -69,6 +71,7 @@ class BakeryConfiguration {

new RestAdapter.Builder()
.setEndpoint(bakeryEndpoint)
.setRequestInterceptor(spinnakerRequestInterceptor)
.setConverter(new JacksonConverter(objectMapper))
.setClient(retrofitClient)
.setLogLevel(retrofitLogLevel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.github.tomakehurst.wiremock.junit.WireMockRule
import com.netflix.spinnaker.orca.bakery.config.BakeryConfiguration
import com.netflix.spinnaker.orca.jackson.OrcaObjectMapper
import org.junit.Rule
import retrofit.RequestInterceptor
import retrofit.RetrofitError
import retrofit.client.OkClient
import spock.lang.Specification
Expand Down Expand Up @@ -54,7 +55,11 @@ class BakeryServiceSpec extends Specification {
bakeURI = wireMockRule.url(bakePath)
statusURI = wireMockRule.url(statusPath)

bakery = new BakeryConfiguration(retrofitClient: new OkClient(), retrofitLogLevel: FULL)
bakery = new BakeryConfiguration(
retrofitClient: new OkClient(),
retrofitLogLevel: FULL,
spinnakerRequestInterceptor: Mock(RequestInterceptor)
)
.bakery(newFixedEndpoint(wireMockRule.url("/")))
}

Expand Down

0 comments on commit 31e09d2

Please sign in to comment.