Devin Carr 599ba52750 TUN-8708: Bump python min version to 3.10 | hace 3 semanas | |
---|---|---|
.. | ||
.gitignore | hace 3 años | |
README.md | hace 3 semanas | |
cli.py | hace 1 año | |
config.py | hace 1 año | |
config.yaml | hace 1 año | |
conftest.py | hace 1 año | |
constants.py | hace 1 año | |
requirements.txt | hace 11 meses | |
setup.py | hace 11 meses | |
test_config.py | hace 1 año | |
test_edge_discovery.py | hace 2 años | |
test_logging.py | hace 1 año | |
test_management.py | hace 9 meses | |
test_pq.py | hace 1 año | |
test_proxy_dns.py | hace 1 año | |
test_quicktunnels.py | hace 7 meses | |
test_reconnect.py | hace 1 año | |
test_service.py | hace 2 años | |
test_tail.py | hace 5 meses | |
test_termination.py | hace 1 mes | |
test_token.py | hace 2 años | |
test_tunnel.py | hace 1 año | |
util.py | hace 11 meses |
Python 3.10 or later with packages in the given requirements.txt
python3 -m venv ./.venv
source ./.venv/bin/activate
python3 -m pip install -r requirements.txt
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 ```
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
Turn on linter If you are using Visual Studio, follow https://code.visualstudio.com/docs/python/linting to turn on linter.
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.
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
Specify path to config file via env var COMPONENT_TESTS_CONFIG
. This is required.
Run pytest
inside this(component-tests) folder
Run pytest <file 1 name>.py <file 2 name>.py
Run pytest file.py -k <test 1 name> -k <test 2 name>
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.