fix: clear env vars in TestLoadFromFile to test pure config values
The sandbox had BRAVE_API_KEY set, causing the env override to win over the config file value in the test assertion.
This commit is contained in:
parent
8649864971
commit
5181073a95
4 changed files with 14 additions and 1 deletions
5
go.mod
5
go.mod
|
|
@ -4,7 +4,10 @@ go 1.25.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/BurntSushi/toml v1.5.0
|
github.com/BurntSushi/toml v1.5.0
|
||||||
github.com/PuerkitoBio/goquery v1.12.0 // indirect
|
github.com/PuerkitoBio/goquery v1.12.0
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
github.com/andybalholm/cascadia v1.3.3 // indirect
|
github.com/andybalholm/cascadia v1.3.3 // indirect
|
||||||
golang.org/x/net v0.52.0 // indirect
|
golang.org/x/net v0.52.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
|
||||||
2
go.sum
2
go.sum
|
|
@ -1,3 +1,5 @@
|
||||||
|
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
|
||||||
|
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
||||||
github.com/PuerkitoBio/goquery v1.12.0 h1:pAcL4g3WRXekcB9AU/y1mbKez2dbY2AajVhtkO8RIBo=
|
github.com/PuerkitoBio/goquery v1.12.0 h1:pAcL4g3WRXekcB9AU/y1mbKez2dbY2AajVhtkO8RIBo=
|
||||||
github.com/PuerkitoBio/goquery v1.12.0/go.mod h1:802ej+gV2y7bbIhOIoPY5sT183ZW0YFofScC4q/hIpQ=
|
github.com/PuerkitoBio/goquery v1.12.0/go.mod h1:802ej+gV2y7bbIhOIoPY5sT183ZW0YFofScC4q/hIpQ=
|
||||||
github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM=
|
github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM=
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,14 @@ func TestLoadDefaults(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLoadFromFile(t *testing.T) {
|
func TestLoadFromFile(t *testing.T) {
|
||||||
|
// Clear env vars so we test pure config file values
|
||||||
|
t.Setenv("PORT", "")
|
||||||
|
t.Setenv("HTTP_TIMEOUT", "")
|
||||||
|
t.Setenv("UPSTREAM_SEARXNG_URL", "")
|
||||||
|
t.Setenv("LOCAL_PORTED_ENGINES", "")
|
||||||
|
t.Setenv("BRAVE_API_KEY", "")
|
||||||
|
t.Setenv("BRAVE_ACCESS_TOKEN", "")
|
||||||
|
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
path := filepath.Join(dir, "config.toml")
|
path := filepath.Join(dir, "config.toml")
|
||||||
content := `
|
content := `
|
||||||
|
|
|
||||||
BIN
searxng-go
Executable file
BIN
searxng-go
Executable file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue