cloudflared-mirror/component-tests
Miguel da Costa Martins Marcelino b0b898c235 TUN-10383: Set edge-ip-version to auto
To allow pre-checks to test both IPv6 and IPv4, we must change the default value of edge-ip-version's from 4 to auto. This will allows the tunnel (and pre-check) to probe both IPv4 and IPv6 addresses by default, respecting the system's DNS preference. Instead of always preferring IPv4, cloudflared will now use whichever address family the system resolver returns first.
2026-04-14 16:11:59 +00:00
..
.gitignore TUN-4055: Skeleton for component tests 2021-03-08 11:08:34 +00:00
README.md TUN-8708: Bump python min version to 3.10 2024-10-31 13:33:24 -07:00
cli.py TUN-10292: Add cloudflared management token command 2026-03-05 16:31:24 +00:00
config.py TUN-9858: Remove proxy-dns feature from cloudflared 2026-02-06 12:43:53 +00:00
config.yaml TUN-7360: Add Get Host Details handler in management service 2023-04-18 09:54:54 +00:00
conftest.py TUN-9858: Remove proxy-dns feature from cloudflared 2026-02-06 12:43:53 +00:00
constants.py TUN-9858: Remove proxy-dns feature from cloudflared 2026-02-06 12:43:53 +00:00
requirements.txt TUN-8066: Define scripts to build on Windows agents 2023-12-15 23:21:42 +00:00
setup.py TUN-8066: Define scripts to build on Windows agents 2023-12-15 23:21:42 +00:00
test_config.py CUSTESC-33731: Make rule match test report rule in 0-index base 2023-10-03 12:18:49 +01:00
test_edge_discovery.py TUN-10383: Set edge-ip-version to auto 2026-04-14 16:11:59 +00:00
test_logging.py TUN-7361: Add a label to override hostname 2023-04-19 13:56:32 +00:00
test_management.py TUN-10292: Add cloudflared management token command 2026-03-05 16:31:24 +00:00
test_pq.py TUN-8857: remove restriction for using FIPS and PQ 2025-01-30 05:47:07 -08:00
test_quicktunnels.py TUN-9858: Remove proxy-dns feature from cloudflared 2026-02-06 12:43:53 +00:00
test_reconnect.py TUN-7361: Add a label to override hostname 2023-04-19 13:56:32 +00:00
test_service.py TUN-9800: Migrate cloudflared-ci pipelines to Gitlab CI 2025-09-11 11:33:24 +01:00
test_tail.py TUN-10292: Add cloudflared management token command 2026-03-05 16:31:24 +00:00
test_termination.py TUN-8621: Prevent QUIC connection from closing before grace period after unregistering 2024-10-07 10:51:21 -05:00
test_token.py TUN-9803: Add windows builds to gitlab-ci 2025-09-10 11:23:41 +01:00
test_tunnel.py TUN-9858: Remove proxy-dns feature from cloudflared 2026-02-06 12:43:53 +00:00
util.py TUN-10292: Add cloudflared management token command 2026-03-05 16:31:24 +00:00

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:
- hostname: named-tunnel-component-tests.example.com
  service: hello_world
- service: http_status:404
  1. 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
  1. Turn on linter If you are using Visual Studio, follow https://code.visualstudio.com/docs/python/linting to turn on linter.

  2. 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.

  3. 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.