drcariel commented on a change in pull request #2591: User-Agent CLI/version header URL: https://github.com/apache/incubator-openwhisk/pull/2591#discussion_r133007795
########## File path: tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala ########## @@ -47,94 +47,16 @@ import whisk.core.entity.Subject * Tests web actions. */ @RunWith(classOf[JUnitRunner]) -class WskWebActionsTestsV1 extends WskWebActionsTests { - override val testRoutePath = "/api/v1/experimental/web" -} - -@RunWith(classOf[JUnitRunner]) -class WskWebActionsTestsV2 extends WskWebActionsTests with BeforeAndAfterAll { - override val testRoutePath = "/api/v1/web" - - private val subdomainRegex = Seq.fill(WhiskProperties.getPartsInVanitySubdomain)("[a-zA-Z0-9]+").mkString("-") - - private val (vanitySubdomain, vanityNamespace, makeTestSubject) = { - if (namespace.matches(subdomainRegex)) { - (namespace, namespace, false) - } else { - val s = Subject().asString.toLowerCase // this will generate two confirming parts - (s, s.replace("-", "_"), true) - } - } - - private val wskPropsForSubdomainTest = if (makeTestSubject) { - getAdditionalTestSubject(vanityNamespace) // create new subject for the test - } else { - WskProps() - } - - override def afterAll() = { - if (makeTestSubject) { - disposeAdditionalTestSubject(vanityNamespace) - } - } - - "test subdomain" should "have conforming parts" in { - vanitySubdomain should fullyMatch regex subdomainRegex.r - vanitySubdomain.length should be <= 63 - } - - "vanity subdomain" should "access a web action via namespace subdomain" in withAssetCleaner(wskPropsForSubdomainTest) { - (wp, assetHelper) => - val actionName = "webaction" - - val file = Some(TestUtils.getTestActionFilename("echo.js")) - assetHelper.withCleaner(wsk.action, actionName) { - (action, _) => action.create(actionName, file, web = Some(true.toString))(wp) - } - - val url = getServiceApiHost(vanitySubdomain, true) + s"/default/$actionName.text/a?a=A" - println(s"url: $url") - - // try the rest assured path first, failing that, try curl with explicit resolve - Try { - val response = RestAssured.given().config(sslconfig).get(url) - val responseCode = response.statusCode - responseCode shouldBe 200 - response.body.asString shouldBe "A" - } match { - case Failure(t) => - println(s"RestAssured path failed, trying curl: $t") - implicit val tid = TransactionId.testing - implicit val logger = new PrintStreamLogging(Console.out) - val host = getServiceApiHost(vanitySubdomain, false) - // if the edge host is a name, try to resolve it, otherwise, it should be an ip address already - val edgehost = WhiskProperties.getEdgeHost - val ip = Try(java.net.InetAddress.getByName(edgehost).getHostAddress) getOrElse "???" - println(s"edge: $edgehost, ip: $ip") - val cmd = Seq("curl", "-k", url, "--resolve", s"$host:$ip") - val (stdout, stderr, exitCode) = SimpleExec.syncRunCmd(cmd) - withClue(s"\n$stderr\n") { - stdout shouldBe "A" - exitCode shouldBe 0 - } - - case _ => - } - } -} - -trait WskWebActionsTests - extends TestHelpers - with WskTestHelpers - with RestUtil { +class WskWebActionsTests extends TestHelpers + with WskTestHelpers with RestUtil with BeforeAndAfterAll { val MAX_URL_LENGTH = 8192 // 8K matching nginx default val wsk = new Wsk private implicit val wskprops = WskProps() val namespace = wsk.namespace.whois() - protected val testRoutePath: String + protected val testRoutePath: String = "/api/v1/web" Review comment: Is this appropriate here? or will testRoutePath be populated at this point? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services