You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by syucream <gi...@git.apache.org> on 2015/08/13 03:43:17 UTC

[GitHub] trafficserver pull request: TS-3782: Add H2 exceptional test cases

GitHub user syucream opened a pull request:

    https://github.com/apache/trafficserver/pull/277

    TS-3782: Add H2 exceptional test cases

    HTTP/2 exceptional test cases. It has already been fixed based on comments on [TS-3782](https://issues.apache.org/jira/browse/TS-3782)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/syucream/trafficserver h2spec

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/trafficserver/pull/277.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #277
    
----
commit 55d8876b76588c515afa95acbc0c3b856b761569
Author: Ryo Okubo <ro...@yahoo-corp.jp>
Date:   2015-08-10T01:24:42Z

    Add H2 exceptional test cases

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3782: Add H2 exceptional test cases

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/trafficserver/pull/277


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3782: Add H2 exceptional test cases

Posted by masaori335 <gi...@git.apache.org>.
Github user masaori335 commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/277#discussion_r39465419
  
    --- Diff: ci/tsqa/tests/test_http2_spec.py ---
    @@ -0,0 +1,114 @@
    +#  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.
    +
    +#
    +# Note: This test case uses h2spec. Please install it yourself.
    +# https://github.com/summerwind/h2spec
    +#
    +
    +import logging
    +import os
    +import subprocess
    +
    +import helpers
    +
    +import tsqa.endpoint
    +import tsqa.test_cases
    +import tsqa.utils
    +
    +log = logging.getLogger(__name__)
    +
    +# helper function to get h2spec path
    +def which(program):
    +    def is_exe(fpath):
    +        return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
    +    fpath, fname = os.path.split(program)
    +    if fpath:
    +        if is_exe(program):
    +            return program
    +    else:
    +        for path in os.environ["PATH"].split(os.pathsep):
    +            path = path.strip('"')
    +            exe_file = os.path.join(path, program)
    +            if is_exe(exe_file):
    +                return exe_file
    +    return None
    +
    +class TestH2Spec(helpers.EnvironmentCase, tsqa.test_cases.HTTPBinCase):
    +    @classmethod
    +    def setUpEnv(cls, env):
    +        '''
    +        Setting up environment for testing of HTTP2
    +        '''
    +        # get path to h2spec
    +        cls.h2spec = which('h2spec')
    +        if cls.h2spec is None:
    +          raise helpers.unittest.SkipTest('Cannot find h2spec. skipping test.')
    +
    +        # get HTTP/2 server ports
    +        cls.http2_port = tsqa.utils.bind_unused_port()[1]
    +
    +        # HTTP2 configs
    +        cls.configs['records.config']['CONFIG']['proxy.config.http2.enabled'] = 1
    +        cls.configs['records.config']['CONFIG']['proxy.config.http.server_ports'] += ' {0}:ssl'.format(cls.http2_port)
    +        cls.configs['records.config']['CONFIG']['proxy.config.ssl.server.cert.path'] = helpers.tests_file_path('rsa_keys')
    +        cls.configs['records.config']['CONFIG']['proxy.config.diags.debug.enabled'] = 1
    +        cls.configs['records.config']['CONFIG']['proxy.config.diags.debug.tags'] = 'http2.*|ssl.*'
    +
    +        # configure SSL multicert
    +        cls.configs['ssl_multicert.config'].add_line(
    +            'dest_ip=* ssl_cert_name={0}\n'.format(helpers.tests_file_path('rsa_keys/www.example.com.pem'))
    +        )
    +
    +        # remap configs
    +        cls.configs['remap.config'].add_line(
    +            'map / http://127.0.0.1:{0}/'.format(cls.http_endpoint.address[1])
    +        )
    +
    +    def __callH2Spec(self, section=None):
    +        '''
    +        Call h2spec
    +        '''
    +        args = [self.h2spec, '-h', 'localhost', '-p', str(self.http2_port), '-t', '-k']
    +        if section is not None:
    +          args.extend(['-s', section])
    +
    +        log.info('full args = {0}'.format(args))
    +        p = subprocess.Popen(
    +            args,
    +            stdout=subprocess.PIPE,
    +            stdin=subprocess.PIPE,
    +        )
    +        self.stdout, self.stderr = p.communicate()
    +        log.info('\n' + self.stdout)
    +
    +        return p.returncode
    +
    +    def test_http2_spec_section(self):
    +        '''
    +        Test HTTP/2 w/ h2spec (Exceptional Scenario)
    +        '''
    +        sections = ['3.5', '4.2', '4.3', '6.1', '6.2', '6.3', '6.4', '6.5', '6.5.2', '6.7', '6.8',
    +                    '6.9', '6.9.1', '8.1', '8.1.2', '8.1.2.2', '8.1.2.3', '8.1.2.6', '8.2']
    +        for section in sections:
    +            self.__callH2Spec(section)
    +            self.assertIn('All tests passed', self.stdout, 'Failed at section %s of RFC7540' % section)
    +
    +        # TODO these tests cannot pass currently. move to above after ATS can pass them
    +        failing_sections = ['5.1', '5.3.1', '5.4.1', '5.5', '6.10']
    --- End diff --
    
    Finally, all tests are passed with h2spec-v1.1.1:D


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3782: Add H2 exceptional test cases

Posted by ericcarlschwartz <gi...@git.apache.org>.
Github user ericcarlschwartz commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/277#discussion_r39420551
  
    --- Diff: ci/tsqa/tests/test_http2_spec.py ---
    @@ -0,0 +1,114 @@
    +#  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.
    +
    +#
    +# Note: This test case uses h2spec. Please install it yourself.
    +# https://github.com/summerwind/h2spec
    +#
    +
    +import logging
    +import os
    +import subprocess
    +
    +import helpers
    +
    +import tsqa.endpoint
    +import tsqa.test_cases
    +import tsqa.utils
    +
    +log = logging.getLogger(__name__)
    +
    +# helper function to get h2spec path
    +def which(program):
    +    def is_exe(fpath):
    +        return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
    +    fpath, fname = os.path.split(program)
    +    if fpath:
    +        if is_exe(program):
    +            return program
    +    else:
    +        for path in os.environ["PATH"].split(os.pathsep):
    +            path = path.strip('"')
    +            exe_file = os.path.join(path, program)
    +            if is_exe(exe_file):
    +                return exe_file
    +    return None
    +
    +class TestH2Spec(helpers.EnvironmentCase, tsqa.test_cases.HTTPBinCase):
    +    @classmethod
    +    def setUpEnv(cls, env):
    +        '''
    +        Setting up environment for testing of HTTP2
    +        '''
    +        # get path to h2spec
    +        cls.h2spec = which('h2spec')
    +        if cls.h2spec is None:
    +          raise helpers.unittest.SkipTest('Cannot find h2spec. skipping test.')
    --- End diff --
    
    @bcall it looks like it will just skip the test if h2spec isn't there. (that's what we do for the simple spdy tests)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3782: Add H2 exceptional test cases

