mirror of
https://github.com/caddyserver/caddy.git
synced 2025-10-19 07:43:17 +00:00
cmd: remove zealous check of Caddyfile auto-detection (#6370)
* cmd: remove zealous check of Caddyfile auto-detection * add test case * remove redundant check, add comment * one more case
This commit is contained in:
parent
198f4385d2
commit
243351b2b1
2 changed files with 31 additions and 14 deletions
|
@ -226,15 +226,16 @@ func Test_isCaddyfile(t *testing.T) {
|
|||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "config is Caddyfile.yaml without adapter",
|
||||
name: "config is Caddyfile.yaml with adapter",
|
||||
args: args{
|
||||
configFile: "./Caddyfile.yaml",
|
||||
adapterName: "",
|
||||
adapterName: "yaml",
|
||||
},
|
||||
want: false,
|
||||
wantErr: true,
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
|
||||
name: "json is not caddyfile but not error",
|
||||
args: args{
|
||||
configFile: "./Caddyfile.json",
|
||||
|
@ -243,6 +244,26 @@ func Test_isCaddyfile(t *testing.T) {
|
|||
want: false,
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
|
||||
name: "prefix of Caddyfile and ./ with any extension is Caddyfile",
|
||||
args: args{
|
||||
configFile: "./Caddyfile.prd",
|
||||
adapterName: "",
|
||||
},
|
||||
want: true,
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
|
||||
name: "prefix of Caddyfile without ./ with any extension is Caddyfile",
|
||||
args: args{
|
||||
configFile: "Caddyfile.prd",
|
||||
adapterName: "",
|
||||
},
|
||||
want: true,
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue