You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2016/05/20 23:11:20 UTC

[trafficserver] 24/28: TS-4420: Mark HttpParentProxySet test requests no-cache.

This is an automated email from the ASF dual-hosted git repository.

sorber pushed a commit to branch 6.2.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 4719fff0770eb98b6f1a4df4fde2501f37defadf
Author: James Peach <jp...@apache.org>
AuthorDate: Tue May 10 13:34:49 2016 -0700

    TS-4420: Mark HttpParentProxySet test requests no-cache.
    
    When doing parent proxy requests we need to miss the cache so that
    we actually hit the synthetic server. Add a new response format
    that adds a no-cache Cache-Control header.
    
    (cherry picked from commit 85183a0ac37ddafea0a2e41cfbcde8b099665009)
---
 proxy/InkAPITest.cc     | 12 +++++++-----
 proxy/InkAPITestTool.cc | 18 +++++++++++++++++-
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index 5e68bda..d404d17 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -5904,7 +5904,7 @@ struct ParentTest {
     /* If parent proxy routing is not enabled, enable it for the life of the test. */
     RecGetRecordBool("proxy.config.http.parent_proxy_routing_enable", &this->parent_proxy_routing_enable);
     if (!this->parent_proxy_routing_enable) {
-      rprintf(this->regtest, "enabling proxy.config.http.parent_proxy_routing_enable");
+      rprintf(this->regtest, "enabling proxy.config.http.parent_proxy_routing_enable\n");
       RecSetRecordInt("proxy.config.http.parent_proxy_routing_enable", 1, REC_SOURCE_EXPLICIT);
     }
 
@@ -6082,8 +6082,9 @@ EXCLUSIVE_REGRESSION_TEST(SDK_API_HttpParentProxySet_Fail)(RegressionTest *test,
   /* Create a client transaction */
   ptest->browser = synclient_txn_create();
 
-  // HTTP_REQUEST_FORMAT10 is a hostname, so we will need to set the parent to the synserver to get a response.
-  char *request = generate_request(10);
+  // HTTP_REQUEST_FORMAT11 is a hostname with a no-cache response, so we will need to set the parent to the synserver to get a
+  // response.
+  char *request = generate_request(11);
   synclient_txn_send_request(ptest->browser, request);
   TSfree(request);
 
@@ -6117,8 +6118,9 @@ EXCLUSIVE_REGRESSION_TEST(SDK_API_HttpParentProxySet_Success)(RegressionTest *te
   /* Create a client transaction */
   ptest->browser = synclient_txn_create();
 
-  // HTTP_REQUEST_FORMAT10 is a hostname, so we will need to set the parent to the synserver to get a response.
-  char *request = generate_request(10);
+  // HTTP_REQUEST_FORMAT11 is a hostname with a no-cache response, so we will need to set the parent to the synserver to get a
+  // response.
+  char *request = generate_request(11);
   synclient_txn_send_request(ptest->browser, request);
   TSfree(request);
 
diff --git a/proxy/InkAPITestTool.cc b/proxy/InkAPITestTool.cc
index 4974887..4fc5d10 100644
--- a/proxy/InkAPITestTool.cc
+++ b/proxy/InkAPITestTool.cc
@@ -233,7 +233,10 @@ generate_request(int test_case)
   "GET http://trafficserver.apache.org/format10.html HTTP/1.0\r\n" \
   "X-Request-ID: %d\r\n"                                           \
   "\r\n"
-
+#define HTTP_REQUEST_FORMAT11                                      \
+  "GET http://trafficserver.apache.org/format11.html HTTP/1.0\r\n" \
+  "X-Request-ID: %d\r\n"                                           \
+  "\r\n"
   char *request = (char *)TSmalloc(REQUEST_MAX_SIZE + 1);
 
   switch (test_case) {
@@ -267,6 +270,9 @@ generate_request(int test_case)
   case 10:
     snprintf(request, REQUEST_MAX_SIZE + 1, HTTP_REQUEST_FORMAT10, test_case);
     break;
+  case 11:
+    snprintf(request, REQUEST_MAX_SIZE + 1, HTTP_REQUEST_FORMAT11, test_case);
+    break;
   default:
     snprintf(request, REQUEST_MAX_SIZE + 1, HTTP_REQUEST_DEFAULT_FORMAT, SYNSERVER_LISTEN_PORT, test_case);
     break;
@@ -358,6 +364,13 @@ generate_response(const char *request)
   "\r\n"                             \
   "Body for response 10"
 
+#define HTTP_RESPONSE_FORMAT11  \
+  "HTTP/1.0 200 OK\r\n"         \
+  "Cache-Control: no-cache\r\n" \
+  "X-Response-ID: %d\r\n"       \
+  "\r\n"                        \
+  "Body for response 11"
+
   int test_case, match, http_version;
 
   char *response = (char *)TSmalloc(RESPONSE_MAX_SIZE + 1);
@@ -394,6 +407,9 @@ generate_response(const char *request)
     case 10:
       snprintf(response, RESPONSE_MAX_SIZE + 1, HTTP_RESPONSE_FORMAT10, test_case);
       break;
+    case 11:
+      snprintf(response, RESPONSE_MAX_SIZE + 1, HTTP_RESPONSE_FORMAT11, test_case);
+      break;
     default:
       snprintf(response, RESPONSE_MAX_SIZE + 1, HTTP_RESPONSE_DEFAULT_FORMAT, test_case);
       break;

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.