caddy/modules
Kevin Daudt 44e5e9e43f
caddyhttp: Fix test when /tmp/etc already exists (#4544)
The TestFileListing test in tplcontext_test has one test that verifies
if directory traversal is not happening. The context root is set to
'/tmp' and then it tries to open '../../../../../etc', which gets
normalized to '/tmp/etc'.

The test then expects an error to be returned, assuming that '/tmp/etc'
does not exist on the system. When it does exist, it results in a test
failure:

```
--- FAIL: TestFileListing (0.00s)
    tplcontext_test.go:422: Test 4: Expected error but had none
    FAIL
    FAIL
    github.com/caddyserver/caddy/v2/modules/caddyhttp/templates	0.042s
```

Instead of using '/tmp' as root, use a dedicated directory created with
`os.MkdirTemp()` instead. That way, we know that the directory is empty.
2022-01-24 14:41:08 -07:00
..
caddyhttp caddyhttp: Fix test when /tmp/etc already exists (#4544) 2022-01-24 14:41:08 -07:00
caddypki caddypki: Return error if no PEM data found 2022-01-07 10:55:11 -07:00
caddytls caddytls: Add internal Caddyfile `lifetime`, `sign_with_root` opts (#4513) 2022-01-18 12:19:50 -07:00
filestorage httpcaddyfile: Minor fixes to parsing storage options 2020-05-01 09:34:32 -06:00
logging logging: Support turning off roll compression via Caddyfile (#4505) 2022-01-04 12:11:27 -07:00
metrics metrics: allow disabling OpenMetrics negotiation (#3944) 2020-12-30 11:44:02 -07:00
standard metrics: Initial integration of Prometheus metrics (#3709) 2020-09-17 12:01:20 -06:00