Posted by bryancall <gi...@git.apache.org>.
Github user bryancall commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/277#discussion_r39700318
  
    --- Diff: ci/tsqa/tests/test_http2_spec.py ---
    @@ -0,0 +1,114 @@
    +#  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.
    +
    +#
    +# Note: This test case uses h2spec. Please install it yourself.
    +# https://github.com/summerwind/h2spec
    +#
    +
    +import logging
    +import os
    +import subprocess
    +
    +import helpers
    +
    +import tsqa.endpoint
    +import tsqa.test_cases
    +import tsqa.utils
    +
    +log = logging.getLogger(__name__)
    +
    +# helper function to get h2spec path
    +def which(program):
    +    def is_exe(fpath):
    +        return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
    +    fpath, fname = os.path.split(program)
    +    if fpath:
    +        if is_exe(program):
    +            return program
    +    else:
    +        for path in os.environ["PATH"].split(os.pathsep):
    +            path = path.strip('"')
    +            exe_file = os.path.join(path, program)
    +            if is_exe(exe_file):
    +                return exe_file
    +    return None
    +
    +class TestH2Spec(helpers.EnvironmentCase, tsqa.test_cases.HTTPBinCase):
    +    @classmethod
    +    def setUpEnv(cls, env):
    +        '''
    +        Setting up environment for testing of HTTP2
    +        '''
    +        # get path to h2spec
    +        cls.h2spec = which('h2spec')
    +        if cls.h2spec is None:
    +          raise helpers.unittest.SkipTest('Cannot find h2spec. skipping test.')
    +
    +        # get HTTP/2 server ports
    +        cls.http2_port = tsqa.utils.bind_unused_port()[1]
    +
    +        # HTTP2 configs
    +        cls.configs['records.config']['CONFIG']['proxy.config.http2.enabled'] = 1
    +        cls.configs['records.config']['CONFIG']['proxy.config.http.server_ports'] += ' {0}:ssl'.format(cls.http2_port)
    +        cls.configs['records.config']['CONFIG']['proxy.config.ssl.server.cert.path'] = helpers.tests_file_path('rsa_keys')
    +        cls.configs['records.config']['CONFIG']['proxy.config.diags.debug.enabled'] = 1
    +        cls.configs['records.config']['CONFIG']['proxy.config.diags.debug.tags'] = 'http2.*|ssl.*'
    +
    +        # configure SSL multicert
    +        cls.configs['ssl_multicert.config'].add_line(
    +            'dest_ip=* ssl_cert_name={0}\n'.format(helpers.tests_file_path('rsa_keys/www.example.com.pem'))
    +        )
    +
    +        # remap configs
    +        cls.configs['remap.config'].add_line(
    +            'map / http://127.0.0.1:{0}/'.format(cls.http_endpoint.address[1])
    +        )
    +
    +    def __callH2Spec(self, section=None):
    +        '''
    +        Call h2spec
    +        '''
    +        args = [self.h2spec, '-h', 'localhost', '-p', str(self.http2_port), '-t', '-k']
    +        if section is not None:
    +          args.extend(['-s', section])
    +
    +        log.info('full args = {0}'.format(args))
    +        p = subprocess.Popen(
    +            args,
    +            stdout=subprocess.PIPE,
    +            stdin=subprocess.PIPE,
    +        )
    +        self.stdout, self.stderr = p.communicate()
    +        log.info('\n' + self.stdout)
    +
    +        return p.returncode
    +
    +    def test_http2_spec_section(self):
    +        '''
    +        Test HTTP/2 w/ h2spec (Exceptional Scenario)
    +        '''
    +        sections = ['3.5', '4.2', '4.3', '6.1', '6.2', '6.3', '6.4', '6.5', '6.5.2', '6.7', '6.8',
    +                    '6.9', '6.9.1', '8.1', '8.1.2', '8.1.2.2', '8.1.2.3', '8.1.2.6', '8.2']
    +        for section in sections:
    +            self.__callH2Spec(section)
    +            self.assertIn('All tests passed', self.stdout, 'Failed at section %s of RFC7540' % section)
    +
    +        # TODO these tests cannot pass currently. move to above after ATS can pass them
    +        failing_sections = ['5.1', '5.3.1', '5.4.1', '5.5', '6.10']
    --- End diff --
    
    @masaori335 4.3 fails for me


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3782: Add H2 exceptional test cases

