You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2018/02/13 02:25:36 UTC

[trafficserver] branch master updated: More AUTest test cases for HTTP/2

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

masaori 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 19a6041  More AUTest test cases for HTTP/2
19a6041 is described below

commit 19a604143cdd3e36ab4ef79b83fc9e37daecb85d
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Thu Feb 8 12:45:55 2018 +0900

    More AUTest test cases for HTTP/2
    
    - Empty response body
    - Chunked response from origin server
    - Check logging
---
 tests/gold_tests/h2/gold/httpbin_1_stderr.gold | 15 +++++++++
 tests/gold_tests/h2/gold/httpbin_1_stdout.gold |  0
 tests/gold_tests/h2/gold/httpbin_2_stderr.gold | 14 ++++++++
 tests/gold_tests/h2/gold/httpbin_2_stdout.gold |  1 +
 tests/gold_tests/h2/gold/httpbin_access.gold   |  3 ++
 tests/gold_tests/h2/httpbin.test.py            | 45 ++++++++++++++++++++++++--
 6 files changed, 75 insertions(+), 3 deletions(-)

diff --git a/tests/gold_tests/h2/gold/httpbin_1_stderr.gold b/tests/gold_tests/h2/gold/httpbin_1_stderr.gold
new file mode 100644
index 0000000..8c6bc6c
--- /dev/null
+++ b/tests/gold_tests/h2/gold/httpbin_1_stderr.gold
@@ -0,0 +1,15 @@
+``
+> GET /bytes/0 HTTP/2
+> Host: ``
+> User-Agent: curl/``
+> Accept: */*
+``
+< HTTP/2 200 ``
+< server: ATS/``
+< date: ``
+< content-type: application/octet-stream
+``
+< content-length: 0``
+< age: ``
+< via: ``ApacheTrafficServer/``
+``
diff --git a/tests/gold_tests/h2/gold/httpbin_1_stdout.gold b/tests/gold_tests/h2/gold/httpbin_1_stdout.gold
new file mode 100644
index 0000000..e69de29
diff --git a/tests/gold_tests/h2/gold/httpbin_2_stderr.gold b/tests/gold_tests/h2/gold/httpbin_2_stderr.gold
new file mode 100644
index 0000000..c53bba6
--- /dev/null
+++ b/tests/gold_tests/h2/gold/httpbin_2_stderr.gold
@@ -0,0 +1,14 @@
+``
+> GET /stream-bytes/102400?seed=0 HTTP/2
+> Host: ``
+> User-Agent: curl/``
+> Accept: */*
+``
+< HTTP/2 200 ``
+< server: ATS/``
+< date: ``
+< content-type: application/octet-stream
+``
+< age: ``
+< via: ``ApacheTrafficServer/``
+``
diff --git a/tests/gold_tests/h2/gold/httpbin_2_stdout.gold b/tests/gold_tests/h2/gold/httpbin_2_stdout.gold
new file mode 100644
index 0000000..9345ad1
--- /dev/null
+++ b/tests/gold_tests/h2/gold/httpbin_2_stdout.gold
@@ -0,0 +1 @@
+b99e42637ce13160c48e9b2bc9ed2d4dd175bc6cf44c7814b01e4853f262b284  -
diff --git a/tests/gold_tests/h2/gold/httpbin_access.gold b/tests/gold_tests/h2/gold/httpbin_access.gold
new file mode 100644
index 0000000..3f77947
--- /dev/null
+++ b/tests/gold_tests/h2/gold/httpbin_access.gold
@@ -0,0 +1,3 @@
+[``] GET http://127.0.0.1:``/get HTTP/1.1 http/2 `` `` TCP_MISS 200 ``
+[``] GET http://127.0.0.1:``/bytes/0 HTTP/1.1 http/2 `` `` TCP_MISS 200 0
+[``] GET http://127.0.0.1:``/stream-bytes/102400?seed=0 HTTP/1.1 http/2 `` `` TCP_MISS 200 102400
diff --git a/tests/gold_tests/h2/httpbin.test.py b/tests/gold_tests/h2/httpbin.test.py
index 2e32269..f615507 100644
--- a/tests/gold_tests/h2/httpbin.test.py
+++ b/tests/gold_tests/h2/httpbin.test.py
@@ -27,7 +27,8 @@ Test HTTP/2 with httpbin origin server
 # Require HTTP/2 enabled Curl
 Test.SkipUnless(
     Condition.HasProgram("curl", "Curl need to be installed on system for this test to work"),
-    Condition.HasCurlFeature('http2')
+    Condition.HasCurlFeature('http2'),
+    Condition.HasProgram("shasum", "shasum need to be installed on system for this test to work"),
 )
 Test.ContinueOnFail = True
 
