mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-09-21 13:41:20 +02:00
26 lines
973 B
Diff
26 lines
973 B
Diff
Description: the test assumes /tmp/etc does not exist so that it would raise an
|
|
error when trying to open that location. Due to the many packages that run
|
|
tests, it happens to exist on the builders.
|
|
|
|
Use a dedicated directory as root using os.MkdirTemp().
|
|
|
|
Upstream: https://github.com/caddyserver/caddy/pull/4544
|
|
diff --git a/modules/caddyhttp/templates/tplcontext_test.go b/modules/caddyhttp/templates/tplcontext_test.go
|
|
index 401df3c..580b396 100644
|
|
--- a/modules/caddyhttp/templates/tplcontext_test.go
|
|
+++ b/modules/caddyhttp/templates/tplcontext_test.go
|
|
@@ -504,8 +504,12 @@ func initTestContext() (TemplateContext, error) {
|
|
if err != nil {
|
|
return TemplateContext{}, err
|
|
}
|
|
+ tmpDir, err := os.MkdirTemp(os.TempDir(), "caddy")
|
|
+ if err != nil {
|
|
+ return TemplateContext{}, err
|
|
+ }
|
|
return TemplateContext{
|
|
- Root: http.Dir(os.TempDir()),
|
|
+ Root: http.Dir(tmpDir),
|
|
Req: request,
|
|
RespHeader: WrappedHeader{make(http.Header)},
|
|
}, nil
|