Devin Carr 599ba52750 TUN-8708: Bump python min version to 3.10 3 weken geleden
..
.gitignore e5d6f969be TUN-4055: Skeleton for component tests 3 jaren geleden
README.md 599ba52750 TUN-8708: Bump python min version to 3.10 3 weken geleden
cli.py ee5e447d44 TUN-7141: Add component tests for streaming logs 1 jaar geleden
config.py 7b8b3f73e7 TUN-7259: Add warning for missing ingress rules 1 jaar geleden
config.yaml 5e212a6bf3 TUN-7360: Add Get Host Details handler in management service 1 jaar geleden
conftest.py 7b8b3f73e7 TUN-7259: Add warning for missing ingress rules 1 jaar geleden
constants.py ee5e447d44 TUN-7141: Add component tests for streaming logs 1 jaar geleden
requirements.txt 33baad35b8 TUN-8066: Define scripts to build on Windows agents 11 maanden geleden
setup.py 33baad35b8 TUN-8066: Define scripts to build on Windows agents 11 maanden geleden
test_config.py adb7d40084 CUSTESC-33731: Make rule match test report rule in 0-index base 1 jaar geleden
test_edge_discovery.py e921ab35d5 TUN-6010: Add component tests for --edge-ip-version 2 jaren geleden
test_logging.py e426693330 TUN-7361: Add a label to override hostname 1 jaar geleden
test_management.py 5344a0bc6a TUN-8242: Enable remote diagnostics by default 9 maanden geleden
test_pq.py e426693330 TUN-7361: Add a label to override hostname 1 jaar geleden
test_proxy_dns.py e426693330 TUN-7361: Add a label to override hostname 1 jaar geleden
test_quicktunnels.py 5e5f2f4d8c TUN-8380: Add sleep before requesting quick tunnel as temporary fix for component tests 7 maanden geleden
test_reconnect.py e426693330 TUN-7361: Add a label to override hostname 1 jaar geleden
test_service.py e921ab35d5 TUN-6010: Add component tests for --edge-ip-version 2 jaren geleden
test_tail.py 0b62d45738 TUN-8456: Update quic-go to 0.45 and collect mtu and congestion control metrics 5 maanden geleden
test_termination.py e251a21810 TUN-8621: Prevent QUIC connection from closing before grace period after unregistering 1 maand geleden
test_token.py 98736a03e1 TUN-5915: New cloudflared command to allow to retrieve the token credentials for a Tunnel 2 jaren geleden
test_tunnel.py b243602d1c TUN-7550: Add pprof endpoint to management service 1 jaar geleden
util.py 33baad35b8 TUN-8066: Define scripts to build on Windows agents 11 maanden geleden

README.md

Requirements

  1. Python 3.10 or later with packages in the given requirements.txt

    • E.g. with venv:
    • python3 -m venv ./.venv
    • source ./.venv/bin/activate
    • python3 -m pip install -r requirements.txt
  2. Create a config yaml file, for example: ``` cloudflared_binary: "cloudflared" tunnel: "3d539f97-cd3a-4d8e-c33b-65e9099c7a8d" credentials_file: "/Users/tunnel/.cloudflared/3d539f97-cd3a-4d8e-c33b-65e9099c7a8d.json" origincert: "/Users/tunnel/.cloudflared/cert.pem" ingress:

  3. hostname: named-tunnel-component-tests.example.com service: hello_world

  4. service: http_status:404 ```

  5. Route hostname to the tunnel. For the example config above, we can do that via

    cloudflared tunnel route dns 3d539f97-cd3a-4d8e-c33b-65e9099c7a8d named-tunnel-component-tests.example.com
    
  6. Turn on linter If you are using Visual Studio, follow https://code.visualstudio.com/docs/python/linting to turn on linter.

  7. Turn on formatter If you are using Visual Studio, follow https://code.visualstudio.com/docs/python/editing#_formatting to turn on formatter and https://marketplace.visualstudio.com/items?itemName=cbrevik.toggle-format-on-save to turn on format on save.

  8. If you have cloudflared running as a service on your machine, you can either stop the service or ignore the service tests via --ignore test_service.py

How to run

Specify path to config file via env var COMPONENT_TESTS_CONFIG. This is required.

All tests

Run pytest inside this(component-tests) folder

Specific files

Run pytest <file 1 name>.py <file 2 name>.py

Specific tests

Run pytest file.py -k <test 1 name> -k <test 2 name>

Live Logging

Running with -o log_cli=true outputs logging to CLI as the tests are. By default the log level is WARN. --log-cli-level control logging level. For example, to log at info level, run pytest -o log_cli=true --log-cli-level=INFO. See https://docs.pytest.org/en/latest/logging.html#live-logs for more documentation on logging.