@@ -64,17 +65,55 @@ ts.Disk.records_config.update({
     'proxy.config.diags.debug.tags': 'http2',
 
 })
+ts.Disk.logging_config.AddLines(
+    '''
+-- Extended Log Format.
+access = format {
+  Format = '[%<cqtn>] %<cqtx> %<cqpv> %<cqssv> %<cqssc> %<crc> %<pssc> %<pscl>'
+}
+
+log.ascii {
+  Format = access,
+  Filename = 'access'
+}
+'''.split("\n")
+)
+
+Test.Disk.File(os.path.join(ts.Variables.LOGDIR, 'access.log'), exists=True, content='gold/httpbin_access.gold')
 
 # ----
 # Test Cases
 # ----
 
-# Test Case 0: /get
+# Test Case 0: Basic request and resposne
 test_run = Test.AddTestRun()
 test_run.Processes.Default.Command = 'curl -vs -k --http2 https://127.0.0.1:{0}/get'.format(ts.Variables.ssl_port)
 test_run.Processes.Default.ReturnCode = 0
-test_run.Processes.Default.StartBefore(httpbin)
+test_run.Processes.Default.StartBefore(httpbin, ready=When.PortOpen(httpbin.Variables.Port))
 test_run.Processes.Default.StartBefore(Test.Processes.ts, ready=When.PortOpen(ts.Variables.ssl_port))
 test_run.Processes.Default.Streams.stdout = "gold/httpbin_0_stdout.gold"
 test_run.Processes.Default.Streams.stderr = "gold/httpbin_0_stderr.gold"
 test_run.StillRunningAfter = httpbin
+
+# Test Case 1: Empty response body
+test_run = Test.AddTestRun()
+test_run.Processes.Default.Command = 'curl -vs -k --http2 https://127.0.0.1:{0}/bytes/0'.format(ts.Variables.ssl_port)
+test_run.Processes.Default.ReturnCode = 0
+test_run.Processes.Default.Streams.stdout = "gold/httpbin_1_stdout.gold"
+test_run.Processes.Default.Streams.stderr = "gold/httpbin_1_stderr.gold"
+test_run.StillRunningAfter = httpbin
+
+# Test Case 2: Chunked
+test_run = Test.AddTestRun()
+test_run.Processes.Default.Command = 'curl -vs -k --http2 https://127.0.0.1:{0}/stream-bytes/102400?seed=0 | shasum -a 256'.format(
+    ts.Variables.ssl_port)
+test_run.Processes.Default.ReturnCode = 0
+test_run.Processes.Default.Streams.stdout = "gold/httpbin_2_stdout.gold"
+test_run.Processes.Default.Streams.stderr = "gold/httpbin_2_stderr.gold"
+test_run.StillRunningAfter = httpbin
+
+# Check Logging
+test_run = Test.AddTestRun()
+test_run.DelayStart = 10
+test_run.Processes.Default.Command = 'echo "Delay for log flush"'
+test_run.Processes.Default.ReturnCode = 0

-- 
To stop receiving notification emails like this one, please contact
masaori@apache.org.