Skip to content

Commit cb27d68

Browse files
authored
Merge pull request #2482 from AdamKorcz/fuzz3
add fuzz test for setupEnv
2 parents 0cfd535 + 8a38520 commit cb27d68

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

pkg/cidata/fuzz_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package cidata
2+
3+
import (
4+
"fmt"
5+
"testing"
6+
7+
"github.com/lima-vm/lima/pkg/networks"
8+
"github.com/lima-vm/lima/pkg/ptr"
9+
10+
"github.com/lima-vm/lima/pkg/limayaml"
11+
)
12+
13+
func FuzzSetupEnv(f *testing.F) {
14+
f.Fuzz(func(_ *testing.T, suffix string, localhost bool) {
15+
var prefix string
16+
if localhost {
17+
prefix = "http://localhost:8080/"
18+
} else {
19+
prefix = "http://127.0.0.1:8080/"
20+
}
21+
envKey := "http_proxy"
22+
envValue := fmt.Sprintf("%s%s", prefix, suffix)
23+
templateArgs := TemplateArgs{SlirpGateway: networks.SlirpGateway}
24+
envAttr := map[string]string{envKey: envValue}
25+
_, _ = setupEnv(&limayaml.LimaYAML{PropagateProxyEnv: ptr.Of(false), Env: envAttr}, templateArgs)
26+
})
27+
}

0 commit comments

Comments
 (0)