Changeset 1fe7cac in mod_gnutls


Ignore:
Timestamp:
Jan 5, 2020, 5:43:41 AM (6 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
master, proxy-ticket
Children:
459a982
Parents:
0b3733d
git-author:
Fiona Klute <fiona.klute@…> (01/05/20 05:41:39)
git-committer:
Fiona Klute <fiona.klute@…> (01/05/20 05:43:41)
Message:

TestReq10: Handle expected and unexpected connection failure

With this TestReq10 supports the same options as TestRequest?.

Location:
test
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • test/mgstest/tests.py

    r0b3733d r1fe7cac  
    4343# HTTPS).
    4444transport: 'gnutls'
    45 description='This connection description will be logged.'
     45description: 'This connection description will be logged.'
    4646actions:
    4747  - !request
     
    364364            print(errs.decode(), file=conn_log)
    365365
     366        if proc.returncode != 0:
     367            if len(outs) != 0:
     368                raise TestExpectationFailed(
     369                    f'Connection failed, but got output: {outs!r}')
     370            if self.expects_conn_reset():
     371                print('connection reset as expected.')
     372                return
     373            else:
     374                raise TestExpectationFailed(
     375                    'Connection failed unexpectedly!')
     376        else:
     377            if self.expects_conn_reset():
     378                raise TestExpectationFailed(
     379                    'Expected connection reset did not occur!')
     380
    366381        # first line of the received data must be the status
    367382        status, rest = outs.decode().split('\r\n', maxsplit=1)
  • test/sample_fail.yml

    r0b3733d r1fe7cac  
    1 # Example: The first TLS connection fails (certificate error), the
    2 # second succeeds but receives a 404.
    31- !connection
     2  description: 'This TLS connection must fail with a certificate error.'
    43  gnutls_params:
    54    - x509cafile=rogueca/x509.pem
     
    109        reset: yes
    1110- !connection
     11  description: 'TLS connection succeeds, the request receives error 404.'
    1212  gnutls_params:
    1313    - x509cafile=authority/x509.pem
    1414  actions:
    1515    - !request
    16       path: /
     16      path: /missing-file.txt
    1717      expect:
    1818        status: 404
     19- !connection
     20  description: 'This TLS connection must fail with a certificate error.'
     21  gnutls_params:
     22    - x509cafile=rogueca/x509.pem
     23  actions:
     24    - !request10
     25      path: /test.txt
     26      headers:
     27        Host: localhost
     28      expect:
     29        reset: yes
  • test/sample_test.yml

    r0b3733d r1fe7cac  
    2828          - 'Using GnuTLS version: '
    2929          - 'Current TLS session: (TLS1.3)'
     30  - !request10
     31    path: /test.txt
     32    headers:
     33      Host: localhost
     34    expect:
     35      headers:
     36        Content-Type: 'text/plain'
Note: See TracChangeset for help on using the changeset viewer.