trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject [trafficserver] branch master updated: Test PUSHing an object into the cache and the GETting it with a few variations on the client connection protocol.
Date Tue, 21 Apr 2020 22:33:42 GMT
This is an automated email from the ASF dual-hosted git repository.

rrm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new ce2bccf  Test PUSHing an object into the cache and the GETting it with a few variations
on the client connection protocol.
ce2bccf is described below

commit ce2bccfac3bab47573240a85ffb78d59c510c536
Author: Walter Karas <wkaras@verizonmedia.com>
AuthorDate: Fri Apr 17 11:02:49 2020 -0500

    Test PUSHing an object into the cache and the GETting it with a few variations on the
client connection protocol.
    
    The new test can also be modified temporarily and used to test client-side communication
when GETting multi-GB objects.
---
 tests/gold_tests/bigobj/bigobj.test.py | 131 +++++++++++++++++++++++++++++++++
 tests/gold_tests/bigobj/check_ramp.c   |  57 ++++++++++++++
 tests/gold_tests/bigobj/log2.gold      |   4 +
 tests/gold_tests/bigobj/push_request.c |  79 ++++++++++++++++++++
 tests/gold_tests/bigobj/ssl/server.key |  15 ++++
 tests/gold_tests/bigobj/ssl/server.pem |  32 ++++++++
 6 files changed, 318 insertions(+)

