Skip to content

Commit

Permalink
Merge pull request #52 from ajordens/master
Browse files Browse the repository at this point in the history
Ensure InfoControllerSpec runs with a reasonable hystrix timeout
  • Loading branch information
ajordens committed Dec 1, 2015
2 parents 34f4964 + bb01611 commit d99a1df
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@
package com.netflix.spinnaker.igor.config

import com.netflix.hystrix.exception.HystrixRuntimeException
import com.netflix.spectator.api.Registry
import com.netflix.spinnaker.kork.web.interceptors.MetricsInterceptor
import groovy.transform.CompileStatic
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.HttpStatus
import org.springframework.web.bind.annotation.ControllerAdvice
import org.springframework.web.bind.annotation.ExceptionHandler
import org.springframework.web.bind.annotation.ResponseBody
import org.springframework.web.bind.annotation.ResponseStatus
import org.springframework.web.servlet.config.annotation.InterceptorRegistry
import retrofit.RetrofitError

import java.util.concurrent.ExecutorService
Expand All @@ -37,6 +41,18 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
@Configuration
@CompileStatic
class IgorConfig extends WebMvcConfigurerAdapter {
@Autowired
Registry registry

@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(
new MetricsInterceptor(
this.registry, "controller.invocations", ["master"], ["BasicErrorController"]
)
)
}

@Bean
ExecutorService executorService() {
Executors.newCachedThreadPool()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ class BuildController {
masters.map[master].getBuilds(job).list
}

@RequestMapping(value = '/masters/{name}/jobs/{job:.+}', method = RequestMethod.PUT)
@RequestMapping(value = '/masters/{master}/jobs/{job:.+}', method = RequestMethod.PUT)
String build(
@PathVariable("name") String master,
@PathVariable("master") String master,
@PathVariable String job, @RequestParam Map<String, String> requestParams) {
if (!masters.map.containsKey(master)) {
throw new MasterNotFoundException()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.netflix.spinnaker.igor.jenkins

import com.netflix.config.ConfigurationManager
import com.netflix.spinnaker.igor.config.JenkinsConfig
import com.netflix.spinnaker.igor.jenkins.service.JenkinsService
import com.squareup.okhttp.mockwebserver.MockResponse
Expand All @@ -36,6 +37,9 @@ import spock.lang.Specification
*/
@SuppressWarnings(['UnnecessaryBooleanExpression', 'LineLength'])
class InfoControllerSpec extends Specification {
static {
System.setProperty("hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds", "30000")
}

MockMvc mockMvc
JenkinsCache cache
Expand Down

0 comments on commit d99a1df

Please sign in to comment.