Skip to content

Commit

Permalink
Merge pull request #381 from codacy/use-http-timeout-only-read
Browse files Browse the repository at this point in the history
fix: Use the http-timeout for the read-timeout only CY-6106
  • Loading branch information
stefanvacareanu7 authored May 16, 2022
2 parents 52d720b + d8a1c49 commit 37ae8c7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Usage: codacy-coverage-reporter report
--project-name | -p <your project name>
--codacy-api-base-url <the base URL for the Codacy API>
--commit-uuid <your commitUUID>
--http-timeout <Sets a specified timeout value, in milliseconds, to be used when interacting with Codacy API>
--http-timeout <Sets a specified read timeout value, in milliseconds, to be used when interacting with Codacy API>
--skip | -s <skip if token isn't defined>
--language | -l <language associated with your coverage report>
--coverage-reports | -r <your project coverage file name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ case class BaseCommandConfig(
codacyApiBaseUrl: Option[String],
@ValueDescription("your commitUUID")
commitUUID: Option[String],
@ValueDescription("Sets a specified timeout value, in milliseconds, to be used when interacting with Codacy API")
@ValueDescription(
"Sets a specified read timeout value, in milliseconds, to be used when interacting with Codacy API"
)
httpTimeout: Int = 10000,
@Name("s") @ValueDescription("skip if token isn't defined")
skip: Int @@ Counter = Tag.of(0),
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/com/codacy/rules/ConfigurationRules.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class ConfigurationRules(cmdConfig: CommandConfiguration, envVars: Map[String, S
baseConfig.codacyApiBaseUrl.getOrElse(getApiBaseUrl),
commitUUID,
baseConfig.debugValue,
timeout = RequestTimeout(baseConfig.httpTimeout, baseConfig.httpTimeout)
timeout = RequestTimeout(connTimeoutMs = 1000, readTimeoutMs = baseConfig.httpTimeout)
)
validatedConfig <- validateBaseConfigUrl(baseConf)
} yield {
Expand Down
6 changes: 3 additions & 3 deletions src/test/scala/com/codacy/rules/ReportRulesSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ReportRulesSpec extends WordSpec with Matchers with PrivateMethodTester wi
apiBaseUrl,
None,
debug = false,
timeout = RequestTimeout(10000, 10000)
timeout = RequestTimeout(1000, 10000)
)

def assertCodacyCoverage(
Expand Down Expand Up @@ -88,7 +88,7 @@ class ReportRulesSpec extends WordSpec with Matchers with PrivateMethodTester wi
any[String],
any[CoverageReport],
anyBoolean,
Some(RequestTimeout(10000, 10000))
Some(RequestTimeout(1000, 10000))
) returns FailedResponse("Failed to send report")

assertCodacyCoverage(coverageServices, List("src/test/resources/dotcover-example.xml"), success = false)
Expand All @@ -103,7 +103,7 @@ class ReportRulesSpec extends WordSpec with Matchers with PrivateMethodTester wi
any[String],
any[CoverageReport],
anyBoolean,
Some(RequestTimeout(10000, 10000))
Some(RequestTimeout(1000, 10000))
) returns SuccessfulResponse(RequestSuccess("Success"))

assertCodacyCoverage(coverageServices, List("src/test/resources/dotcover-example.xml"), success = true)
Expand Down

0 comments on commit 37ae8c7

Please sign in to comment.