diff --git a/tests/gold_tests/bigobj/bigobj.test.py b/tests/gold_tests/bigobj/bigobj.test.py
new file mode 100644
index 0000000..21ae164
--- /dev/null
+++ b/tests/gold_tests/bigobj/bigobj.test.py
@@ -0,0 +1,131 @@
+'''
+Test PUSHing an object into the cache and the GETting it with a few variations on the client
connection protocol.
+'''
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+Test.Summary = '''
+Test PUSHing an object into the cache and the GETting it with a few variations on the client
connection protocol.
+'''
+
+# NOTE: You can also use this to test client-side communication when GETting very large (multi-GB)
objects
+# by increasing the value of the obj_kilobytes variable below.  (But do not increase it on
any shared branch
+# that we do CI runs on.)
+
+Test.SkipUnless(
+    Condition.HasCurlFeature('http2')
+)
+
+ts = Test.MakeATSProcess("ts", enable_tls=True)
+
+ts.addSSLfile("ssl/server.pem")
+ts.addSSLfile("ssl/server.key")
+
+ts.Disk.records_config.update({
+    # Do not accept connections from clients until cache subsystem is operational.
+    'proxy.config.http.wait_for_cache': 1,
+
+    'proxy.config.diags.debug.enabled': 1,
+    'proxy.config.diags.debug.tags': 'http|dns|cache',
+    'proxy.config.http.cache.http': 1,  # enable caching.
+    'proxy.config.http.cache.required_headers': 0,  # No required headers for caching
+    'proxy.config.http.push_method_enabled': 1,
+    'proxy.config.proxy_name': 'Poxy_Proxy',  # This will be the server name.
+    'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
+    'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
+    'proxy.config.url_remap.remap_required': 0
+})
+
+ts.Disk.ssl_multicert_config.AddLine(
+    'dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key'
+)
+
+ts.Disk.remap_config.AddLine(
+    'map https://localhost http://localhost'
+)
+
+# Set up to check the output after the tests have run.
+#
+log_id = Test.Disk.File("log2.txt")
+log_id.Content = "log2.gold"
+
+# Size of object to get.  (NOTE:  If you increase this significantly you may also have to
increase cache
+# capacity in tests/gold_tests/autest-size/min_cfg/storage.config.  Also, for very large
objects, if
+# proxy.config.diags.debug.enabled is 1, the PUSH request will timeout and fail.)
+#
+obj_kilobytes = 10 * 1024
+
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = 'cc ' + Test.TestDirectory + '/push_request.c -o push_request'
+tr.Processes.Default.ReturnCode = 0
+
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = 'cc ' + Test.TestDirectory + '/check_ramp.c -o check_ramp'
+tr.Processes.Default.ReturnCode = 0
+
+tr = Test.AddTestRun()
+# Delay on readiness of TS IPv4 ssl port
+tr.Processes.Default.StartBefore(Test.Processes.ts, ready=When.PortOpen(ts.Variables.ssl_port))
+#
+# Put object with URL http://localhost/bigobj in cache using PUSH request.
+tr.Processes.Default.Command = (
+    './push_request {} | nc localhost {}'.format(obj_kilobytes, ts.Variables.port)
+)
+tr.Processes.Default.ReturnCode = 0
+
+# GET bigobj -- cleartext, HTTP 1.1, IPv4
+#
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = (
+    'curl --verbose --ipv4 --http1.1 --header "Host: localhost"' +
+    ' http://localhost:{}/bigobj 2>> log.txt | ./check_ramp {}'
+    .format(ts.Variables.port, obj_kilobytes)
+)
+tr.Processes.Default.ReturnCode = 0
+
+# GET bigobj -- TLS, HTTP 1.1, IPv4
+#
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = (
+    'curl --verbose --ipv4 --http1.1 --insecure --header "Host: localhost"' +
+    ' https://localhost:{}/bigobj 2>> log.txt | ./check_ramp {}'
+    .format(ts.Variables.ssl_port, obj_kilobytes)
+)
+tr.Processes.Default.ReturnCode = 0
+
+# GET bigobj -- TLS, HTTP 2, IPv4
+#
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = (
+    'curl --verbose --ipv4 --http2 --insecure --header "Host: localhost"' +
+    ' https://localhost:{}/bigobj 2>> log.txt | ./check_ramp {}'
+    .format(ts.Variables.ssl_port, obj_kilobytes)
+)
+tr.Processes.Default.ReturnCode = 0
+
+# GET bigobj -- TLS, HTTP 2, IPv6
+#
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = (
+    'curl --verbose --ipv6 --http2 --insecure --header "Host: localhost"' +
+    ' https://localhost:{}/bigobj 2>> log.txt | ./check_ramp {}'
+    .format(ts.Variables.ssl_portv6, obj_kilobytes)
+)
+tr.Processes.Default.ReturnCode = 0
+
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = "sed 's/0</0\\\n</' log.txt | grep -F 200 | grep -F
HTTP > log2.txt"
+tr.Processes.Default.ReturnCode = 0
diff --git a/tests/gold_tests/bigobj/check_ramp.c b/tests/gold_tests/bigobj/check_ramp.c
new file mode 100644
index 0000000..fbea580
--- /dev/null
+++ b/tests/gold_tests/bigobj/check_ramp.c
@@ -0,0 +1,57 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+*/
+
+// Program to read standard input and verify it is ramping pattern.
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <inttypes.h>
+
+int
+main(int n_arg, char const *const *arg)
+{
+  int64_t data_count;
+  int c = 0;
+
+  if ((n_arg != 2) || ((data_count = atoi(arg[1])) < 0)) {
+    fprintf(stderr, "usage: check_ramp number-of-kilobytes\n");
+    return 1;
+  }
+
+  data_count *= 1024;
+
+  while (data_count--) {
+    if (getchar() != c) {
+      fprintf(stderr, "error in standard input\n");
+      return 1;
+    }
+    if (c == 255) {
+      c = 0;
+    } else {
+      ++c;
+    }
+  }
+
+  if (getchar() != EOF) {
+    fprintf(stderr, "error in standard input (too long)\n");
+    return 1;
+  }
+
+  return 0;
+}
diff --git a/tests/gold_tests/bigobj/log2.gold b/tests/gold_tests/bigobj/log2.gold
new file mode 100644
index 0000000..c4367a7
--- /dev/null
+++ b/tests/gold_tests/bigobj/log2.gold
@@ -0,0 +1,4 @@
+< HTTP/1.1 200 OK
+< HTTP/1.1 200 OK
+< HTTP/2 200 
+< HTTP/2 200 
diff --git a/tests/gold_tests/bigobj/push_request.c b/tests/gold_tests/bigobj/push_request.c
new file mode 100644
index 0000000..98a291e
--- /dev/null
+++ b/tests/gold_tests/bigobj/push_request.c
@@ -0,0 +1,79 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+*/
+
+// Program to output push request with ramping data.
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <inttypes.h>
+
+int
+main(int n_arg, char const *const *arg)
+{
+  int64_t data_count;
+  int c = 0, hdr_count;
+  ;
+  char buf[200];
+
+  if ((n_arg != 2) || ((data_count = atoi(arg[1])) < 0)) {
+    fprintf(stderr, "usage: push_request number-of-kilobytes\n");
+    return 1;
+  }
+
+  data_count *= 1024;
+
+  hdr_count = snprintf(buf, sizeof(buf),
+                       "HTTP/1.1 200 OK\r\n"
+                       "Content-Type: text/plain\r\n"
+                       "Content-Length: %" PRId64 "\r\n"
+                       "\r\n",
+                       data_count);
+
+  if (hdr_count <= 0) {
+    fprintf(stderr, "INTERNAL ERROR\n");
+    return 1;
+  }
+
+  if (printf("PUSH http://localhost/bigobj HTTP/1.1\r\n"
+             "Content-Length: %" PRId64 "\r\n"
+             "\r\n%s",
+             hdr_count + data_count, buf) <= 0) {
+    fprintf(stderr, "error writing standard output\n");
+    return 1;
+  }
+
+  while (data_count--) {
+    if (putchar(c) != c) {
+      fprintf(stderr, "error writing standard output\n");
+      return 1;
+    }
+    if (c == 255) {
+      c = 0;
+    } else {
+      ++c;
+    }
+  }
+
+  if (fflush(stdout) != 0) {
+    fprintf(stderr, "error writing standard output\n");
+    return 1;
+  }
+
+  return 0;
+}
diff --git a/tests/gold_tests/bigobj/ssl/server.key b/tests/gold_tests/bigobj/ssl/server.key
new file mode 100644
index 0000000..4c7a661
--- /dev/null
+++ b/tests/gold_tests/bigobj/ssl/server.key
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXQIBAAKBgQDWMHOiUF+ORmZjAxI8MWE9dblb7gQSJ36WCXlPFiFx6ynF+S1E
+kXAYpIip5X0pzDUaIbLukxJUAAnOtMEO0PCgxJQUrEtRWh8wiJdbdQJF0Zs/9R+u
+SUgb61f+mdTQvhqefBGx+xrpfAcgtcWiZuSA9Q3fvpDj5WOWSPWXBUuxywIDAQAB
+AoGBAJPxRX2gjFAGWmQbU/YVmXfNH6navh8X/nx9sLeqrpE0AFeJI/ZPiqDKzMal
+B43eSfNxwVi+ZxN0L1ICUbL9KKZvHs/QBxWLA1fGVAXrz7sRplEVvakPpTfHoEnv
+sKaMWVKaK/S5WGbDhElb6zb/Lwo19DsIAPjGYqFvzFJBmobJAkEA9iSeTGkR9X26
+GywZoYrIMlRh34htOIRx1UUq88rFzdrCF21kQ4lhBIkX5OZMMy652i2gyak4OZTe
+YewIv8jw9QJBAN7EQNHG8jPwXfVp91/fqxVQEfumuP2i6uiWWYQgZCmla2+0xcLZ
+pMQ6sQEe10hhTrVnzHgAUVp50Ntn2jwBX78CQF09veGAI9d1Cxzj9cmmAvRd1r2Q
+tp8kPOLnUsALXib+6WtqewLCdcf8DtsdClyRJMIraq85tRzK8fryKNZNzkkCQEgA
+yS7FDj5JgCU15hZgFk1iPx3HCt44jZM2HaL+UUHAzRQjKxTLAl3G1rWVAWLMyQML
+lORoveLvotl4HOruSsMCQQCAx9dV9JUSFoyc1CWILp/FgUH/se4cjQCThGO0DoQQ
+vGTYmntY7j9WRJ9esQrjdD6Clw8zM/45GIBNwnXzqo7Z
+-----END RSA PRIVATE KEY-----
diff --git a/tests/gold_tests/bigobj/ssl/server.pem b/tests/gold_tests/bigobj/ssl/server.pem
new file mode 100644
index 0000000..58b9b97
--- /dev/null
+++ b/tests/gold_tests/bigobj/ssl/server.pem
@@ -0,0 +1,32 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXQIBAAKBgQDWMHOiUF+ORmZjAxI8MWE9dblb7gQSJ36WCXlPFiFx6ynF+S1E
+kXAYpIip5X0pzDUaIbLukxJUAAnOtMEO0PCgxJQUrEtRWh8wiJdbdQJF0Zs/9R+u
+SUgb61f+mdTQvhqefBGx+xrpfAcgtcWiZuSA9Q3fvpDj5WOWSPWXBUuxywIDAQAB
+AoGBAJPxRX2gjFAGWmQbU/YVmXfNH6navh8X/nx9sLeqrpE0AFeJI/ZPiqDKzMal
+B43eSfNxwVi+ZxN0L1ICUbL9KKZvHs/QBxWLA1fGVAXrz7sRplEVvakPpTfHoEnv
+sKaMWVKaK/S5WGbDhElb6zb/Lwo19DsIAPjGYqFvzFJBmobJAkEA9iSeTGkR9X26
+GywZoYrIMlRh34htOIRx1UUq88rFzdrCF21kQ4lhBIkX5OZMMy652i2gyak4OZTe
+YewIv8jw9QJBAN7EQNHG8jPwXfVp91/fqxVQEfumuP2i6uiWWYQgZCmla2+0xcLZ
+pMQ6sQEe10hhTrVnzHgAUVp50Ntn2jwBX78CQF09veGAI9d1Cxzj9cmmAvRd1r2Q
+tp8kPOLnUsALXib+6WtqewLCdcf8DtsdClyRJMIraq85tRzK8fryKNZNzkkCQEgA
+yS7FDj5JgCU15hZgFk1iPx3HCt44jZM2HaL+UUHAzRQjKxTLAl3G1rWVAWLMyQML
+lORoveLvotl4HOruSsMCQQCAx9dV9JUSFoyc1CWILp/FgUH/se4cjQCThGO0DoQ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