Posted by masaori335 <gi...@git.apache.org>.
Github user masaori335 commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/277#discussion_r37158715
  
    --- Diff: ci/tsqa/tests/test_http2_spec.py ---
    @@ -0,0 +1,114 @@
    +#  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.
    +
    +#
    +# Note: This test case uses h2spec. Please install it yourself.
    +# https://github.com/summerwind/h2spec
    +#
    +
    +import logging
    +import os
    +import subprocess
    +
    +import helpers
    +
    +import tsqa.endpoint
    +import tsqa.test_cases
    +import tsqa.utils
    +
    +log = logging.getLogger(__name__)
    +
    +# helper function to get h2spec path
    +def which(program):
    +    def is_exe(fpath):
    +        return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
    +    fpath, fname = os.path.split(program)
    +    if fpath:
    +        if is_exe(program):
    +            return program
    +    else:
    +        for path in os.environ["PATH"].split(os.pathsep):
    +            path = path.strip('"')
    +            exe_file = os.path.join(path, program)
    +            if is_exe(exe_file):
    +                return exe_file
    +    return None
    +
    +class TestH2Spec(helpers.EnvironmentCase, tsqa.test_cases.HTTPBinCase):
    +    @classmethod
    +    def setUpEnv(cls, env):
    +        '''
    +        Setting up environment for testing of HTTP2
    +        '''
    +        # get path to h2spec
    +        cls.h2spec = which('h2spec')
    +        if cls.h2spec is None:
    +          raise helpers.unittest.SkipTest('Cannot find h2spec. skipping test.')
    +
    +        # get HTTP/2 server ports
    +        cls.http2_port = tsqa.utils.bind_unused_port()[1]
    +
    +        # HTTP2 configs
    +        cls.configs['records.config']['CONFIG']['proxy.config.http2.enabled'] = 1
    +        cls.configs['records.config']['CONFIG']['proxy.config.http.server_ports'] += ' {0}:ssl'.format(cls.http2_port)
    +        cls.configs['records.config']['CONFIG']['proxy.config.ssl.server.cert.path'] = helpers.tests_file_path('rsa_keys')
    +        cls.configs['records.config']['CONFIG']['proxy.config.diags.debug.enabled'] = 1
    +        cls.configs['records.config']['CONFIG']['proxy.config.diags.debug.tags'] = 'http2.*|ssl.*'
    +
    +        # configure SSL multicert
    +        cls.configs['ssl_multicert.config'].add_line(
    +            'dest_ip=* ssl_cert_name={0}\n'.format(helpers.tests_file_path('rsa_keys/www.example.com.pem'))
    +        )
    +
    +        # remap configs
    +        cls.configs['remap.config'].add_line(
    +            'map / http://127.0.0.1:{0}/'.format(cls.http_endpoint.address[1])
    +        )
    +
    +    def __callH2Spec(self, section=None):
    +        '''
    +        Call h2spec
    +        '''
    +        args = [self.h2spec, '-h', 'localhost', '-p', str(self.http2_port), '-t', '-k']
    +        if section is not None:
    +          args.extend(['-s', section])
    +
    +        log.info('full args = {0}'.format(args))
    +        p = subprocess.Popen(
    +            args,
    +            stdout=subprocess.PIPE,
    +            stdin=subprocess.PIPE,
    +        )
    +        self.stdout, self.stderr = p.communicate()
    +        log.info('\n' + self.stdout)
    +
    +        return p.returncode
    +
    +    def test_http2_spec_section(self):
    +        '''
    +        Test HTTP/2 w/ h2spec (Exceptional Scenario)
    +        '''
    +        sections = ['3.5', '4.2', '4.3', '6.1', '6.2', '6.3', '6.4', '6.5', '6.5.2', '6.7', '6.8',
    +                    '6.9', '6.9.1', '8.1', '8.1.2', '8.1.2.2', '8.1.2.3', '8.1.2.6', '8.2']
    +        for section in sections:
    +            self.__callH2Spec(section)
    +            self.assertIn('All tests passed', self.stdout, 'Failed at section %s of RFC7540' % section)
    +
    +        # TODO these tests cannot pass currently. move to above after ATS can pass them
    +        failing_sections = ['5.1', '5.3.1', '5.4.1', '5.5', '6.10']
    --- End diff --
    
    `5.1`, `5.3.1`, `5.5`, `6.10` are fixed in current branch. See details in [TS-3808](https://issues.apache.org/jira/browse/TS-3808)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3782: Add H2 exceptional test cases

Posted by masaori335 <gi...@git.apache.org>.
Github user masaori335 commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/277#discussion_r39704520
  
    --- Diff: ci/tsqa/tests/test_http2_spec.py ---
    @@ -0,0 +1,114 @@
    +#  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.
    +
    +#
    +# Note: This test case uses h2spec. Please install it yourself.
    +# https://github.com/summerwind/h2spec
    +#
    +
    +import logging
    +import os
    +import subprocess
    +
    +import helpers
    +
    +import tsqa.endpoint
    +import tsqa.test_cases
    +import tsqa.utils
    +
    +log = logging.getLogger(__name__)
    +
    +# helper function to get h2spec path
    +def which(program):
    +    def is_exe(fpath):
    +        return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
    +    fpath, fname = os.path.split(program)
    +    if fpath:
    +        if is_exe(program):
    +            return program
    +    else:
    +        for path in os.environ["PATH"].split(os.pathsep):
    +            path = path.strip('"')
    +            exe_file = os.path.join(path, program)
    +            if is_exe(exe_file):
    +                return exe_file
    +    return None
    +
    +class TestH2Spec(helpers.EnvironmentCase, tsqa.test_cases.HTTPBinCase):
    +    @classmethod
    +    def setUpEnv(cls, env):
    +        '''
    +        Setting up environment for testing of HTTP2
    +        '''
    +        # get path to h2spec
    +        cls.h2spec = which('h2spec')
    +        if cls.h2spec is None:
    +          raise helpers.unittest.SkipTest('Cannot find h2spec. skipping test.')
    +
    +        # get HTTP/2 server ports
    +        cls.http2_port = tsqa.utils.bind_unused_port()[1]
    +
    +        # HTTP2 configs
    +        cls.configs['records.config']['CONFIG']['proxy.config.http2.enabled'] = 1
    +        cls.configs['records.config']['CONFIG']['proxy.config.http.server_ports'] += ' {0}:ssl'.format(cls.http2_port)
    +        cls.configs['records.config']['CONFIG']['proxy.config.ssl.server.cert.path'] = helpers.tests_file_path('rsa_keys')
    +        cls.configs['records.config']['CONFIG']['proxy.config.diags.debug.enabled'] = 1
    +        cls.configs['records.config']['CONFIG']['proxy.config.diags.debug.tags'] = 'http2.*|ssl.*'
    +
    +        # configure SSL multicert
    +        cls.configs['ssl_multicert.config'].add_line(
    +            'dest_ip=* ssl_cert_name={0}\n'.format(helpers.tests_file_path('rsa_keys/www.example.com.pem'))
    +        )
    +
    +        # remap configs
    +        cls.configs['remap.config'].add_line(
    +            'map / http://127.0.0.1:{0}/'.format(cls.http_endpoint.address[1])
    +        )
    +
    +    def __callH2Spec(self, section=None):
    +        '''
    +        Call h2spec
    +        '''
    +        args = [self.h2spec, '-h', 'localhost', '-p', str(self.http2_port), '-t', '-k']
    +        if section is not None:
    +          args.extend(['-s', section])
    +
    +        log.info('full args = {0}'.format(args))
    +        p = subprocess.Popen(
    +            args,
    +            stdout=subprocess.PIPE,
    +            stdin=subprocess.PIPE,
    +        )
    +        self.stdout, self.stderr = p.communicate()
    +        log.info('\n' + self.stdout)
    +
    +        return p.returncode
    +
    +    def test_http2_spec_section(self):
    +        '''
    +        Test HTTP/2 w/ h2spec (Exceptional Scenario)
    +        '''
    +        sections = ['3.5', '4.2', '4.3', '6.1', '6.2', '6.3', '6.4', '6.5', '6.5.2', '6.7', '6.8',
    +                    '6.9', '6.9.1', '8.1', '8.1.2', '8.1.2.2', '8.1.2.3', '8.1.2.6', '8.2']
    +        for section in sections:
    +            self.__callH2Spec(section)
    +            self.assertIn('All tests passed', self.stdout, 'Failed at section %s of RFC7540' % section)
    +
    +        # TODO these tests cannot pass currently. move to above after ATS can pass them
    +        failing_sections = ['5.1', '5.3.1', '5.4.1', '5.5', '6.10']
    --- End diff --
    
    @bryancall Which version of h2spec are you using? 4.3 of h2spec(version 1.1.1) doesn't fail for me.
    ```
      4.3. Header Compression and Decompression
        _ Sends invalid header block fragment
    ```
    
    I know that 4.3 of latest h2spec (35cb49dbefd8af09e7025207f646da4c30fe97ad) fails, and that is reported as [TS-3847](https://issues.apache.org/jira/browse/TS-3847).
    The fail is this?
    ```
      4.3. Header Compression and Decompression
        _ Sends invalid header block fragment
        _ Sends Dynamic Table Size Update (RFC 7541, 6.3)
        _ Encodes Dynamic Table Size Update (RFC 7541, 6.3) after common header fields
          - The endpoint MUST terminate the connection with a connection error of type COMPRESSION_ERROR.
            Expected: GOAWAY frame (ErrorCode: COMPRESSION_ERROR)
                      Connection close
              Actual: DATA frame (Length: 297, Flags: 1)
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3782: Add H2 exceptional test cases

Posted by syucream <gi...@git.apache.org>.
Github user syucream commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/277#discussion_r39702473
  
    --- Diff: ci/tsqa/tests/test_http2_spec.py ---
    @@ -0,0 +1,114 @@
    +#  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.
    +
    +#
    +# Note: This test case uses h2spec. Please install it yourself.
    +# https://github.com/summerwind/h2spec
    +#
    +
    +import logging
    +import os
    +import subprocess
    +
    +import helpers
    +
    +import tsqa.endpoint
    +import tsqa.test_cases
    +import tsqa.utils
    +
    +log = logging.getLogger(__name__)
    +
    +# helper function to get h2spec path
    +def which(program):
    +    def is_exe(fpath):
    +        return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
    +    fpath, fname = os.path.split(program)
    +    if fpath:
    +        if is_exe(program):
    +            return program
    +    else:
    +        for path in os.environ["PATH"].split(os.pathsep):
    +            path = path.strip('"')
    +            exe_file = os.path.join(path, program)
    +            if is_exe(exe_file):
    +                return exe_file
    +    return None
    +
    +class TestH2Spec(helpers.EnvironmentCase, tsqa.test_cases.HTTPBinCase):
    +    @classmethod
    +    def setUpEnv(cls, env):
    +        '''
    +        Setting up environment for testing of HTTP2
    +        '''
    +        # get path to h2spec
    +        cls.h2spec = which('h2spec')
    +        if cls.h2spec is None:
    +          raise helpers.unittest.SkipTest('Cannot find h2spec. skipping test.')
    +
    +        # get HTTP/2 server ports
    +        cls.http2_port = tsqa.utils.bind_unused_port()[1]
    +
    +        # HTTP2 configs
    +        cls.configs['records.config']['CONFIG']['proxy.config.http2.enabled'] = 1
    +        cls.configs['records.config']['CONFIG']['proxy.config.http.server_ports'] += ' {0}:ssl'.format(cls.http2_port)
    +        cls.configs['records.config']['CONFIG']['proxy.config.ssl.server.cert.path'] = helpers.tests_file_path('rsa_keys')
    +        cls.configs['records.config']['CONFIG']['proxy.config.diags.debug.enabled'] = 1
    +        cls.configs['records.config']['CONFIG']['proxy.config.diags.debug.tags'] = 'http2.*|ssl.*'
    +
    +        # configure SSL multicert
    +        cls.configs['ssl_multicert.config'].add_line(
    +            'dest_ip=* ssl_cert_name={0}\n'.format(helpers.tests_file_path('rsa_keys/www.example.com.pem'))
    +        )
    +
    +        # remap configs
    +        cls.configs['remap.config'].add_line(
    +            'map / http://127.0.0.1:{0}/'.format(cls.http_endpoint.address[1])
    +        )
    +
    +    def __callH2Spec(self, section=None):
    +        '''
    +        Call h2spec
    +        '''
    +        args = [self.h2spec, '-h', 'localhost', '-p', str(self.http2_port), '-t', '-k']
    +        if section is not None:
    +          args.extend(['-s', section])
    +
    +        log.info('full args = {0}'.format(args))
    +        p = subprocess.Popen(
    +            args,
    +            stdout=subprocess.PIPE,
    +            stdin=subprocess.PIPE,
    +        )
    +        self.stdout, self.stderr = p.communicate()
    +        log.info('\n' + self.stdout)
    +
    +        return p.returncode
    +
    +    def test_http2_spec_section(self):
    +        '''
    +        Test HTTP/2 w/ h2spec (Exceptional Scenario)
    +        '''
    +        sections = ['3.5', '4.2', '4.3', '6.1', '6.2', '6.3', '6.4', '6.5', '6.5.2', '6.7', '6.8',
    +                    '6.9', '6.9.1', '8.1', '8.1.2', '8.1.2.2', '8.1.2.3', '8.1.2.6', '8.2']
    +        for section in sections:
    +            self.__callH2Spec(section)
    +            self.assertIn('All tests passed', self.stdout, 'Failed at section %s of RFC7540' % section)
    +
    +        # TODO these tests cannot pass currently. move to above after ATS can pass them
    +        failing_sections = ['5.1', '5.3.1', '5.4.1', '5.5', '6.10']
    --- End diff --
    
    I'll remove `failing_sections` after [TS-3847](https://issues.apache.org/jira/browse/TS-3847) is resolved.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3782: Add H2 exceptional test cases

Posted by syucream <gi...@git.apache.org>.
Github user syucream commented on the pull request:

    https://github.com/apache/trafficserver/pull/277#issuecomment-130503083
  
    @jacksontj Hi, I fixed my patch for tsqa test cases. please take another look.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-3782: Add H2 exceptional test cases

Posted by bryancall <gi...@git.apache.org>.
Github user bryancall commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/277#discussion_r39705696
  
    --- Diff: ci/tsqa/tests/test_http2_spec.py ---
    @@ -0,0 +1,114 @@
    +#  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.
    +
    +#
    +# Note: This test case uses h2spec. Please install it yourself.
    +# https://github.com/summerwind/h2spec
    +#
    +
    +import logging
    +import os
    +import subprocess
    +
    +import helpers
    +
    +import tsqa.endpoint
    +import tsqa.test_cases
    +import tsqa.utils
    +
    +log = logging.getLogger(__name__)
    +
    +# helper function to get h2spec path
    +def which(program):
    +    def is_exe(fpath):
    +        return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
    +    fpath, fname = os.path.split(program)
    +    if fpath:
    +        if is_exe(program):
    +            return program
    +    else:
    +        for path in os.environ["PATH"].split(os.pathsep):
    +            path = path.strip('"')
    +            exe_file = os.path.join(path, program)
    +            if is_exe(exe_file):
    +                return exe_file
    +    return None
    +
    +class TestH2Spec(helpers.EnvironmentCase, tsqa.test_cases.HTTPBinCase):
    +    @classmethod
    +    def setUpEnv(cls, env):
    +        '''
    +        Setting up environment for testing of HTTP2
    +        '''
    +        # get path to h2spec
    +        cls.h2spec = which('h2spec')
    +        if cls.h2spec is None:
    +          raise helpers.unittest.SkipTest('Cannot find h2spec. skipping test.')
    +
    +        # get HTTP/2 server ports
    +        cls.http2_port = tsqa.utils.bind_unused_port()[1]
    +
    +        # HTTP2 configs
    +        cls.configs['records.config']['CONFIG']['proxy.config.http2.enabled'] = 1
    +        cls.configs['records.config']['CONFIG']['proxy.config.http.server_ports'] += ' {0}:ssl'.format(cls.http2_port)
    +        cls.configs['records.config']['CONFIG']['proxy.config.ssl.server.cert.path'] = helpers.tests_file_path('rsa_keys')
    +        cls.configs['records.config']['CONFIG']['proxy.config.diags.debug.enabled'] = 1
    +        cls.configs['records.config']['CONFIG']['proxy.config.diags.debug.tags'] = 'http2.*|ssl.*'
    +
    +        # configure SSL multicert
    +        cls.configs['ssl_multicert.config'].add_line(
    +            'dest_ip=* ssl_cert_name={0}\n'.format(helpers.tests_file_path('rsa_keys/www.example.com.pem'))
    +        )
    +
    +        # remap configs
    +        cls.configs['remap.config'].add_line(
    +            'map / http://127.0.0.1:{0}/'.format(cls.http_endpoint.address[1])
    +        )
    +
    +    def __callH2Spec(self, section=None):
    +        '''
    +        Call h2spec
    +        '''
    +        args = [self.h2spec, '-h', 'localhost', '-p', str(self.http2_port), '-t', '-k']
    +        if section is not None:
    +          args.extend(['-s', section])
    +
    +        log.info('full args = {0}'.format(args))
    +        p = subprocess.Popen(
    +            args,
    +            stdout=subprocess.PIPE,
    +            stdin=subprocess.PIPE,
    +        )
    +        self.stdout, self.stderr = p.communicate()
    +        log.info('\n' + self.stdout)
    +
    +        return p.returncode
    +
    +    def test_http2_spec_section(self):
    +        '''
    +        Test HTTP/2 w/ h2spec (Exceptional Scenario)
    +        '''
    +        sections = ['3.5', '4.2', '4.3', '6.1', '6.2', '6.3', '6.4', '6.5', '6.5.2', '6.7', '6.8',
    +                    '6.9', '6.9.1', '8.1', '8.1.2', '8.1.2.2', '8.1.2.3', '8.1.2.6', '8.2']
    +        for section in sections:
    +            self.__callH2Spec(section)
    +            self.assertIn('All tests passed', self.stdout, 'Failed at section %s of RFC7540' % section)
    +
    +        # TODO these tests cannot pass currently. move to above after ATS can pass them
    +        failing_sections = ['5.1', '5.3.1', '5.4.1', '5.5', '6.10']
    --- End diff --
    
    @masaori335 Yes, I was using master for h2spec, I replaced my install with v1.1.1 and it is working.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---