Changeset e3e0de1 in mod_gnutls for test/https-test-client.py


Ignore:
Timestamp:
Dec 7, 2019, 9:42:07 AM (23 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
asyncio, master, proxy-ticket
Children:
8b72599
Parents:
09d923b
Message:

https-test-client.py: Make host and port configurable per connection

Both variables can use environment variables. If unset they default to
TEST_TARGET and TEST_PORT. This makes it possible to connect to
different servers in one test, for example in proxy tests to check
that the backend server is behaving as expected.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/https-test-client.py

    r09d923b re3e0de1  
    1616# limitations under the License.
    1717
     18import os
    1819import yaml
    1920
     
    2526        description='Send HTTP requests through gnutls-cli',
    2627        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    27     parser.add_argument('host', nargs='?', help='Access the specified host',
    28                         default='localhost')
    29     parser.add_argument('-p', '--port', type=int,
    30                         help='Access the specified port', default='8000')
     28    parser.add_argument('host', nargs='?', default=None,
     29                        help='Access this host. Overrides TEST_TARGET, '
     30                        'but not the test configuration file.')
     31    parser.add_argument('-p', '--port', default=None,
     32                        help='Access this port. Overrides TEST_PORT, '
     33                        'but not the test configuration file.')
    3134    parser.add_argument('--timeout', type=float,
    3235                        help='Timeout for HTTP requests', default='5.0')
     
    4346    args = parser.parse_args()
    4447
     48    if args.host:
     49        os.environ['TEST_TARGET'] = args.host
     50    if args.port:
     51        os.environ['TEST_PORT'] = args.port
     52
    4553    conns = None
    4654
     
    5664
    5765    for test_conn in conns:
    58         test_conn.run(host=args.host, port=args.port, timeout=args.timeout)
     66        test_conn.run(timeout=args.timeout)
Note: See TracChangeset for help on using the changeset viewer.