Skip to content
Snippets Groups Projects
Commit 18c10777 authored by Rodric Rabbah's avatar Rodric Rabbah Committed by Stephen Fink
Browse files

Tweak server configurations. Add comments.

Add test for max URL path.
Match nginx max url.
parent f318b947
No related branches found
No related tags found
No related merge requests found
...@@ -40,6 +40,8 @@ class WskWebActionsTests ...@@ -40,6 +40,8 @@ class WskWebActionsTests
with WskTestHelpers with WskTestHelpers
with RestUtil { with RestUtil {
val MAX_URL_LENGTH = 8192 // 8K matching nginx default
implicit val wskprops = WskProps() implicit val wskprops = WskProps()
val wsk = new Wsk val wsk = new Wsk
val namespace = WskAdmin.getUser(wskprops.authKey)._2 val namespace = WskAdmin.getUser(wskprops.authKey)._2
...@@ -56,11 +58,29 @@ class WskWebActionsTests ...@@ -56,11 +58,29 @@ class WskWebActionsTests
action.create(name, file, annotations = Map("web-export" -> true.toJson)) action.create(name, file, annotations = Map("web-export" -> true.toJson))
} }
val response = RestAssured.given().config(sslconfig). val host = getServiceURL()
get(getServiceURL() + s"/api/v1/experimental/web/$namespace/default/webaction.text/a?a=A") val requestPath = host + s"/api/v1/experimental/web/$namespace/default/webaction.text/a?a="
val padAmount = MAX_URL_LENGTH - requestPath.length
Seq(("A", 200),
("A" * padAmount, 200),
// ideally the bad case is just +1 but there's some differences
// in how characters are counted i.e., whether these count "https://:443"
// or not; it seems sufficient to test right around the boundary
("A" * (padAmount + 100), 414))
.foreach {
case (pad, code) =>
val url = (requestPath + pad)
val response = RestAssured.given().config(sslconfig).get(url)
val responseCode = response.statusCode
response.statusCode() should be(200) withClue(s"response code: $responseCode, url length: ${url.length}, pad amount: ${pad.length}, url: $url") {
response.body().asString() shouldBe "A" responseCode shouldBe code
if (code == 200) {
response.body().asString() shouldBe pad
} else {
response.body().asString() should include("414 Request-URI Too Large") // from nginx
}
}
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment